@srgssr/pillarbox-web 1.17.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pillarbox-core.cjs.js +11 -6
- package/dist/pillarbox-core.cjs.js.map +1 -1
- package/dist/pillarbox-core.es.js +11 -6
- package/dist/pillarbox-core.es.js.map +1 -1
- package/dist/pillarbox.cjs.js +143 -111
- package/dist/pillarbox.cjs.js.map +1 -1
- package/dist/pillarbox.es.js +144 -112
- package/dist/pillarbox.es.js.map +1 -1
- package/dist/pillarbox.umd.js +143 -111
- package/dist/pillarbox.umd.js.map +1 -1
- package/dist/pillarbox.umd.min.js +1 -1
- package/dist/pillarbox.umd.min.js.map +1 -1
- package/dist/types/build.es.d.ts +5 -1
- package/dist/types/build.es.d.ts.map +1 -1
- package/dist/types/src/components/player.d.ts +7 -8
- package/dist/types/src/components/player.d.ts.map +1 -1
- package/dist/types/src/dataProvider/model/MediaComposition.d.ts +12 -0
- package/dist/types/src/dataProvider/model/MediaComposition.d.ts.map +1 -1
- package/dist/types/src/dataProvider/services/DataProvider.d.ts +3 -3
- package/dist/types/src/dataProvider/services/DataProvider.d.ts.map +1 -1
- package/dist/types/src/middleware/srgssr.d.ts +76 -73
- package/dist/types/src/middleware/srgssr.d.ts.map +1 -1
- package/dist/types/src/trackers/PillarboxMonitoring.d.ts +15 -8
- package/dist/types/src/trackers/PillarboxMonitoring.d.ts.map +1 -1
- package/dist/types/src/trackers/SRGAnalytics.d.ts +55 -55
- package/dist/types/src/trackers/SRGAnalytics.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/src/components/typedef.d.ts +0 -14
- package/dist/types/src/components/typedef.d.ts.map +0 -1
- package/dist/types/src/middleware/typedef.d.ts +0 -67
- package/dist/types/src/middleware/typedef.d.ts.map +0 -1
package/dist/pillarbox.cjs.js
CHANGED
|
@@ -109,11 +109,16 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
109
109
|
return target;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
const version = "1.
|
|
112
|
+
const version = "1.17.0";
|
|
113
|
+
|
|
114
|
+
/** @import VJSPlayer from 'video.js/dist/types/player' */
|
|
115
|
+
/** @import AudioTrack from 'video.js/dist/types/tracks/audio-track' */
|
|
116
|
+
/** @import TextTrack from 'video.js/dist/types/tracks/text-track' */
|
|
117
|
+
/** @import {TrackSelector} from './typedef' */
|
|
113
118
|
|
|
114
119
|
/**
|
|
115
120
|
* @ignore
|
|
116
|
-
* @type {typeof
|
|
121
|
+
* @type {typeof VJSPlayer}
|
|
117
122
|
*/
|
|
118
123
|
const vjsPlayer = videojs.getComponent('player');
|
|
119
124
|
|
|
@@ -148,7 +153,7 @@ class Player extends vjsPlayer {
|
|
|
148
153
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/kind
|
|
149
154
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/language
|
|
150
155
|
*
|
|
151
|
-
* @param {
|
|
156
|
+
* @param {TrackSelector} [trackSelector]
|
|
152
157
|
*
|
|
153
158
|
* @example
|
|
154
159
|
* // Get the current audio track
|
|
@@ -162,7 +167,7 @@ class Player extends vjsPlayer {
|
|
|
162
167
|
* // Activate first audio track found corresponding to language
|
|
163
168
|
* player.audioTrack({language:'fr'});
|
|
164
169
|
*
|
|
165
|
-
* @return {
|
|
170
|
+
* @return {AudioTrack | undefined} The
|
|
166
171
|
* currently enabled audio track. See {@link https://docs.videojs.com/audiotrack}.
|
|
167
172
|
*/
|
|
168
173
|
audioTrack(trackSelector) {
|
|
@@ -272,7 +277,7 @@ class Player extends vjsPlayer {
|
|
|
272
277
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack/kind
|
|
273
278
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/textTrack/language
|
|
274
279
|
*
|
|
275
|
-
* @param {
|
|
280
|
+
* @param {TrackSelector} [trackSelector]
|
|
276
281
|
*
|
|
277
282
|
* @example
|
|
278
283
|
* // Get the current text track
|
|
@@ -291,7 +296,7 @@ class Player extends vjsPlayer {
|
|
|
291
296
|
* // Activate first text track found corresponding to language
|
|
292
297
|
* player.textTrack({language:'fr'});
|
|
293
298
|
*
|
|
294
|
-
* @return {
|
|
299
|
+
* @return {TextTrack | undefined} The
|
|
295
300
|
* currently enabled text track. See {@link https://docs.videojs.com/texttrack}.
|
|
296
301
|
*/
|
|
297
302
|
textTrack(trackSelector) {
|
|
@@ -410,10 +415,11 @@ pillarbox.options.responsive = true;
|
|
|
410
415
|
*/
|
|
411
416
|
pillarbox.options.trackers = {};
|
|
412
417
|
|
|
418
|
+
/** @import MediaComposition from '../model/MediaComposition.js' */
|
|
419
|
+
|
|
413
420
|
/**
|
|
414
421
|
* Represents a data provider for constructing URLs and handling requests.
|
|
415
422
|
* @class
|
|
416
|
-
* @ignore
|
|
417
423
|
*/
|
|
418
424
|
class DataProvider {
|
|
419
425
|
/**
|
|
@@ -441,7 +447,7 @@ class DataProvider {
|
|
|
441
447
|
*
|
|
442
448
|
* @param {Function} urlHandler A function that constructs the URL
|
|
443
449
|
*
|
|
444
|
-
* @returns {Promise<
|
|
450
|
+
* @returns {Promise<MediaComposition>} A promise with the fetched data
|
|
445
451
|
*/
|
|
446
452
|
handleRequest(urlHandler) {
|
|
447
453
|
var _this = this;
|
|
@@ -453,7 +459,7 @@ class DataProvider {
|
|
|
453
459
|
throw response;
|
|
454
460
|
}
|
|
455
461
|
|
|
456
|
-
/** @type {
|
|
462
|
+
/** @type {MediaComposition} */
|
|
457
463
|
const data = yield response.json();
|
|
458
464
|
return data;
|
|
459
465
|
});
|
|
@@ -842,67 +848,65 @@ const TIME_UPDATE = 'timeupdate';
|
|
|
842
848
|
*/
|
|
843
849
|
const WAITING = 'waiting';
|
|
844
850
|
|
|
851
|
+
/** @import Player from 'video.js/dist/types/player' */
|
|
852
|
+
|
|
845
853
|
/* eslint max-lines-per-function: ["error", 200] */
|
|
846
854
|
/* eslint max-statements: ["error", 20]*/
|
|
847
855
|
/* eslint complexity: ["error", 10]*/
|
|
856
|
+
|
|
848
857
|
/**
|
|
849
|
-
* SRG analytics
|
|
850
|
-
* @class SRGAnalytics
|
|
851
|
-
* @ignore
|
|
858
|
+
* The SRG analytics class tracks media playback according to the standard defined by SRG SSR.
|
|
852
859
|
*
|
|
853
|
-
*
|
|
854
|
-
* JS script : https://colibri-js.akamaized.net/penguin/tc_SRGGD_11.js
|
|
860
|
+
* @class SRGAnalytics
|
|
855
861
|
*
|
|
856
862
|
* ### Official documentation
|
|
857
|
-
* Variables list
|
|
858
|
-
* @see https://confluence.srg.beecollaboration.com/display/INTFORSCHUNG/Datalayer+for+media+players
|
|
859
863
|
*
|
|
860
|
-
*
|
|
861
|
-
* @
|
|
864
|
+
* - [New variable list]{@link https://srgssr-ch.atlassian.net/wiki/spaces/INTFORSCHUNG/pages/1009353309/Labels+check+for+migration+of+integration+layer+in+SAM}
|
|
865
|
+
* - [Variables list]{@link https://srgssr-ch.atlassian.net/wiki/spaces/INTFORSCHUNG/pages/795904478/Datalayer+for+media+players}
|
|
866
|
+
* - [Standard event sequences]{@link https://srgssr-ch.atlassian.net/wiki/spaces/INTFORSCHUNG/pages/795904171/standard+streaming+events+sequence+of+events+for+media+player+actions}
|
|
867
|
+
* - [Review of Standard Media Actions]{@link https://srgssr-ch.atlassian.net/wiki/spaces/INTFORSCHUNG/pages/795902249/Implementation+Concept+-+draft}
|
|
868
|
+
* - [ComScore Implementation Guide]{@link https://www.dropbox.com/sh/cdwuikq0abxi21m/AABmSyXYKUTWSAwRZgQA9Ujna/JavaScript%20Latest%20Version?dl=0&preview=Comscore_Library-JavaScript-Streaming_Tag-Implementation_Guide-International.pdf&subfolder_nav_tracking=1}
|
|
862
869
|
*
|
|
863
|
-
*
|
|
864
|
-
* @see https://confluence.srg.beecollaboration.com/display/INTFORSCHUNG/Implementation+Concept+-+draft
|
|
870
|
+
* ### Script URL
|
|
865
871
|
*
|
|
866
|
-
*
|
|
867
|
-
* @see https://www.dropbox.com/sh/cdwuikq0abxi21m/AABmSyXYKUTWSAwRZgQA9Ujna/JavaScript%20Latest%20Version?dl=0&preview=Comscore_Library-JavaScript-Streaming_Tag-Implementation_Guide-International.pdf&subfolder_nav_tracking=1
|
|
872
|
+
* JS script : https://colibri-js.akamaized.net/penguin/tc_SRGGD_11.js
|
|
868
873
|
*
|
|
869
874
|
* ### Variables list
|
|
870
|
-
* - 'event_id', // init | play | stop | pos | pause | seek | uptime | eof
|
|
871
|
-
* - 'event_timestamp', // Seems to be generated automatically from the documentation, but the TP overrides it
|
|
872
|
-
* - 'event_name', // NA TP seems to not sending this variable
|
|
873
|
-
* - 'event_source', // NA TP seems to not sending this variable
|
|
874
|
-
* - 'event_name', // NA TP seems to not sending this variable
|
|
875
|
-
* - 'event_value', // NA TP seems to not sending this variable
|
|
876
|
-
* - 'navigation_environment', // prod | preprod
|
|
877
|
-
* - 'media_subtitles_on', // string true | false
|
|
878
|
-
* - 'media_timeshift', // need better description
|
|
879
|
-
* - 'media_quality', // SD | HD ?
|
|
880
|
-
* - 'media_bandwidth', // NA for the web, 64000
|
|
881
|
-
* - 'media_volume', // from 0 to 100
|
|
882
|
-
* - 'media_embedding_url', //
|
|
883
|
-
* - 'media_player_name', // videojs | letterbox-web ?
|
|
884
|
-
* - 'media_chromecast_selected', // boolean true | false
|
|
885
|
-
* - 'media_player_version', // player's version
|
|
886
|
-
* - 'media_player_display', // is the player mode, on the TP : inline, embed etc..
|
|
887
|
-
* - 'media_audio_track', // NA
|
|
888
|
-
* - 'media_position_real', // NA
|
|
889
|
-
* - 'media_time_spent', // NA
|
|
890
|
-
* - 'device_id', // NA
|
|
891
|
-
* - 'user_id_log_in', // NA only RTS has log in today
|
|
892
|
-
* - 'media_thumbnail', // Not required by the spec but sended by the TP
|
|
893
|
-
* - 'media_bu_distributer', // Not required by the spec but sended by the TP
|
|
894
875
|
*
|
|
876
|
+
* - event_id: init | play | stop | pos | pause | seek | uptime | eof
|
|
877
|
+
* - event_timestamp: Seems to be generated automatically from the documentation, but the TP overrides it
|
|
878
|
+
* - event_name: NA TP seems to not sending this variable
|
|
879
|
+
* - event_source: NA TP seems to not sending this variable
|
|
880
|
+
* - event_name: NA TP seems to not sending this variable
|
|
881
|
+
* - event_value: NA TP seems to not sending this variable
|
|
882
|
+
* - navigation_environment: prod | preprod
|
|
883
|
+
* - media_subtitles_on: string true | false
|
|
884
|
+
* - media_timeshift: need better description
|
|
885
|
+
* - media_quality: SD | HD ?
|
|
886
|
+
* - media_bandwidth: NA for the web, 64000
|
|
887
|
+
* - media_volume: from 0 to 100
|
|
888
|
+
* - media_embedding_url:
|
|
889
|
+
* - media_player_name: videojs | letterbox-web ?
|
|
890
|
+
* - media_chromecast_selected: boolean true | false
|
|
891
|
+
* - media_player_version: player's version
|
|
892
|
+
* - media_player_display: is the player mode, on the TP : inline, embed etc..
|
|
893
|
+
* - media_audio_track: NA
|
|
894
|
+
* - media_position_real: NA
|
|
895
|
+
* - media_time_spent: NA
|
|
896
|
+
* - device_id: NA
|
|
897
|
+
* - user_id_log_in: NA only RTS has log in today
|
|
898
|
+
* - media_thumbnail: Not required by the spec but sended by the TP
|
|
899
|
+
* - media_bu_distributer: Not required by the spec but sended by the TP
|
|
895
900
|
*
|
|
896
901
|
* ### Sequence stories
|
|
897
902
|
*
|
|
898
|
-
*
|
|
903
|
+
* #### Story 1 (AoD/VOD-basics): A VoD is played. The user does not interact with the player. The VoD plays to its end.
|
|
899
904
|
*
|
|
900
905
|
* Hints:
|
|
901
906
|
* - Media sessions always start with PLAY. They end with STOP or EOF (or with PAUSE or last POS)
|
|
902
907
|
* - POS is sent ever 30s
|
|
903
908
|
*
|
|
904
|
-
*
|
|
905
|
-
* __Story 2 (livestream-basics A)__: A Livestream is played. The user does not interact with the player. After 61 seconds, playback is paused.
|
|
909
|
+
* #### Story 2 (livestream-basics A): A Livestream is played. The user does not interact with the player. After 61 seconds, playback is paused.
|
|
906
910
|
*
|
|
907
911
|
* Hints:
|
|
908
912
|
* - Media sessions always start with PLAY. They end with STOP (or, worse for data quailty, with PAUSE or last POS/UPTIME)
|
|
@@ -910,14 +914,12 @@ const WAITING = 'waiting';
|
|
|
910
914
|
* - POS is sent ever 30s, UPTIME every 60s with inital UPTIME after 30s.
|
|
911
915
|
* - This is the interval: 30s: POS + UPTIME; 60s: POS; 90s: POS + UPTIME; ...
|
|
912
916
|
*
|
|
913
|
-
*
|
|
914
|
-
* __Story 3 (Seeking a VoD/AoD)__: A VoD is played. User seeks in the VoD/AoD.
|
|
917
|
+
* #### Story 3 (Seeking a VoD/AoD): A VoD is played. User seeks in the VoD/AoD.
|
|
915
918
|
*
|
|
916
919
|
* Hints:
|
|
917
920
|
* - Once the Media Player slider is released (seek is over), another action to finish up the seeking is initiated. Typically this is PLAY. For that second PLAY, the media position has altered.
|
|
918
921
|
*
|
|
919
|
-
*
|
|
920
|
-
* __Story 4 (Seeking a livestream)__: A Livestream is played. User goes back in the livestream.
|
|
922
|
+
* #### Story 4 (Seeking a livestream): A Livestream is played. User goes back in the livestream.
|
|
921
923
|
*
|
|
922
924
|
* Hints:
|
|
923
925
|
* - Once the Media Player slider is released (seek is over), another action to finish up the seeking is initiated. Typically this is PLAY. For that second PLAY, the a new variable, media_timeshift is passed.
|
|
@@ -926,6 +928,17 @@ const WAITING = 'waiting';
|
|
|
926
928
|
* 2. The value of media_position is '1'.
|
|
927
929
|
*/
|
|
928
930
|
class SRGAnalytics {
|
|
931
|
+
/**
|
|
932
|
+
* Creates an instance of SRGAnalytics.
|
|
933
|
+
*
|
|
934
|
+
* @constructor
|
|
935
|
+
* @param {Player} player The player instance
|
|
936
|
+
* @param {SRGAnalyticsOptions} [options={}] Configuration options
|
|
937
|
+
* @param {boolean} [options.debug=false] Enables debug mode if set to true
|
|
938
|
+
* @param {string} [options.environment='prod'] The environment in which the data is sent
|
|
939
|
+
* @param {string} [options.playerVersion='none'] The version of the player
|
|
940
|
+
* @param {string} [options.tagCommanderScriptURL='//colibri-js.akamaized.net/penguin/tc_SRGGD_11.js'] The URL for the Tag Commander script
|
|
941
|
+
*/
|
|
929
942
|
constructor(player, {
|
|
930
943
|
debug = false,
|
|
931
944
|
environment = 'prod',
|
|
@@ -1653,6 +1666,8 @@ class SRGAnalytics {
|
|
|
1653
1666
|
}
|
|
1654
1667
|
}
|
|
1655
1668
|
|
|
1669
|
+
/** @import Player from 'video.js/dist/types/player' */
|
|
1670
|
+
|
|
1656
1671
|
/* eslint max-statements: ["error", 25]*/
|
|
1657
1672
|
|
|
1658
1673
|
/**
|
|
@@ -1671,6 +1686,19 @@ class SRGAnalytics {
|
|
|
1671
1686
|
* @see https://github.com/SRGSSR/pillarbox-documentation/blob/main/Specifications/monitoring.md
|
|
1672
1687
|
*/
|
|
1673
1688
|
class PillarboxMonitoring {
|
|
1689
|
+
/**
|
|
1690
|
+
* Creates an instance of PillarboxMonitoring.
|
|
1691
|
+
*
|
|
1692
|
+
* @constructor
|
|
1693
|
+
* @param {Player} player The player instance to be monitored
|
|
1694
|
+
* @param {PillarboxMonitoringOptions} [options={}] Configuration options for the monitoring
|
|
1695
|
+
* @param {string} [options.playerName='none'] The name of the player
|
|
1696
|
+
* @param {string} [options.playerVersion='none'] The version of the player
|
|
1697
|
+
* @param {string} [options.platform='Web'] The platform on which the player is running
|
|
1698
|
+
* @param {number} [options.schemaVersion=1] The version of the schema used for monitoring
|
|
1699
|
+
* @param {number} [options.heartbeatInterval=30000] The interval in milliseconds for sending heartbeat signals
|
|
1700
|
+
* @param {string} [options.beaconUrl='https://monitoring.pillarbox.ch/api/events'] The URL for the monitoring beacon
|
|
1701
|
+
*/
|
|
1674
1702
|
constructor(player, {
|
|
1675
1703
|
playerName = 'none',
|
|
1676
1704
|
playerVersion = 'none',
|
|
@@ -2493,6 +2521,19 @@ class PillarboxMonitoring {
|
|
|
2493
2521
|
}
|
|
2494
2522
|
}
|
|
2495
2523
|
|
|
2524
|
+
/**
|
|
2525
|
+
* @typedef {import('./typedef').Channel} Channel
|
|
2526
|
+
* @typedef {import('./typedef').Chapter} Chapter
|
|
2527
|
+
* @typedef {import('./typedef').Episode} Episode
|
|
2528
|
+
* @typedef {import('./typedef').Resource} Resource
|
|
2529
|
+
* @typedef {import('./typedef').Segment} Segment
|
|
2530
|
+
* @typedef {import('./typedef').Show} Show
|
|
2531
|
+
* @typedef {import('./typedef').Subtitle} Subtitle
|
|
2532
|
+
* @typedef {import('./typedef').TimeInterval} TimeInterval
|
|
2533
|
+
* @typedef {import('./typedef').Topic} Topic
|
|
2534
|
+
* @typedef {import('./typedef').MainResource} MainResource
|
|
2535
|
+
*/
|
|
2536
|
+
|
|
2496
2537
|
/**
|
|
2497
2538
|
* Represents the composition of media content.
|
|
2498
2539
|
*
|
|
@@ -2781,19 +2822,6 @@ class MediaComposition {
|
|
|
2781
2822
|
}
|
|
2782
2823
|
}
|
|
2783
2824
|
|
|
2784
|
-
/**
|
|
2785
|
-
* @typedef {import('./typedef').Channel} Channel
|
|
2786
|
-
* @typedef {import('./typedef').Chapter} Chapter
|
|
2787
|
-
* @typedef {import('./typedef').Episode} Episode
|
|
2788
|
-
* @typedef {import('./typedef').Resource} Resource
|
|
2789
|
-
* @typedef {import('./typedef').Segment} Segment
|
|
2790
|
-
* @typedef {import('./typedef').Show} Show
|
|
2791
|
-
* @typedef {import('./typedef').Subtitle} Subtitle
|
|
2792
|
-
* @typedef {import('./typedef').TimeInterval} TimeInterval
|
|
2793
|
-
* @typedef {import('./typedef').Topic} Topic
|
|
2794
|
-
* @typedef {import('./typedef').MainResource} MainResource
|
|
2795
|
-
*/
|
|
2796
|
-
|
|
2797
2825
|
const Play$4 = "Wiedergabe";
|
|
2798
2826
|
const Pause$4 = "Pause";
|
|
2799
2827
|
const Replay$4 = "Erneut abspielen";
|
|
@@ -3562,6 +3590,10 @@ pillarbox.addLanguage('rm', _objectSpread2({}, pillarboxLang));
|
|
|
3562
3590
|
const _excluded = ["url", "mimeType", "keySystems"],
|
|
3563
3591
|
_excluded2 = ["src"];
|
|
3564
3592
|
|
|
3593
|
+
/** @import Player from 'video.js/dist/types/player' */
|
|
3594
|
+
/** @import {Chapter, MainResource, Segment, Subtitle, TimeInterval} from '../dataProvider/model/typedef' */
|
|
3595
|
+
/** @import {ComposedSrcMediaData, MainResourceWithKeySystems} from './typedef' */
|
|
3596
|
+
|
|
3565
3597
|
/**
|
|
3566
3598
|
* @class SrgSsr
|
|
3567
3599
|
*/
|
|
@@ -3569,8 +3601,8 @@ class SrgSsr {
|
|
|
3569
3601
|
/**
|
|
3570
3602
|
* Adds blocked segments to the player.
|
|
3571
3603
|
*
|
|
3572
|
-
* @param {
|
|
3573
|
-
* @param {Array<
|
|
3604
|
+
* @param {Player} player
|
|
3605
|
+
* @param {Array<Segment>} [segments=[]]
|
|
3574
3606
|
*/
|
|
3575
3607
|
static addBlockedSegments(player, segments = []) {
|
|
3576
3608
|
const trackId = 'srgssr-blocked-segments';
|
|
@@ -3592,8 +3624,8 @@ class SrgSsr {
|
|
|
3592
3624
|
/**
|
|
3593
3625
|
* Adds remote text tracks from an array of subtitles.
|
|
3594
3626
|
*
|
|
3595
|
-
* @param {
|
|
3596
|
-
* @param {Array<
|
|
3627
|
+
* @param {Player} player
|
|
3628
|
+
* @param {Array<Subtitle>} [subtitles=[]]
|
|
3597
3629
|
*/
|
|
3598
3630
|
static addRemoteTextTracks(player, subtitles = []) {
|
|
3599
3631
|
if (!Array.isArray(subtitles)) return;
|
|
@@ -3617,9 +3649,9 @@ class SrgSsr {
|
|
|
3617
3649
|
*
|
|
3618
3650
|
* @param {TextTrack} textTrack
|
|
3619
3651
|
* @param {
|
|
3620
|
-
*
|
|
3621
|
-
*
|
|
3622
|
-
*
|
|
3652
|
+
* Segment |
|
|
3653
|
+
* Chapter |
|
|
3654
|
+
* TimeInterval
|
|
3623
3655
|
* } data SRG SSR's cue-like representation
|
|
3624
3656
|
*/
|
|
3625
3657
|
static addTextTrackCue(textTrack, data) {
|
|
@@ -3631,8 +3663,8 @@ class SrgSsr {
|
|
|
3631
3663
|
/**
|
|
3632
3664
|
* Add multiple text tracks to the player.
|
|
3633
3665
|
*
|
|
3634
|
-
* @param {
|
|
3635
|
-
* @param {
|
|
3666
|
+
* @param {Player} player
|
|
3667
|
+
* @param {ComposedSrcMediaData} srcMediaObj
|
|
3636
3668
|
*/
|
|
3637
3669
|
static addTextTracks(player, {
|
|
3638
3670
|
mediaData
|
|
@@ -3646,9 +3678,9 @@ class SrgSsr {
|
|
|
3646
3678
|
/**
|
|
3647
3679
|
* Adds chapters to the player.
|
|
3648
3680
|
*
|
|
3649
|
-
* @param {
|
|
3681
|
+
* @param {Player} player
|
|
3650
3682
|
* @param {string} chapterUrn The URN of the main chapter.
|
|
3651
|
-
* @param {Array.<
|
|
3683
|
+
* @param {Array.<Chapter>} [chapters=[]]
|
|
3652
3684
|
*/
|
|
3653
3685
|
static addChapters(player, chapterUrn, chapters = []) {
|
|
3654
3686
|
const trackId = 'srgssr-chapters';
|
|
@@ -3669,8 +3701,8 @@ class SrgSsr {
|
|
|
3669
3701
|
/**
|
|
3670
3702
|
* Adds intervals to the player.
|
|
3671
3703
|
*
|
|
3672
|
-
* @param {
|
|
3673
|
-
* @param {Array.<
|
|
3704
|
+
* @param {Player} player
|
|
3705
|
+
* @param {Array.<TimeInterval>} [intervals=[]]
|
|
3674
3706
|
*/
|
|
3675
3707
|
static addIntervals(player, intervals = []) {
|
|
3676
3708
|
const trackId = 'srgssr-intervals';
|
|
@@ -3691,8 +3723,8 @@ class SrgSsr {
|
|
|
3691
3723
|
* Set a blocking reason according to the block reason returned
|
|
3692
3724
|
* by mediaData.
|
|
3693
3725
|
*
|
|
3694
|
-
* @param {
|
|
3695
|
-
* @param {
|
|
3726
|
+
* @param {Player} player
|
|
3727
|
+
* @param {ComposedSrcMediaData} srcMediaObj
|
|
3696
3728
|
*
|
|
3697
3729
|
* @returns {undefined|Boolean}
|
|
3698
3730
|
*/
|
|
@@ -3715,9 +3747,9 @@ class SrgSsr {
|
|
|
3715
3747
|
* if at least one of them has tokenType
|
|
3716
3748
|
* set to Akamai.
|
|
3717
3749
|
*
|
|
3718
|
-
* @param {Array.<
|
|
3750
|
+
* @param {Array.<MainResourceWithKeySystems>} resources
|
|
3719
3751
|
*
|
|
3720
|
-
* @returns {Promise<Array.<
|
|
3752
|
+
* @returns {Promise<Array.<MainResourceWithKeySystems>>}
|
|
3721
3753
|
*/
|
|
3722
3754
|
static composeAkamaiResources(resources = []) {
|
|
3723
3755
|
return _asyncToGenerator(function* () {
|
|
@@ -3734,9 +3766,9 @@ class SrgSsr {
|
|
|
3734
3766
|
* Add the keySystems property to all resources
|
|
3735
3767
|
* if at least one of them has DRM.
|
|
3736
3768
|
*
|
|
3737
|
-
* @param {Array.<
|
|
3769
|
+
* @param {Array.<MainResource>} resources
|
|
3738
3770
|
*
|
|
3739
|
-
* @returns {Array.<
|
|
3771
|
+
* @returns {Array.<MainResourceWithKeySystems>}
|
|
3740
3772
|
*/
|
|
3741
3773
|
static composeKeySystemsResources(resources = []) {
|
|
3742
3774
|
if (!Drm.hasDrm(resources)) return resources;
|
|
@@ -3750,7 +3782,7 @@ class SrgSsr {
|
|
|
3750
3782
|
*
|
|
3751
3783
|
* @param {MediaComposition} mediaComposition
|
|
3752
3784
|
*
|
|
3753
|
-
* @returns {Promise<Array.<
|
|
3785
|
+
* @returns {Promise<Array.<MainResourceWithKeySystems>>}
|
|
3754
3786
|
*/
|
|
3755
3787
|
static composeMainResources(mediaComposition) {
|
|
3756
3788
|
return SrgSsr.composeAkamaiResources(SrgSsr.composeKeySystemsResources(SrgSsr.filterIncompatibleResources(mediaComposition.getMainResources())));
|
|
@@ -3763,9 +3795,9 @@ class SrgSsr {
|
|
|
3763
3795
|
* @param {any} srcObj
|
|
3764
3796
|
* @param {any} srcObj.mediaData overrides or adds metadata to the composed mediaData.
|
|
3765
3797
|
* @param {boolean} srcObj.disableTrackers
|
|
3766
|
-
* @param {
|
|
3798
|
+
* @param {MainResourceWithKeySystems} resource
|
|
3767
3799
|
*
|
|
3768
|
-
* @returns {
|
|
3800
|
+
* @returns {ComposedSrcMediaData}
|
|
3769
3801
|
*/
|
|
3770
3802
|
static composeSrcMediaData({
|
|
3771
3803
|
mediaData: srcMediaData,
|
|
@@ -3790,7 +3822,7 @@ class SrgSsr {
|
|
|
3790
3822
|
/**
|
|
3791
3823
|
* Create a new metadata text track.
|
|
3792
3824
|
*
|
|
3793
|
-
* @param {
|
|
3825
|
+
* @param {Player} player
|
|
3794
3826
|
* @param {String} trackId Text track unique ID
|
|
3795
3827
|
*
|
|
3796
3828
|
* @returns {Promise<TextTrack>}
|
|
@@ -3812,7 +3844,7 @@ class SrgSsr {
|
|
|
3812
3844
|
/**
|
|
3813
3845
|
* Proxy SRG SSR chapters and intervals cuechange events at player level.
|
|
3814
3846
|
*
|
|
3815
|
-
* @param {
|
|
3847
|
+
* @param {Player} player
|
|
3816
3848
|
*/
|
|
3817
3849
|
static cuechangeEventProxy(player) {
|
|
3818
3850
|
player.textTracks().on('addtrack', ({
|
|
@@ -3833,7 +3865,7 @@ class SrgSsr {
|
|
|
3833
3865
|
/**
|
|
3834
3866
|
* SRG SSR data provider singleton.
|
|
3835
3867
|
*
|
|
3836
|
-
* @param {
|
|
3868
|
+
* @param {Player} player
|
|
3837
3869
|
*
|
|
3838
3870
|
* @returns {DataProvider}
|
|
3839
3871
|
*/
|
|
@@ -3857,7 +3889,7 @@ class SrgSsr {
|
|
|
3857
3889
|
/**
|
|
3858
3890
|
* Set an error if something goes wrong with the data provider.
|
|
3859
3891
|
*
|
|
3860
|
-
* @param {
|
|
3892
|
+
* @param {Player} player
|
|
3861
3893
|
* @param {Object} error
|
|
3862
3894
|
*
|
|
3863
3895
|
* @returns {undefined|true}
|
|
@@ -3882,7 +3914,7 @@ class SrgSsr {
|
|
|
3882
3914
|
/**
|
|
3883
3915
|
* Set player error.
|
|
3884
3916
|
*
|
|
3885
|
-
* @param {
|
|
3917
|
+
* @param {Player} player
|
|
3886
3918
|
* @param {Object} error
|
|
3887
3919
|
*/
|
|
3888
3920
|
static error(player, {
|
|
@@ -3901,9 +3933,9 @@ class SrgSsr {
|
|
|
3901
3933
|
/**
|
|
3902
3934
|
* Filter out incompatible resources such as `RTMP` and `HDS`.
|
|
3903
3935
|
*
|
|
3904
|
-
* @param {Array.<
|
|
3936
|
+
* @param {Array.<MainResource>} resources Resources to filter
|
|
3905
3937
|
*
|
|
3906
|
-
* @returns {Array.<
|
|
3938
|
+
* @returns {Array.<MainResource>} The filtered resources
|
|
3907
3939
|
*/
|
|
3908
3940
|
static filterIncompatibleResources(resources = []) {
|
|
3909
3941
|
return resources.filter(resource => !['RTMP', 'HDS'].includes(resource.streaming));
|
|
@@ -3912,7 +3944,7 @@ class SrgSsr {
|
|
|
3912
3944
|
/**
|
|
3913
3945
|
* Get the current blocked segment from the player.
|
|
3914
3946
|
*
|
|
3915
|
-
* @param {
|
|
3947
|
+
* @param {Player} player
|
|
3916
3948
|
*
|
|
3917
3949
|
* @returns {VTTCue|undefined} The blocked segment cue object, or undefined
|
|
3918
3950
|
*/
|
|
@@ -3929,7 +3961,7 @@ class SrgSsr {
|
|
|
3929
3961
|
/**
|
|
3930
3962
|
* Get the VTT cue of a blocked segment.
|
|
3931
3963
|
*
|
|
3932
|
-
* @param {
|
|
3964
|
+
* @param {Player} player
|
|
3933
3965
|
* @param {Number} currentTime
|
|
3934
3966
|
*
|
|
3935
3967
|
* @returns {VTTCue|undefined} The VTT cue of a blocked segment, or undefined
|
|
@@ -3959,9 +3991,9 @@ class SrgSsr {
|
|
|
3959
3991
|
/**
|
|
3960
3992
|
* Get the mediaData most likely to be compatible depending on the browser.
|
|
3961
3993
|
*
|
|
3962
|
-
* @param {Array.<
|
|
3994
|
+
* @param {Array.<MainResourceWithKeySystems>} resources
|
|
3963
3995
|
*
|
|
3964
|
-
* @returns {
|
|
3996
|
+
* @returns {MainResourceWithKeySystems} By default, the first entry is used if none is compatible.
|
|
3965
3997
|
*/
|
|
3966
3998
|
static getMediaData(resources = []) {
|
|
3967
3999
|
if (AkamaiTokenService.hasToken(resources)) return resources[0];
|
|
@@ -3975,10 +4007,10 @@ class SrgSsr {
|
|
|
3975
4007
|
/**
|
|
3976
4008
|
* Get the source media object.
|
|
3977
4009
|
*
|
|
3978
|
-
* @param {
|
|
4010
|
+
* @param {Player} player
|
|
3979
4011
|
* @param {any} srcObj
|
|
3980
4012
|
*
|
|
3981
|
-
* @returns {Promise<
|
|
4013
|
+
* @returns {Promise<ComposedSrcMediaData>} - The composed source media data.
|
|
3982
4014
|
*/
|
|
3983
4015
|
static getSrcMediaObj(player, srcObj) {
|
|
3984
4016
|
return _asyncToGenerator(function* () {
|
|
@@ -4010,7 +4042,7 @@ class SrgSsr {
|
|
|
4010
4042
|
* _Note_: This function should disappear as soon as this behavior is
|
|
4011
4043
|
* supported on the packaging side.
|
|
4012
4044
|
*
|
|
4013
|
-
* @param {
|
|
4045
|
+
* @param {Player} player
|
|
4014
4046
|
* @param {number} currentTime
|
|
4015
4047
|
*
|
|
4016
4048
|
* @returns {number}
|
|
@@ -4042,7 +4074,7 @@ class SrgSsr {
|
|
|
4042
4074
|
* _Note_: This function should disappear as soon as this behavior is
|
|
4043
4075
|
* supported on the packaging side.
|
|
4044
4076
|
*
|
|
4045
|
-
* @param {
|
|
4077
|
+
* @param {Player} player
|
|
4046
4078
|
* @param {number} currentTime
|
|
4047
4079
|
*
|
|
4048
4080
|
* @returns {number}
|
|
@@ -4064,7 +4096,7 @@ class SrgSsr {
|
|
|
4064
4096
|
* - handle blocking reasons
|
|
4065
4097
|
* - add remote subtitles
|
|
4066
4098
|
*
|
|
4067
|
-
* @param {
|
|
4099
|
+
* @param {Player} player
|
|
4068
4100
|
* @param {any} srcObj
|
|
4069
4101
|
* @param {function} next
|
|
4070
4102
|
*
|
|
@@ -4090,7 +4122,7 @@ class SrgSsr {
|
|
|
4090
4122
|
/**
|
|
4091
4123
|
* SRG SSR analytics singleton.
|
|
4092
4124
|
*
|
|
4093
|
-
* @param {
|
|
4125
|
+
* @param {Player} player
|
|
4094
4126
|
*/
|
|
4095
4127
|
static srgAnalytics(player) {
|
|
4096
4128
|
if (player.options().trackers.srgAnalytics === false) return;
|
|
@@ -4111,7 +4143,7 @@ class SrgSsr {
|
|
|
4111
4143
|
/**
|
|
4112
4144
|
* PillarboxMonitoring monitoring singleton.
|
|
4113
4145
|
*
|
|
4114
|
-
* @param {
|
|
4146
|
+
* @param {Player} player
|
|
4115
4147
|
*
|
|
4116
4148
|
* @returns {PillarboxMonitoring} instance of PillarboxMonitoring
|
|
4117
4149
|
*/
|
|
@@ -4135,8 +4167,8 @@ class SrgSsr {
|
|
|
4135
4167
|
/**
|
|
4136
4168
|
* Update player's poster.
|
|
4137
4169
|
*
|
|
4138
|
-
* @param {
|
|
4139
|
-
* @param {
|
|
4170
|
+
* @param {Player} player
|
|
4171
|
+
* @param {ComposedSrcMediaData} srcMediaObj
|
|
4140
4172
|
* @param {Image} imageService
|
|
4141
4173
|
*/
|
|
4142
4174
|
static updatePoster(player, srcMediaObj, imageService = Image) {
|
|
@@ -4148,8 +4180,8 @@ class SrgSsr {
|
|
|
4148
4180
|
/**
|
|
4149
4181
|
* Update player titleBar with title and description.
|
|
4150
4182
|
*
|
|
4151
|
-
* @param {
|
|
4152
|
-
* @param {
|
|
4183
|
+
* @param {Player} player
|
|
4184
|
+
* @param {ComposedSrcMediaData} srcMediaObj
|
|
4153
4185
|
*/
|
|
4154
4186
|
static updateTitleBar(player, srcMediaObj) {
|
|
4155
4187
|
if (!player.titleBar) return;
|
|
@@ -4162,7 +4194,7 @@ class SrgSsr {
|
|
|
4162
4194
|
/**
|
|
4163
4195
|
* Middleware to resolve SRG SSR URNs into playable media.
|
|
4164
4196
|
*
|
|
4165
|
-
* @param {
|
|
4197
|
+
* @param {Player} player
|
|
4166
4198
|
*
|
|
4167
4199
|
* @returns {Object}
|
|
4168
4200
|
*/
|