feat: custom media data support and tracker control#33
Merged
amtins merged 8 commits intoOct 6, 2023
Conversation
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success127 tests passing in 8 suites. Report generated by 🧪jest coverage report action from 997dad2 |
0d5cc5f to
17ddabf
Compare
Allow to use the latest state-of-the-art IL features. - update `baseUrl` property
Add support for custom media data when provided via the `mediaData` property to
the `player.src`. Allow `mediaComposition` properties to be added or
overwritten when loading a new source.
```javascript
// custom media data
player.src({
src : 'urn:xyz',
type: 'srgssr/urn',
mediaData : {
// custom properties
}
})
```
Store the `DataProvider` in the player's `srgOptions`, allowing it to be changed
on the fly. This means it's no longer needed to extend the `SrgSsr` class to
redefine the default `DataProvider`. The only requirement is that the new
`DataProvider` implements the `getMediaCompositionByUrn` function and returns an
object of type `MediaComposition`.
```javascript
// custom data provider
player.options({
srgOptions : {
dataProvider : {
getMediaCompositionByUrn(urn) {
// ... body of the function
}
}
}
})
```
- add `srgOptions` to Pillarbox default options
- rename `DataProviderService` to `DataProvider`
- move `DataProvider` from middleware functions parameter to its own function
- handle `srcOptions` enabling customized `mediaData` to be provided to the player
- add `srcOptions` to the `composeSrcMediaData` function parameters
- update `srgssr` unit tests
- add `srgOptions` to the options in the mock player
- rename `DataProviderService` to `DataProvider`
- remove `DataProvider` from `middleware` function parameters
- update some `middleware` test cases description
Refers to issue #32
`Video.js` allows components to be activated or deactivated via `options`. Avoids breaking the compatibility offered by this feature.
17ddabf to
d98b95c
Compare
waliid
reviewed
Sep 27, 2023
| static async composeAkamaiResources(resources = []) { | ||
| if (!AkamaiTokenService.hasToken(resources)) Promise.resolve(resources); | ||
|
|
||
| // TODO allow to modify the Akamai URL |
2846752 to
8143dd7
Compare
8143dd7 to
0a197b9
Compare
Add support for the `trackers` property to the `player.options` in order to
store tracker instances. This makes it easier to access trackers directly from
the player. Use of this feature remains optional.
```javascript
// add custom tracker
const player = new Pillarbox('my-player', {
trackers: {
customTracker: new CustomTracker(player),
anotherTracker: new AnotherTracker(player),
}
})
```
Add the ability to disable trackers per playback session by introducing the
`disableTrackers` property provided directly to the `player.src`. As most trackers
take an instance of the player as a parameter. This will make it easier to access
the disableTrackers property to determine whether or not the tracker should be
disabled for the current playback session.
```javascript
// disable a tracker for the playback session
player.src({
src : 'urn:xyz',
type: 'srgssr/urn',
disableTrackers : ['anotherTracker']
});
// disable all trackers for the playback session
player.src({
src : 'urn:xyz',
type: 'srgssr/urn',
disableTrackers : true
})
```
Add support for SRG SSR-compliant media playback tracking.
- add `trackers` to Pillarbox default options
- add the `SRGAnalytics` class and unit tests
- add `PlayerEvents` that contains all `mediaElement` events
- srgssr middleware
- add a function to handle SRG SSR analytics
- update `composeSrcMediaData` to handle `disableTrackers`
- move the construction of the main resources array into its own function
- update unit tests
Refers to issue #32
0a197b9 to
997dad2
Compare
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Add support for custom media data when provided via the
mediaDataproperty tothe
player.src. AllowmediaCompositionproperties to be added oroverwritten when loading a new source.
Store the
DataProviderin the player'ssrgOptions, allowing it to be changedon the fly. This means it's no longer needed to extend the
SrgSsrclass toredefine the default
DataProvider. The only requirement is that the newDataProviderimplements thegetMediaCompositionByUrnfunction and returns anobject of type
MediaComposition.Add support for the
trackersproperty to theplayer.optionsin order tostore tracker instances. This makes it easier to access trackers directly from
the player. Use of this feature remains optional.
Add the ability to disable trackers per playback session by introducing the
disableTrackersproperty provided directly to theplayer.src. As most trackerstake an instance of the player as a parameter. This will make it easier to access
the disableTrackers property to determine whether or not the tracker should be
disabled for the current playback session.
Add support for SRG SSR-compliant media playback tracking.
Changes made
srgOptionsto Pillarbox default optionsDataProviderServicetoDataProviderDataProviderfrom middleware functions parameter to its own functionsrcOptionsenabling customizedmediaDatato be provided to the playersrcOptionsto thecomposeSrcMediaDatafunction parameterssrgssrunit testssrgOptionsto the options in the mock playerDataProviderServicetoDataProviderDataProviderfrommiddlewarefunction parametersmiddlewaretest cases descriptiontrackersto Pillarbox default optionsSRGAnalyticsclass and unit testsPlayerEventsthat contains allmediaElementeventscomposeSrcMediaDatato handledisableTrackersbaseUrlproperty to use IL 2.1titleBarbubyvendorvideo.jsto version 8.5.3outdatedpackageseslintallow unused vars prefixed by_Resolves #32