-
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.
Resolves #241, by allowing developers to define their own `dataProvider` and thus avoid making a network request when the platform already has data that can be used by the player. The `dataProvider` is a player `option` that takes a parameter function. This function must take an argument symbolizing the content object to be played, in the form of a `string`. Finally, this function must return a JSON object. > [!TIP] > How to use the `dataProvider` option ```javascript const player = pillarbox('player', { srgOptions: { // defines the custom data provider dataProvider: (data) => JSON.parse(data) } }); // A stringified object representing the mediaComposition const mediaCompositionStringifiedObject = JSON.stringify({ // ... }); // load the src player.src({src: mediaCompositionStringifiedObject, type:'srgssr/urn'}); ``` > [!CAUTION] > If the src object does not conform to the mediaComposition, unexpected errors > may occur, preventing the video from playing. - dataProvider's handleRequest no longer returns an instance of mediaComposition, but a json object representing it - srgssr middleware's getMediaComposition is responsible for instantiating the mediaComposition - add missing options to the srgOptions and create a dedicated type - add dataProvider tutorial - update unit tests - change default URN for development page
- Loading branch information
Showing
6 changed files
with
105 additions
and
54 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
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