-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
pause on slide #2041
Conversation
Thanks for the PR; however, you shouldn't work on the |
Pros: cons : |
Thanks for the extra notes. Let me know when you have the changes on the |
i have reverted the build and made changes in src/features/progress.js |
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 |
chrome win/ android chrome. it should work in all browsers. |
Perfect. I'll check it today |
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){ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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. |
yeah thats cool |
No description provided.