Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pause on slide #2041

Merged
merged 11 commits into from
Feb 1, 2017
Merged

pause on slide #2041

merged 11 commits into from
Feb 1, 2017

Conversation

olypros
Copy link
Contributor

@olypros olypros commented Jan 30, 2017

No description provided.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 60.982% when pulling f7337c5 on ricking06:master into e4bc8f8 on johndyer:master.

@rafa8626
Copy link
Contributor

Thanks for the PR; however, you shouldn't work on the build files, but in the src files; please do the modifications ONLY on that folder so it can be reviewed. Thanks

@olypros
Copy link
Contributor Author

olypros commented Jan 30, 2017

Pros:
its smoother when sliding

cons :
you wont be able to see different frames while sliding
( but this can be solved by making thumbnails of video using ffmpeg and custom made plugin(a mejs__layer ) to show those thumbnails while seeking, but its out of the topic )

@rafa8626
Copy link
Contributor

Thanks for the extra notes. Let me know when you have the changes on the src folder and reverted any changes in the build folder so I can check and merge your changes, please

@coveralls
Copy link

Coverage Status

Coverage remained the same at 60.982% when pulling 5dc8978 on ricking06:master into e4bc8f8 on johndyer:master.

@olypros
Copy link
Contributor Author

olypros commented Jan 30, 2017

i have reverted the build and made changes in src/features/progress.js

@coveralls
Copy link

Coverage Status

Coverage remained the same at 60.982% when pulling 71d9818 on ricking06:master into e4bc8f8 on johndyer:master.

@rafa8626
Copy link
Contributor

Perfect. I'll check them in a minute; just for curiosity, which OS and browsers did you test? We are trying to get the experience the same as possible for mobile/desktop/tablet

@olypros
Copy link
Contributor Author

olypros commented Jan 30, 2017

chrome win/ android chrome. it should work in all browsers.

@rafa8626
Copy link
Contributor

Perfect. I'll check it today

@rafa8626
Copy link
Contributor

rafa8626 commented Jan 31, 2017

OK I have reviewed it and I think it's good to go; the only comment I can make is (after recoding some pieces to fit into ES6) is: would you mind if I set media.setCurrentTime(t.newTime) in the handleMouseMove method?

if (mouseIsDown && t.newTime.toFixed(4) !== media.currentTime.toFixed(4)) {
	media.setCurrentTime(t.newTime);
	t.setCurrentRailHandle(t.newTime);
	t.updateCurrent(t.newTime); 
} 

Reason being is because the behavior sliding of the progress handle the way it was is the standard across many other players. Other than that I'm OK with the changes. Let me know ASAP to merge this. You don't need to do the change I can do it, I just need your permission to add this.

@@ -11,7 +11,20 @@ import {secondsToTimeCode} from '../utils/time';
*
* This feature creates a progress bar with a slider in the control bar, and updates it based on native events.
*/

function setCurrentRailMain(t,fakeTime){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be inside the Object.assign(MediaElementPlayer.prototype like the setCurrentRailHandle method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it should be inside

if (t.total && t.handle) {
var newWidth = Math.round(t.total.width() * nTime / t.media.duration),
handlePos = newWidth - Math.round(t.handle.outerWidth(true) / 2);
newWidth = fakeTime / t.media.duration * 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be nTime instead of fakeTime; otherwise, the rail never gets updated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah thats right i missed it while editing github repos.

@@ -312,7 +346,9 @@ Object.assign(MediaElementPlayer.prototype, {
media.addEventListener('timeupdate', (e) => {
if (media.duration !== Infinity ) {
player.setProgressRail(e);
player.setCurrentRail(e);
if(!t.forcedHandlePause){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this conditional necessary? If it is, make sure you do the same in the progress listener

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it is necesary when media.setCurrentTime(t.newTime); is not added to handleMouseMove function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if you add this option t.option.lowMemoryOptimize then condition should change to

if(!t.forcedHandlePause || t.option.lowMemoryOptimize){
...
}

Same for progress event

.

See below for t.option.lowMemoryOptimize

}
setCurrentRailHandle: function setCurrentRailHandle(fakeTime) {
var t = this;
setCurrentRailMain(t,fakeTime);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you move method, change this to t. setCurrentRailMain

},
setCurrentRail: function setCurrentRail() {
var t = this;
setCurrentRailMain(t);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you move method, change this to t.setCurrentRailMain

@rafa8626
Copy link
Contributor

I can fix all the issues I found for you if it's your desire. Just let me know

}
// fake seek to where the mouse is
if (mouseIsDown && t.newTime.toFixed(4) !== media.currentTime.toFixed(4)) {
t.setCurrentRailHandle(t.newTime);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add media.setCurrentTime(t.newTime); to allow a better behavior

Copy link
Contributor Author

@olypros olypros Feb 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No is should not be added , thats the whole point of doing the changes.

In average/low memory pc when the player is added along with huge amounts of UI elements there is a (lag/delay OR no response) of t.current/t.handle when calling handleMouseMove because of the media.setCurrentTime(t.newTime); because mousemove is expensive event.

If you look at famous players like youtube/vimeo etc they dont setTIme of video on mousemove rather on mouseup.

Maybe you can add a t.option.lowMemoryOptimize

and do

if(!t.option.lowMemoryOptimize){
media.setCurrentTime(t.newTime);
}

on handleMouseMove

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Well I'll add that option, fix your changes and merge into master. Thanks

@rafa8626 rafa8626 merged commit 71d9818 into mediaelement:master Feb 1, 2017
@rafa8626
Copy link
Contributor

rafa8626 commented Feb 1, 2017

Thanks for this PR. Merged now with fixes and I decided not to include the option, since I saw that Vimeo and YouTube actually handle that behavior in the way you described it. I based this mostly on other open source players like VideoJS.

@olypros
Copy link
Contributor Author

olypros commented Feb 1, 2017

yeah thats cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants