-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Wait for chapters track to be loaded (#4228)
addChaptersTrack() was already an async method, but it did not wait for the chapter data to be loaded by the browser. The solution is to wait for the `load` event on the `<track>` element we create. To accomplish this, some cleanup and refactoring was done in how tracks are managed. Summary of changes: - The `addtrack` event, which triggered management of tracks in src= playback, is now used for all types of playback. In src= mode, it manages all tracks, and in MSE mode, it only manages chapters tracks (which are added to the video element as in src= mode). - `processChaptersTrack_()` has been renamed to `activateChaptersTrack_()`, since its only job is to set the track's mode field to make the browser load it. - `activateChaptersTrack_()` is now only ever called via the `addtrack` event. - `activateChaptersTrack_()` no longer loops over all chapter tracks on a timer, and instead only touches the single track it was called for. - `addSrcTrackElement_()` now returns the HTML `<track>` element it creates. - `addChaptersTrack()` now awaits a `load` or `error` event to complete (or fail) the operation. - Existing tests for addChaptersTrack had long delays to work around this issue; these delays have simply been removed. Fixes #4186
- Loading branch information
1 parent
a6b7148
commit 80e81f1
Showing
5 changed files
with
181 additions
and
106 deletions.
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
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
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.