Closed chikathreesix closed 8 years ago
At first, I would've been inclined to say that we don't want to trigger timeupdate
while the video is paused but reading the spec, seems like timeupdate
should also be called when currentTime
changed in an interesting way, like during a discontinuity, so, we definitely need to fix that.
Given that videojs already has the manual time updates because this is currently using the flash tech, I'd be inclined to not way another setInterval
. Instead, we probably do want to just trigger the timeupdate
right after setting currentTime
in the disconinuity but make sure that fillBuffer
and drainBuffer
don't react to our own timeupdate
s.
we probably do want to just trigger the timeupdate right after setting currentTime in the disconinuity but make sure that fillBuffer and drainBuffer don't react to our own timeupdates.
Yes, that is definitely the best way to fix this. I'm currently triggering timeupdate
in setCurrentTime
but as you mentioned, it makes fillBuffer
and drainBuffer
to be called twice.
Do you have any idea to implement it? Trigger with an event object that has some data which can be considered as a our own timeupdate
? Sounds not so good though... I'd like to somehow catch the events at the lower level however there is no lower level so far.
I have no thoughts as of yet. Maybe set a flag that fillBuffer and drainBuffer check, though, flags are not great. Maybe remove the handler, trigger the event and reattach the handler. @dmlap any thoughts?
Using timeupdate
to trigger buffer management is starting to look like the wrong mechanism. I think using a simple recurring setTimeout() like @chikathreesix suggests may be the way to go. As a side benefit, it would allow us to fix #133 without doing any gymnastics.
If we go this route, I'd want to de-couple the buffer management from time tracking entirely. That is, just set up polling to trigger fillBuffer/drainBuffer and let the Flash tech do its thing with timeupdate
generation. We could still trigger the timeupdate
event in drainBuffer() if we wanted to signal interesting timeline events, however.
I may have misread the original post but having a timer for fillBuffer/drainBuffer sounds ok to me. I just don't think this tech needs to handle manual timeupdates itself.
@gkatsev right, we're on the same page on this one.
The quick summary:
timeupdate
eventstimeupdate
manually in the case of interesting timeline discontinuities, like seeking while pausedMy original suggestion was having a timer for manual timeupdates, but having a timer for fillBuffer/drainBuffer sounds much better. Thanks!
False alarm on this one. fillBuffer() should now get called when the player is paused but we still should fire timeupdate
s when we cross a discontinuity.
I think we're all set with this one in 1.x. Thanks for the report!
Because the current time is set in
drainBuffer
and it doesn't triggertimeupdate
event, this event is not triggered when a video is paused. If the video is playing, the callback of setInterval triggerstimeupdate
every 250 millisecond so it won't be a big problem.Therefore I would like to trigger
timeupdate
right aftervjs_setProperty
is called, however, it will be an infinite loop becausedrainBuffer
is one of a callback fortimeupdate
.So I came up with an idea below. Like
manualTimeupdatesOn
in the originalvideo.js
, implementsetInterval
to triggertimeupdate
invideojs-hls
and call all callbacks includingdrainBuffer
in the interval. And also setfeaturesTimeupdateEvents
to false to avoid originalmanualTimeupdatesOn
from being called.Then
timeupdate
can be triggered right aftervjs_setProperty
is called indrainBuffer
. But I feel this solution is a bit redundant...Could you tell me your opinion?