-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(srgssr-middleware): add chapters support
Resolves #204 by allowing developers to access chapters directly from the player's text tracks. Chapters can be accessed in two ways. The first is raw data via the `mediaData` object from player `currentSource`. The second is via the player's `textTracks`. This last method allows to listen to the cuechange event and react as accordingly. ```javascript // Accessing raw data player.currentSource().mediaData.chapters; // Listen for cuechange events and get the active cue player.textTracks().getTrackById('srgssr-chapters').on('cuechange', ()=>{ const [active] = Array.from(player.textTracks().getTrackById('srgssr-chapters').activeCues); JSON.parse(active); // note that active can be undefined }); ``` - add the `chapters` property to `mediaComposition` - add a function to add `chapters` to the `player` - add the `chapters` when resolving the resource in the `setSource` function - add test cases - add test media containing multiple chapters
- Loading branch information
Showing
5 changed files
with
119 additions
and
0 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
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