@srgssr/pillarbox-web 1.17.0 → 1.19.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 +144 -111
- package/dist/pillarbox.cjs.js.map +1 -1
- package/dist/pillarbox.es.js +145 -112
- package/dist/pillarbox.es.js.map +1 -1
- package/dist/pillarbox.umd.js +144 -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.18.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
|
*
|
|
@@ -2691,6 +2732,7 @@ class MediaComposition {
|
|
|
2691
2732
|
imageCopyright: this.getMainChapter().imageCopyright,
|
|
2692
2733
|
intervals: this.getMainTimeIntervals(),
|
|
2693
2734
|
live: resource.live,
|
|
2735
|
+
mediaContainer: resource.mediaContainer,
|
|
2694
2736
|
mediaType: this.getMainChapter().mediaType,
|
|
2695
2737
|
mimeType: resource.mimeType,
|
|
2696
2738
|
presentation: resource.presentation,
|
|
@@ -2781,19 +2823,6 @@ class MediaComposition {
|
|
|
2781
2823
|
}
|
|
2782
2824
|
}
|
|
2783
2825
|
|
|
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
2826
|
const Play$4 = "Wiedergabe";
|
|
2798
2827
|
const Pause$4 = "Pause";
|
|
2799
2828
|
const Replay$4 = "Erneut abspielen";
|
|
@@ -3562,6 +3591,10 @@ pillarbox.addLanguage('rm', _objectSpread2({}, pillarboxLang));
|
|
|
3562
3591
|
const _excluded = ["url", "mimeType", "keySystems"],
|
|
3563
3592
|
_excluded2 = ["src"];
|
|
3564
3593
|
|
|
3594
|
+
/** @import Player from 'video.js/dist/types/player' */
|
|
3595
|
+
/** @import {Chapter, MainResource, Segment, Subtitle, TimeInterval} from '../dataProvider/model/typedef' */
|
|
3596
|
+
/** @import {ComposedSrcMediaData, MainResourceWithKeySystems} from './typedef' */
|
|
3597
|
+
|
|
3565
3598
|
/**
|
|
3566
3599
|
* @class SrgSsr
|
|
3567
3600
|
*/
|
|
@@ -3569,8 +3602,8 @@ class SrgSsr {
|
|
|
3569
3602
|
/**
|
|
3570
3603
|
* Adds blocked segments to the player.
|
|
3571
3604
|
*
|
|
3572
|
-
* @param {
|
|
3573
|
-
* @param {Array<
|
|
3605
|
+
* @param {Player} player
|
|
3606
|
+
* @param {Array<Segment>} [segments=[]]
|
|
3574
3607
|
*/
|
|
3575
3608
|
static addBlockedSegments(player, segments = []) {
|
|
3576
3609
|
const trackId = 'srgssr-blocked-segments';
|
|
@@ -3592,8 +3625,8 @@ class SrgSsr {
|
|
|
3592
3625
|
/**
|
|
3593
3626
|
* Adds remote text tracks from an array of subtitles.
|
|
3594
3627
|
*
|
|
3595
|
-
* @param {
|
|
3596
|
-
* @param {Array<
|
|
3628
|
+
* @param {Player} player
|
|
3629
|
+
* @param {Array<Subtitle>} [subtitles=[]]
|
|
3597
3630
|
*/
|
|
3598
3631
|
static addRemoteTextTracks(player, subtitles = []) {
|
|
3599
3632
|
if (!Array.isArray(subtitles)) return;
|
|
@@ -3617,9 +3650,9 @@ class SrgSsr {
|
|
|
3617
3650
|
*
|
|
3618
3651
|
* @param {TextTrack} textTrack
|
|
3619
3652
|
* @param {
|
|
3620
|
-
*
|
|
3621
|
-
*
|
|
3622
|
-
*
|
|
3653
|
+
* Segment |
|
|
3654
|
+
* Chapter |
|
|
3655
|
+
* TimeInterval
|
|
3623
3656
|
* } data SRG SSR's cue-like representation
|
|
3624
3657
|
*/
|
|
3625
3658
|
static addTextTrackCue(textTrack, data) {
|
|
@@ -3631,8 +3664,8 @@ class SrgSsr {
|
|
|
3631
3664
|
/**
|
|
3632
3665
|
* Add multiple text tracks to the player.
|
|
3633
3666
|
*
|
|
3634
|
-
* @param {
|
|
3635
|
-
* @param {
|
|
3667
|
+
* @param {Player} player
|
|
3668
|
+
* @param {ComposedSrcMediaData} srcMediaObj
|
|
3636
3669
|
*/
|
|
3637
3670
|
static addTextTracks(player, {
|
|
3638
3671
|
mediaData
|
|
@@ -3646,9 +3679,9 @@ class SrgSsr {
|
|
|
3646
3679
|
/**
|
|
3647
3680
|
* Adds chapters to the player.
|
|
3648
3681
|
*
|
|
3649
|
-
* @param {
|
|
3682
|
+
* @param {Player} player
|
|
3650
3683
|
* @param {string} chapterUrn The URN of the main chapter.
|
|
3651
|
-
* @param {Array.<
|
|
3684
|
+
* @param {Array.<Chapter>} [chapters=[]]
|
|
3652
3685
|
*/
|
|
3653
3686
|
static addChapters(player, chapterUrn, chapters = []) {
|
|
3654
3687
|
const trackId = 'srgssr-chapters';
|
|
@@ -3669,8 +3702,8 @@ class SrgSsr {
|
|
|
3669
3702
|
/**
|
|
3670
3703
|
* Adds intervals to the player.
|
|
3671
3704
|
*
|
|
3672
|
-
* @param {
|
|
3673
|
-
* @param {Array.<
|
|
3705
|
+
* @param {Player} player
|
|
3706
|
+
* @param {Array.<TimeInterval>} [intervals=[]]
|
|
3674
3707
|
*/
|
|
3675
3708
|
static addIntervals(player, intervals = []) {
|
|
3676
3709
|
const trackId = 'srgssr-intervals';
|
|
@@ -3691,8 +3724,8 @@ class SrgSsr {
|
|
|
3691
3724
|
* Set a blocking reason according to the block reason returned
|
|
3692
3725
|
* by mediaData.
|
|
3693
3726
|
*
|
|
3694
|
-
* @param {
|
|
3695
|
-
* @param {
|
|
3727
|
+
* @param {Player} player
|
|
3728
|
+
* @param {ComposedSrcMediaData} srcMediaObj
|
|
3696
3729
|
*
|
|
3697
3730
|
* @returns {undefined|Boolean}
|
|
3698
3731
|
*/
|
|
@@ -3715,9 +3748,9 @@ class SrgSsr {
|
|
|
3715
3748
|
* if at least one of them has tokenType
|
|
3716
3749
|
* set to Akamai.
|
|
3717
3750
|
*
|
|
3718
|
-
* @param {Array.<
|
|
3751
|
+
* @param {Array.<MainResourceWithKeySystems>} resources
|
|
3719
3752
|
*
|
|
3720
|
-
* @returns {Promise<Array.<
|
|
3753
|
+
* @returns {Promise<Array.<MainResourceWithKeySystems>>}
|
|
3721
3754
|
*/
|
|
3722
3755
|
static composeAkamaiResources(resources = []) {
|
|
3723
3756
|
return _asyncToGenerator(function* () {
|
|
@@ -3734,9 +3767,9 @@ class SrgSsr {
|
|
|
3734
3767
|
* Add the keySystems property to all resources
|
|
3735
3768
|
* if at least one of them has DRM.
|
|
3736
3769
|
*
|
|
3737
|
-
* @param {Array.<
|
|
3770
|
+
* @param {Array.<MainResource>} resources
|
|
3738
3771
|
*
|
|
3739
|
-
* @returns {Array.<
|
|
3772
|
+
* @returns {Array.<MainResourceWithKeySystems>}
|
|
3740
3773
|
*/
|
|
3741
3774
|
static composeKeySystemsResources(resources = []) {
|
|
3742
3775
|
if (!Drm.hasDrm(resources)) return resources;
|
|
@@ -3750,7 +3783,7 @@ class SrgSsr {
|
|
|
3750
3783
|
*
|
|
3751
3784
|
* @param {MediaComposition} mediaComposition
|
|
3752
3785
|
*
|
|
3753
|
-
* @returns {Promise<Array.<
|
|
3786
|
+
* @returns {Promise<Array.<MainResourceWithKeySystems>>}
|
|
3754
3787
|
*/
|
|
3755
3788
|
static composeMainResources(mediaComposition) {
|
|
3756
3789
|
return SrgSsr.composeAkamaiResources(SrgSsr.composeKeySystemsResources(SrgSsr.filterIncompatibleResources(mediaComposition.getMainResources())));
|
|
@@ -3763,9 +3796,9 @@ class SrgSsr {
|
|
|
3763
3796
|
* @param {any} srcObj
|
|
3764
3797
|
* @param {any} srcObj.mediaData overrides or adds metadata to the composed mediaData.
|
|
3765
3798
|
* @param {boolean} srcObj.disableTrackers
|
|
3766
|
-
* @param {
|
|
3799
|
+
* @param {MainResourceWithKeySystems} resource
|
|
3767
3800
|
*
|
|
3768
|
-
* @returns {
|
|
3801
|
+
* @returns {ComposedSrcMediaData}
|
|
3769
3802
|
*/
|
|
3770
3803
|
static composeSrcMediaData({
|
|
3771
3804
|
mediaData: srcMediaData,
|
|
@@ -3790,7 +3823,7 @@ class SrgSsr {
|
|
|
3790
3823
|
/**
|
|
3791
3824
|
* Create a new metadata text track.
|
|
3792
3825
|
*
|
|
3793
|
-
* @param {
|
|
3826
|
+
* @param {Player} player
|
|
3794
3827
|
* @param {String} trackId Text track unique ID
|
|
3795
3828
|
*
|
|
3796
3829
|
* @returns {Promise<TextTrack>}
|
|
@@ -3812,7 +3845,7 @@ class SrgSsr {
|
|
|
3812
3845
|
/**
|
|
3813
3846
|
* Proxy SRG SSR chapters and intervals cuechange events at player level.
|
|
3814
3847
|
*
|
|
3815
|
-
* @param {
|
|
3848
|
+
* @param {Player} player
|
|
3816
3849
|
*/
|
|
3817
3850
|
static cuechangeEventProxy(player) {
|
|
3818
3851
|
player.textTracks().on('addtrack', ({
|
|
@@ -3833,7 +3866,7 @@ class SrgSsr {
|
|
|
3833
3866
|
/**
|
|
3834
3867
|
* SRG SSR data provider singleton.
|
|
3835
3868
|
*
|
|
3836
|
-
* @param {
|
|
3869
|
+
* @param {Player} player
|
|
3837
3870
|
*
|
|
3838
3871
|
* @returns {DataProvider}
|
|
3839
3872
|
*/
|
|
@@ -3857,7 +3890,7 @@ class SrgSsr {
|
|
|
3857
3890
|
/**
|
|
3858
3891
|
* Set an error if something goes wrong with the data provider.
|
|
3859
3892
|
*
|
|
3860
|
-
* @param {
|
|
3893
|
+
* @param {Player} player
|
|
3861
3894
|
* @param {Object} error
|
|
3862
3895
|
*
|
|
3863
3896
|
* @returns {undefined|true}
|
|
@@ -3882,7 +3915,7 @@ class SrgSsr {
|
|
|
3882
3915
|
/**
|
|
3883
3916
|
* Set player error.
|
|
3884
3917
|
*
|
|
3885
|
-
* @param {
|
|
3918
|
+
* @param {Player} player
|
|
3886
3919
|
* @param {Object} error
|
|
3887
3920
|
*/
|
|
3888
3921
|
static error(player, {
|
|
@@ -3901,9 +3934,9 @@ class SrgSsr {
|
|
|
3901
3934
|
/**
|
|
3902
3935
|
* Filter out incompatible resources such as `RTMP` and `HDS`.
|
|
3903
3936
|
*
|
|
3904
|
-
* @param {Array.<
|
|
3937
|
+
* @param {Array.<MainResource>} resources Resources to filter
|
|
3905
3938
|
*
|
|
3906
|
-
* @returns {Array.<
|
|
3939
|
+
* @returns {Array.<MainResource>} The filtered resources
|
|
3907
3940
|
*/
|
|
3908
3941
|
static filterIncompatibleResources(resources = []) {
|
|
3909
3942
|
return resources.filter(resource => !['RTMP', 'HDS'].includes(resource.streaming));
|
|
@@ -3912,7 +3945,7 @@ class SrgSsr {
|
|
|
3912
3945
|
/**
|
|
3913
3946
|
* Get the current blocked segment from the player.
|
|
3914
3947
|
*
|
|
3915
|
-
* @param {
|
|
3948
|
+
* @param {Player} player
|
|
3916
3949
|
*
|
|
3917
3950
|
* @returns {VTTCue|undefined} The blocked segment cue object, or undefined
|
|
3918
3951
|
*/
|
|
@@ -3929,7 +3962,7 @@ class SrgSsr {
|
|
|
3929
3962
|
/**
|
|
3930
3963
|
* Get the VTT cue of a blocked segment.
|
|
3931
3964
|
*
|
|
3932
|
-
* @param {
|
|
3965
|
+
* @param {Player} player
|
|
3933
3966
|
* @param {Number} currentTime
|
|
3934
3967
|
*
|
|
3935
3968
|
* @returns {VTTCue|undefined} The VTT cue of a blocked segment, or undefined
|
|
@@ -3959,9 +3992,9 @@ class SrgSsr {
|
|
|
3959
3992
|
/**
|
|
3960
3993
|
* Get the mediaData most likely to be compatible depending on the browser.
|
|
3961
3994
|
*
|
|
3962
|
-
* @param {Array.<
|
|
3995
|
+
* @param {Array.<MainResourceWithKeySystems>} resources
|
|
3963
3996
|
*
|
|
3964
|
-
* @returns {
|
|
3997
|
+
* @returns {MainResourceWithKeySystems} By default, the first entry is used if none is compatible.
|
|
3965
3998
|
*/
|
|
3966
3999
|
static getMediaData(resources = []) {
|
|
3967
4000
|
if (AkamaiTokenService.hasToken(resources)) return resources[0];
|
|
@@ -3975,10 +4008,10 @@ class SrgSsr {
|
|
|
3975
4008
|
/**
|
|
3976
4009
|
* Get the source media object.
|
|
3977
4010
|
*
|
|
3978
|
-
* @param {
|
|
4011
|
+
* @param {Player} player
|
|
3979
4012
|
* @param {any} srcObj
|
|
3980
4013
|
*
|
|
3981
|
-
* @returns {Promise<
|
|
4014
|
+
* @returns {Promise<ComposedSrcMediaData>} - The composed source media data.
|
|
3982
4015
|
*/
|
|
3983
4016
|
static getSrcMediaObj(player, srcObj) {
|
|
3984
4017
|
return _asyncToGenerator(function* () {
|
|
@@ -4010,7 +4043,7 @@ class SrgSsr {
|
|
|
4010
4043
|
* _Note_: This function should disappear as soon as this behavior is
|
|
4011
4044
|
* supported on the packaging side.
|
|
4012
4045
|
*
|
|
4013
|
-
* @param {
|
|
4046
|
+
* @param {Player} player
|
|
4014
4047
|
* @param {number} currentTime
|
|
4015
4048
|
*
|
|
4016
4049
|
* @returns {number}
|
|
@@ -4042,7 +4075,7 @@ class SrgSsr {
|
|
|
4042
4075
|
* _Note_: This function should disappear as soon as this behavior is
|
|
4043
4076
|
* supported on the packaging side.
|
|
4044
4077
|
*
|
|
4045
|
-
* @param {
|
|
4078
|
+
* @param {Player} player
|
|
4046
4079
|
* @param {number} currentTime
|
|
4047
4080
|
*
|
|
4048
4081
|
* @returns {number}
|
|
@@ -4064,7 +4097,7 @@ class SrgSsr {
|
|
|
4064
4097
|
* - handle blocking reasons
|
|
4065
4098
|
* - add remote subtitles
|
|
4066
4099
|
*
|
|
4067
|
-
* @param {
|
|
4100
|
+
* @param {Player} player
|
|
4068
4101
|
* @param {any} srcObj
|
|
4069
4102
|
* @param {function} next
|
|
4070
4103
|
*
|
|
@@ -4090,7 +4123,7 @@ class SrgSsr {
|
|
|
4090
4123
|
/**
|
|
4091
4124
|
* SRG SSR analytics singleton.
|
|
4092
4125
|
*
|
|
4093
|
-
* @param {
|
|
4126
|
+
* @param {Player} player
|
|
4094
4127
|
*/
|
|
4095
4128
|
static srgAnalytics(player) {
|
|
4096
4129
|
if (player.options().trackers.srgAnalytics === false) return;
|
|
@@ -4111,7 +4144,7 @@ class SrgSsr {
|
|
|
4111
4144
|
/**
|
|
4112
4145
|
* PillarboxMonitoring monitoring singleton.
|
|
4113
4146
|
*
|
|
4114
|
-
* @param {
|
|
4147
|
+
* @param {Player} player
|
|
4115
4148
|
*
|
|
4116
4149
|
* @returns {PillarboxMonitoring} instance of PillarboxMonitoring
|
|
4117
4150
|
*/
|
|
@@ -4135,8 +4168,8 @@ class SrgSsr {
|
|
|
4135
4168
|
/**
|
|
4136
4169
|
* Update player's poster.
|
|
4137
4170
|
*
|
|
4138
|
-
* @param {
|
|
4139
|
-
* @param {
|
|
4171
|
+
* @param {Player} player
|
|
4172
|
+
* @param {ComposedSrcMediaData} srcMediaObj
|
|
4140
4173
|
* @param {Image} imageService
|
|
4141
4174
|
*/
|
|
4142
4175
|
static updatePoster(player, srcMediaObj, imageService = Image) {
|
|
@@ -4148,8 +4181,8 @@ class SrgSsr {
|
|
|
4148
4181
|
/**
|
|
4149
4182
|
* Update player titleBar with title and description.
|
|
4150
4183
|
*
|
|
4151
|
-
* @param {
|
|
4152
|
-
* @param {
|
|
4184
|
+
* @param {Player} player
|
|
4185
|
+
* @param {ComposedSrcMediaData} srcMediaObj
|
|
4153
4186
|
*/
|
|
4154
4187
|
static updateTitleBar(player, srcMediaObj) {
|
|
4155
4188
|
if (!player.titleBar) return;
|
|
@@ -4162,7 +4195,7 @@ class SrgSsr {
|
|
|
4162
4195
|
/**
|
|
4163
4196
|
* Middleware to resolve SRG SSR URNs into playable media.
|
|
4164
4197
|
*
|
|
4165
|
-
* @param {
|
|
4198
|
+
* @param {Player} player
|
|
4166
4199
|
*
|
|
4167
4200
|
* @returns {Object}
|
|
4168
4201
|
*/
|