-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix: ensure all timelineregionenter events are fired #6713
Merged
avelad
merged 1 commit into
shaka-project:main
from
cbsinteractive:issue/6711-timelineregionenter
May 31, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 could use more explanation in the PR description. Why is startTime correct and startTimeOfLoad wrong? What's the difference?
Might also be worth a comment here in the code.
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.
There are extensive notes in the associated issue #6711
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.
We don't understand why
startTimeOfLoad
is being used, especially for VOD. ThestartTimeOfLoad
argument is used to set thestartsPastZero
flag inRegionObserver
. The comments there seem to indicate that it is playhead related:shaka-player/lib/media/region_observer.js
Lines 39 to 44 in 30ac8c0
This makes sense. If the user called
player.load()
with a non-zero start time, the observer should wait until the initial seek has completed.startTimeOfLoad
is the wall clock time of when the load operation started. How does that play into how the region observer operates? Before the commit mentioned in the issue,startTimeOfLoad
was alwayNaN
at the timecreatePlayheadObserversForMSE_
, which coincidentally resulted in the correct behavior for VOD.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.
@theodab Can you provide any insight here? The comments in #5361 state:
Unfortunately, after the @avelad's state engine refactor,
startTimeOfLoad
is always greater than zero, which meansstartsPastZero
is alwaystrue
, regardless of live/vod.This comments also mention:
With
startTimeOfLoad
being a timestamp, it doesn't seem like the correct value to use here. It suggests a delta likeDate.now() / 1000 - startTimeOfLoad
. That said, when we test on versions <= 4.5.0, we seestartTimeOfLoad
always comes in asNaN
, so really onlythis.isLive()
has any effect on the observer'sstartsPastZero
flag.@joeyparrish This fact led us to look into what values makes the most sense to use here, and we determined that
load()
'sstartTime
was the answer. When playing live, wait for a the playhead to update before dispatching timeline region events. When playing VOD, the player should also wait for any initial seek operations before tracking timeline region changes.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, I think the original code using
startTimeOfLoad
was a mistake. It's supposed to check for if we were loading partway through the presentation, so that we won't fire region events for regions that the player loads in after the end of. ThestartTime
variable would be the actual variable we want for this.Honestly, we should probably just rename the
startTImeOfLoad
variable. It's confusingly similar tostartTime
, despite the two variables having much different meanings and effects in the loading process.