@flowplayer/player 3.16.0-rc → 3.16.0-rc.2

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.
Files changed (58) hide show
  1. package/core/events.d.ts +2 -8
  2. package/core/events.js +1 -4
  3. package/core.js +1 -1
  4. package/default.js +1 -1
  5. package/embed.js +2 -2
  6. package/flowplayer.css +1 -1
  7. package/index.d.ts +29 -40
  8. package/package.json +1 -1
  9. package/plugins/ads.d.ts +29 -40
  10. package/plugins/ads.js +1 -1
  11. package/plugins/airplay.d.ts +29 -40
  12. package/plugins/analytics.d.ts +29 -40
  13. package/plugins/analytics.js +1 -1
  14. package/plugins/asel.d.ts +29 -40
  15. package/plugins/audio.d.ts +29 -40
  16. package/plugins/chapters.d.ts +29 -40
  17. package/plugins/chromecast.d.ts +29 -40
  18. package/plugins/comscore.d.ts +29 -40
  19. package/plugins/consent.d.ts +78 -41
  20. package/plugins/consent.js +1 -1
  21. package/plugins/context-menu.d.ts +29 -40
  22. package/plugins/cuepoints.d.ts +29 -40
  23. package/plugins/dash.d.ts +29 -40
  24. package/plugins/drm.d.ts +29 -40
  25. package/plugins/endscreen.d.ts +29 -40
  26. package/plugins/fas.d.ts +29 -40
  27. package/plugins/float-on-scroll.d.ts +29 -40
  28. package/plugins/ga4.d.ts +29 -40
  29. package/plugins/gemius.d.ts +29 -40
  30. package/plugins/google-analytics.d.ts +29 -40
  31. package/plugins/health.d.ts +37 -41
  32. package/plugins/health.js +1 -1
  33. package/plugins/hls.d.ts +29 -40
  34. package/plugins/hls.js +1 -1
  35. package/plugins/id3.d.ts +96 -41
  36. package/plugins/iframe.d.ts +29 -40
  37. package/plugins/keyboard.d.ts +29 -40
  38. package/plugins/media-session.d.ts +29 -40
  39. package/plugins/message.d.ts +29 -40
  40. package/plugins/ovp.d.ts +29 -40
  41. package/plugins/playlist.d.ts +29 -71
  42. package/plugins/playlist.js +1 -1
  43. package/plugins/preview.d.ts +29 -40
  44. package/plugins/qsel.d.ts +102 -38
  45. package/plugins/qsel.js +1 -1
  46. package/plugins/qul.d.ts +29 -40
  47. package/plugins/rts.d.ts +29 -40
  48. package/plugins/share.d.ts +29 -40
  49. package/plugins/speed.d.ts +29 -40
  50. package/plugins/ssai.d.ts +29 -40
  51. package/plugins/ssai.js +1 -1
  52. package/plugins/subtitles.d.ts +29 -40
  53. package/plugins/thumbnails.d.ts +29 -40
  54. package/plugins/tizen.d.ts +29 -40
  55. package/plugins/vtsel.d.ts +122 -33
  56. package/plugins/vtsel.js +1 -1
  57. package/plugins/webos.d.ts +29 -40
  58. package/util/loader.d.ts +27 -40
@@ -762,6 +762,8 @@ declare const NO_CONTROLS = "no-controls";
762
762
 
763
763
  declare const NO_DVR = "no-timeline";
764
764
 
765
+ declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
766
+
765
767
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
766
768
 
767
769
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -902,7 +904,6 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
902
904
  disabled: boolean;
903
905
  /* Excluded from this release type: started */
904
906
  /* Excluded from this release type: token */
905
- tracks?: VideoTrack[];
906
907
  /* Excluded from this release type: _customElements */
907
908
  /* Excluded from this release type: _storage */
908
909
  };
@@ -986,6 +987,7 @@ declare type PlayerCustomEventsOverloads = {
986
987
  */
987
988
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
988
989
  /* Excluded from this release type: on */
990
+ /* Excluded from this release type: on */
989
991
  /**
990
992
  * Listen to this event to create a recommendations grid using the data passed with the event.
991
993
  */
@@ -1004,6 +1006,11 @@ declare type PlayerCustomEventsOverloads = {
1004
1006
  /* Excluded from this release type: on */
1005
1007
  /* Excluded from this release type: on */
1006
1008
  /* Excluded from this release type: on */
1009
+ /* Excluded from this release type: on */
1010
+ /**
1011
+ * TODO: this is a workaround, since not all event overloads are typed. when all plugin work is finished, remove this
1012
+ * https://wowzamedia.jira.com/browse/PLAY-653
1013
+ */
1007
1014
  on<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1008
1015
  /* Excluded from this release type: on */
1009
1016
  /**
@@ -1028,9 +1035,12 @@ declare type PlayerCustomEventsOverloads = {
1028
1035
  */
1029
1036
  off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1030
1037
  /* Excluded from this release type: poll */
1038
+ emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1039
+ emit(event: never, data?: never): Player;
1040
+ /* Excluded from this release type: emit */
1041
+ /* Excluded from this release type: emit */
1031
1042
  /* Excluded from this release type: emit */
1032
1043
  /* Excluded from this release type: emit */
1033
- emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1034
1044
  /* Excluded from this release type: emit */
1035
1045
  };
1036
1046
 
@@ -1138,6 +1148,17 @@ declare const /**
1138
1148
  */
1139
1149
  PROGRESS = "progress";
1140
1150
 
1151
+ /**
1152
+ * @public
1153
+ */
1154
+ declare type QselOption = {
1155
+ height: number;
1156
+ level: number;
1157
+ text: string;
1158
+ /* Excluded from this release type: videoCodec */
1159
+ width: number;
1160
+ };
1161
+
1141
1162
  /**
1142
1163
  * @public
1143
1164
  * emitted whenever a list of qualities has been made available
@@ -1156,27 +1177,11 @@ QUALITIES = "qualities";
1156
1177
  /**
1157
1178
  * @public
1158
1179
  */
1159
- declare type QualitiesEventDetail = QualityDetail[];
1180
+ declare type QualitiesEventDetail = QselOption[];
1160
1181
 
1161
- /**
1162
- * @public
1163
- */
1164
- declare type QualityDetail = {
1165
- level: number;
1166
- text: string;
1167
- width: number;
1168
- height: number;
1169
- videoCodec: string;
1170
- } | BitrateInfo | {
1171
- text: string | number;
1172
- encodingId: string;
1173
- spatialLayerId: number;
1174
- temporalLayerId: number;
1175
- maxSpatialLayerId: number;
1176
- maxTemporalLayerId: number;
1177
- height: number;
1178
- width: number;
1179
- };
1182
+ /* Excluded from this release type: _QualitiesEventDetail */
1183
+
1184
+ /* Excluded from this release type: _QualityDetail */
1180
1185
 
1181
1186
  declare enum QualityOpts {
1182
1187
  LOW = 1,
@@ -1348,20 +1353,14 @@ SEEKING_2 = "seeking";
1348
1353
 
1349
1354
  /**
1350
1355
  * @public
1351
- * allows plugins to listen for forced quality changes
1352
- * it should emit the index of the quality to set
1353
- * -1 is a special idx saying to use ABR if the plugin
1354
- * exposes an ABR implementation
1356
+ * @deprecated please use Qsel.events.SET_QUALITY
1355
1357
  */
1356
1358
  declare const /**
1357
1359
  @public
1358
1360
  * when a new player is inserted into the HTML
1359
1361
  */ /**
1360
1362
  * @public
1361
- * allows plugins to listen for forced quality changes
1362
- * it should emit the index of the quality to set
1363
- * -1 is a special idx saying to use ABR if the plugin
1364
- * exposes an ABR implementation
1363
+ * @deprecated please use Qsel.events.SET_QUALITY
1365
1364
  */
1366
1365
  SET_QUALITY = "quality:set";
1367
1366
 
@@ -1558,16 +1557,6 @@ declare const /**
1558
1557
  */
1559
1558
  VIDEO_TRACKS = "videoTracks";
1560
1559
 
1561
- /**
1562
- * @public
1563
- */
1564
- declare interface VideoTrack {
1565
- name: string;
1566
- /* Excluded from this release type: data */
1567
- default: boolean;
1568
- selected: boolean;
1569
- }
1570
-
1571
1560
  /**
1572
1561
  * @public
1573
1562
  * when a player enters the viewpoint
@@ -762,6 +762,8 @@ declare const NO_CONTROLS = "no-controls";
762
762
 
763
763
  declare const NO_DVR = "no-timeline";
764
764
 
765
+ declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
766
+
765
767
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
766
768
 
767
769
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -902,7 +904,6 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
902
904
  disabled: boolean;
903
905
  /* Excluded from this release type: started */
904
906
  /* Excluded from this release type: token */
905
- tracks?: VideoTrack[];
906
907
  /* Excluded from this release type: _customElements */
907
908
  /* Excluded from this release type: _storage */
908
909
  };
@@ -986,6 +987,7 @@ declare type PlayerCustomEventsOverloads = {
986
987
  */
987
988
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
988
989
  /* Excluded from this release type: on */
990
+ /* Excluded from this release type: on */
989
991
  /**
990
992
  * Listen to this event to create a recommendations grid using the data passed with the event.
991
993
  */
@@ -1004,6 +1006,11 @@ declare type PlayerCustomEventsOverloads = {
1004
1006
  /* Excluded from this release type: on */
1005
1007
  /* Excluded from this release type: on */
1006
1008
  /* Excluded from this release type: on */
1009
+ /* Excluded from this release type: on */
1010
+ /**
1011
+ * TODO: this is a workaround, since not all event overloads are typed. when all plugin work is finished, remove this
1012
+ * https://wowzamedia.jira.com/browse/PLAY-653
1013
+ */
1007
1014
  on<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1008
1015
  /* Excluded from this release type: on */
1009
1016
  /**
@@ -1028,9 +1035,12 @@ declare type PlayerCustomEventsOverloads = {
1028
1035
  */
1029
1036
  off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1030
1037
  /* Excluded from this release type: poll */
1038
+ emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1039
+ emit(event: never, data?: never): Player;
1040
+ /* Excluded from this release type: emit */
1041
+ /* Excluded from this release type: emit */
1031
1042
  /* Excluded from this release type: emit */
1032
1043
  /* Excluded from this release type: emit */
1033
- emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1034
1044
  /* Excluded from this release type: emit */
1035
1045
  };
1036
1046
 
@@ -1138,6 +1148,17 @@ declare const /**
1138
1148
  */
1139
1149
  PROGRESS = "progress";
1140
1150
 
1151
+ /**
1152
+ * @public
1153
+ */
1154
+ declare type QselOption = {
1155
+ height: number;
1156
+ level: number;
1157
+ text: string;
1158
+ /* Excluded from this release type: videoCodec */
1159
+ width: number;
1160
+ };
1161
+
1141
1162
  /**
1142
1163
  * @public
1143
1164
  * emitted whenever a list of qualities has been made available
@@ -1156,27 +1177,11 @@ QUALITIES = "qualities";
1156
1177
  /**
1157
1178
  * @public
1158
1179
  */
1159
- declare type QualitiesEventDetail = QualityDetail[];
1180
+ declare type QualitiesEventDetail = QselOption[];
1160
1181
 
1161
- /**
1162
- * @public
1163
- */
1164
- declare type QualityDetail = {
1165
- level: number;
1166
- text: string;
1167
- width: number;
1168
- height: number;
1169
- videoCodec: string;
1170
- } | BitrateInfo | {
1171
- text: string | number;
1172
- encodingId: string;
1173
- spatialLayerId: number;
1174
- temporalLayerId: number;
1175
- maxSpatialLayerId: number;
1176
- maxTemporalLayerId: number;
1177
- height: number;
1178
- width: number;
1179
- };
1182
+ /* Excluded from this release type: _QualitiesEventDetail */
1183
+
1184
+ /* Excluded from this release type: _QualityDetail */
1180
1185
 
1181
1186
  declare enum QualityOpts {
1182
1187
  LOW = 1,
@@ -1348,20 +1353,14 @@ SEEKING_2 = "seeking";
1348
1353
 
1349
1354
  /**
1350
1355
  * @public
1351
- * allows plugins to listen for forced quality changes
1352
- * it should emit the index of the quality to set
1353
- * -1 is a special idx saying to use ABR if the plugin
1354
- * exposes an ABR implementation
1356
+ * @deprecated please use Qsel.events.SET_QUALITY
1355
1357
  */
1356
1358
  declare const /**
1357
1359
  @public
1358
1360
  * when a new player is inserted into the HTML
1359
1361
  */ /**
1360
1362
  * @public
1361
- * allows plugins to listen for forced quality changes
1362
- * it should emit the index of the quality to set
1363
- * -1 is a special idx saying to use ABR if the plugin
1364
- * exposes an ABR implementation
1363
+ * @deprecated please use Qsel.events.SET_QUALITY
1365
1364
  */
1366
1365
  SET_QUALITY = "quality:set";
1367
1366
 
@@ -1566,16 +1565,6 @@ declare const /**
1566
1565
  */
1567
1566
  VIDEO_TRACKS = "videoTracks";
1568
1567
 
1569
- /**
1570
- * @public
1571
- */
1572
- declare interface VideoTrack {
1573
- name: string;
1574
- /* Excluded from this release type: data */
1575
- default: boolean;
1576
- selected: boolean;
1577
- }
1578
-
1579
1568
  /**
1580
1569
  * @public
1581
1570
  * when a player enters the viewpoint
package/plugins/ssai.d.ts CHANGED
@@ -780,6 +780,8 @@ declare const NO_CONTROLS = "no-controls";
780
780
 
781
781
  declare const NO_DVR = "no-timeline";
782
782
 
783
+ declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
784
+
783
785
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
784
786
 
785
787
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -920,7 +922,6 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
920
922
  disabled: boolean;
921
923
  /* Excluded from this release type: started */
922
924
  /* Excluded from this release type: token */
923
- tracks?: VideoTrack[];
924
925
  /* Excluded from this release type: _customElements */
925
926
  /* Excluded from this release type: _storage */
926
927
  };
@@ -1004,6 +1005,7 @@ declare type PlayerCustomEventsOverloads = {
1004
1005
  */
1005
1006
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
1006
1007
  /* Excluded from this release type: on */
1008
+ /* Excluded from this release type: on */
1007
1009
  /**
1008
1010
  * Listen to this event to create a recommendations grid using the data passed with the event.
1009
1011
  */
@@ -1022,6 +1024,11 @@ declare type PlayerCustomEventsOverloads = {
1022
1024
  /* Excluded from this release type: on */
1023
1025
  /* Excluded from this release type: on */
1024
1026
  /* Excluded from this release type: on */
1027
+ /* Excluded from this release type: on */
1028
+ /**
1029
+ * TODO: this is a workaround, since not all event overloads are typed. when all plugin work is finished, remove this
1030
+ * https://wowzamedia.jira.com/browse/PLAY-653
1031
+ */
1025
1032
  on<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1026
1033
  /* Excluded from this release type: on */
1027
1034
  /**
@@ -1046,9 +1053,12 @@ declare type PlayerCustomEventsOverloads = {
1046
1053
  */
1047
1054
  off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1048
1055
  /* Excluded from this release type: poll */
1056
+ emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1057
+ emit(event: never, data?: never): Player;
1058
+ /* Excluded from this release type: emit */
1059
+ /* Excluded from this release type: emit */
1049
1060
  /* Excluded from this release type: emit */
1050
1061
  /* Excluded from this release type: emit */
1051
- emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1052
1062
  /* Excluded from this release type: emit */
1053
1063
  };
1054
1064
 
@@ -1158,6 +1168,17 @@ PROGRESS = "progress";
1158
1168
 
1159
1169
  /* Excluded from this release type: Provider */
1160
1170
 
1171
+ /**
1172
+ * @public
1173
+ */
1174
+ declare type QselOption = {
1175
+ height: number;
1176
+ level: number;
1177
+ text: string;
1178
+ /* Excluded from this release type: videoCodec */
1179
+ width: number;
1180
+ };
1181
+
1161
1182
  /**
1162
1183
  * @public
1163
1184
  * emitted whenever a list of qualities has been made available
@@ -1176,27 +1197,11 @@ QUALITIES = "qualities";
1176
1197
  /**
1177
1198
  * @public
1178
1199
  */
1179
- declare type QualitiesEventDetail = QualityDetail[];
1200
+ declare type QualitiesEventDetail = QselOption[];
1180
1201
 
1181
- /**
1182
- * @public
1183
- */
1184
- declare type QualityDetail = {
1185
- level: number;
1186
- text: string;
1187
- width: number;
1188
- height: number;
1189
- videoCodec: string;
1190
- } | BitrateInfo | {
1191
- text: string | number;
1192
- encodingId: string;
1193
- spatialLayerId: number;
1194
- temporalLayerId: number;
1195
- maxSpatialLayerId: number;
1196
- maxTemporalLayerId: number;
1197
- height: number;
1198
- width: number;
1199
- };
1202
+ /* Excluded from this release type: _QualitiesEventDetail */
1203
+
1204
+ /* Excluded from this release type: _QualityDetail */
1200
1205
 
1201
1206
  declare enum QualityOpts {
1202
1207
  LOW = 1,
@@ -1368,20 +1373,14 @@ SEEKING_2 = "seeking";
1368
1373
 
1369
1374
  /**
1370
1375
  * @public
1371
- * allows plugins to listen for forced quality changes
1372
- * it should emit the index of the quality to set
1373
- * -1 is a special idx saying to use ABR if the plugin
1374
- * exposes an ABR implementation
1376
+ * @deprecated please use Qsel.events.SET_QUALITY
1375
1377
  */
1376
1378
  declare const /**
1377
1379
  @public
1378
1380
  * when a new player is inserted into the HTML
1379
1381
  */ /**
1380
1382
  * @public
1381
- * allows plugins to listen for forced quality changes
1382
- * it should emit the index of the quality to set
1383
- * -1 is a special idx saying to use ABR if the plugin
1384
- * exposes an ABR implementation
1383
+ * @deprecated please use Qsel.events.SET_QUALITY
1385
1384
  */
1386
1385
  SET_QUALITY = "quality:set";
1387
1386
 
@@ -1587,16 +1586,6 @@ declare const /**
1587
1586
  */
1588
1587
  VIDEO_TRACKS = "videoTracks";
1589
1588
 
1590
- /**
1591
- * @public
1592
- */
1593
- declare interface VideoTrack {
1594
- name: string;
1595
- /* Excluded from this release type: data */
1596
- default: boolean;
1597
- selected: boolean;
1598
- }
1599
-
1600
1589
  /**
1601
1590
  * @public
1602
1591
  * when a player enters the viewpoint
package/plugins/ssai.js CHANGED
@@ -4,4 +4,4 @@
4
4
  * https://github.com/lancedikson/bowser
5
5
  * MIT License | (c) Dustin Diaz 2012-2015
6
6
  * MIT License | (c) Denis Demchenko 2015-2019
7
- */const S=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return u}static get ENGINE_MAP(){return g}static get OS_MAP(){return m}static get PLATFORMS_MAP(){return p}}.parse(window.navigator.userAgent),{platform:w,os:_,browser:M}=S,A=e=>e&&e.toLowerCase();var E={rnd:Math.random().toString(36).substr(2,32),os:A(_.name+(_.versionName?" "+_.versionName:"")),device:A(w.type),browser:A(M.name),browser_version:(M&&M.version?M.version:"unknown").split(".").shift(),plugin_version:"3.16.0-rc"};const U="https://fp-eu-w1-aai.flowplayer.com/in",k="POST",T=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],R=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],P=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],O=d("ads/analytics"),F=RequestQueue.of(),q=(...e)=>Object.assign({},...e);class Analytics{constructor(e,t={}){this.emitter=e,this.metadata=q(E,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),O(this),this.wireup()}static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,q(e.metadata,t,{player_version:"3.16.0-rc"})),e}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,r=q(this.metadata,{event_type:e},s),i=Analytics.pluck_valid_keys(this,r),n=Analytics.ensure_required_keys(this,i);if(O(`Event[${e}]`,{payload:i,observation:s}),n.length)return O(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${n}`,i);RequestQueue.rpush(F,[U,k,i])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}var B;function C(e,t){var s;switch(t){case B.Preroll:return 0;case B.Postroll:return-1;default:return null===(s=e.ssai)||void 0===s?void 0:s.provider.getContentCurrentTime(e)}}function D(e,t,s){var r,i,n,a;const o=null===(r=t.ssai)||void 0===r?void 0:r.provider.getAdType(),d=null===(a=null===(n=null===(i=t.ssai)||void 0===i?void 0:i.provider)||void 0===n?void 0:n.src)||void 0===a?void 0:a.analyticsId,c={ad_break_time:C(t,o),ad_muted:t.muted,event_type:e};o&&Object.assign(c,{ad_type:o}),d&&Object.assign(c,{ad_tag_id:d}),s&&"duration"in s&&Object.assign(c,{ad_remaining_seconds:s.duration-s.currentTime,ad_duration_seconds:s.duration}),s&&"getAdId"in s&&Object.assign(c,{vast_ad_id:s.getAdId()}),t.emit("health:record",{event:"ads/"+e,detail:c}),t.emit(e,Object.assign(c,{data:s}))}function N(e,t){var s;e.setState("ssai-ad-active",!0);const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress={currentTime:0,duration:t},L(e,r))}function I(e,t){var s;const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress=t,L(e,r))}function x(e){if(!e.ssai)return;const t=e.ssai.state;e.setState("ssai-ad-active",!1),delete t.adProgress,void 0!==t.rate&&(e.playbackRate=t.rate,delete t.rate),"number"==typeof t.snapbackTime&&(r(e,t.snapbackTime),delete t.snapbackTime)}function L(e,t){const s=e.playbackRate;1!==s&&(t.rate=s,e.playbackRate=1)}!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(B||(B={}));const Q=navigator.languages||[navigator.language];function j(e){const t=e.ssai.ui,s=new google.ima.dai.api.UiSettings,r=e.opt("lang")||function(){try{return Q.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().find(e=>!e.includes("-"))||"en";s.setLocale(r);const i=new google.ima.dai.api.StreamManager(e,t,s);return i.addEventListener([google.ima.dai.api.StreamEvent.Type.LOADED,google.ima.dai.api.StreamEvent.Type.ERROR,google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED,google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED,google.ima.dai.api.StreamEvent.Type.AD_PROGRESS,google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED,google.ima.dai.api.StreamEvent.Type.RESUMED,google.ima.dai.api.StreamEvent.Type.PAUSED,google.ima.dai.api.StreamEvent.Type.STARTED,google.ima.dai.api.StreamEvent.Type.COMPLETE,google.ima.dai.api.StreamEvent.Type.SKIPPED,google.ima.dai.api.StreamEvent.Type.CLICK],t=>{!function(e,t,s){switch(s.type){case google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED:return async function(e,t){var s,r;const i=t.getStreamData().streamId,n=e.ssai.provider;if(!i||!n.isPod)return;if(!n.isVod){const t=null===(s=n.src)||void 0===s?void 0:s.streamUrl;return t?(n.daiStream=n.buildPodStreamURL(t,i),e.setSrc(n.daiStream)):console.error("streamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#create_a_simple_video_player_2")}const a=null===(r=n.src)||void 0===r?void 0:r.requestStreamUrl;if(!a)return console.error("requestStreamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#vod-pod-serving_1");try{n.daiStream=await a(e.ssai.streamManager,i),e.ssai.streamManager.loadStreamMetadata(),e.setSrc(n.daiStream)}catch(t){z(e)}}(e,s);case google.ima.dai.api.StreamEvent.Type.RESUMED:return D("ad-resumed",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.PAUSED:return D("ad-paused",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.COMPLETE:return D("ad-completed",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.SKIPPED:return D("ad-skipped",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.LOADED:return function(e,t){const s=t.getStreamData().url,r=e.ssai.provider;if(!s||r.isPod&&!r.isVod)return;r.daiStream=s,e.setSrc(s)}(e,s);case google.ima.dai.api.StreamEvent.Type.STARTED:return e.ssai.provider.currentAd=s.getAd(),D("ad-started",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED:return N(e),D("ad-break-started",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED:return D(a,e,V(e,s)),x(e),e.ssai.provider.currentAd=void 0;case google.ima.dai.api.StreamEvent.Type.ERROR:return z(e,s);case google.ima.dai.api.StreamEvent.Type.AD_PROGRESS:{const t=V(e,s);return I(e,t.stream_data.adProgressData),D("ad-progress",e,t)}case google.ima.dai.api.StreamEvent.Type.CLICK:(function(e,t){if(!e.paused)e.togglePlay(!1)})(e)}}(e,0,t)},!1),e.on("ID3",({data:e})=>{const t=null==e?void 0:e.cue;if(!t)return;const s={},r=t.value;s[r.key]=r.data,i.onTimedMetadata(s)}),e.on("ssai:hls:metadata",e=>{var t;null===(t=e.detail)||void 0===t||t.samples.forEach(e=>i.processMetadata("ID3",e.data,e.pts))}),e.on("ssai:dash:metadata",e=>{const t=e.detail;if(!t)return;const s=t.event.messageData,r=t.event.calculatedPresentationTime;i.processMetadata("urn:google:dai:2018",s,r)}),i}function V(e,t){return{stream_data:t.getStreamData(),ad:e.ssai.provider.currentAd}}function z(e,t){var s,r;const i=e.ssai.provider;if(null===(s=i.src)||void 0===s?void 0:s.backupStream)return e.setSrc(i.src.backupStream);e.emit("error",{message:(null===(r=null==t?void 0:t.getStreamData())||void 0===r?void 0:r.errorMessage)||"error loading stream"})}const W=d("ads/ima/sdk");var G;async function H(e,t){var s;const r=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(t?null==r?void 0:r.dai:r)return void W(":noop");const i=t?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":e._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(e){return new Promise((t,s)=>{let r=document.querySelector(`script[src='${e}']`);if(r)return K(r,t,s);r=document.createElement("script"),r.setAttribute("state",G.LOADING),K(r,t,s),r.src=e,document.head.appendChild(r)})}(i),void W(":loaded")}catch(e){W(":error "+e.message,e)}}function K(e,t,s){const r=e.getAttribute("state");if(r&&[G.ERROR,G.LOADED].includes(r))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",G.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",G.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(G||(G={}));const $=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends $.AnalyticEventObserver{constructor(e){super(),this.video=e}onAdvertBreakStart(e){const t=e.getDuration();if(!e.isActive()&&t){const e=s(this.video);r(this.video,e+t/1e3)}N(this.video,e.getStart()),D("ad-break-started",this.video)}onAdvertBreakEnd(){x(this.video),D(a,this.video)}onAdvertStart(e){}onAdvertEnd(){}onTrackingEvent(e){}}function Z(e,t){YospaceAdManagement.SessionVOD.create(e,t.ssai.properties,e=>{const r=e.getPayload();if(r.getSessionResult()===YospaceAdManagement.SessionResult.INITIALISED){t.ssai.session=r;const e=new EventObserver(t);r.addAnalyticObserver(e),t.setSrc({src:r.getPlaybackUrl()}),setInterval(()=>{const e=1e3*s(t);r.onPlayheadUpdate(e),function(e,t,s){const r=e.getCurrentAdBreak();if(!r)return;const i={currentTime:s-r.getStart(),duration:r.getDuration()};I(t,i),D("ad-progress",t,{stream_data:i})}(r,t,e)},250)}else console.warn("YoSpace Failed to initialise session. ResultCode = "+r.getResultCode())})}var X=Object.freeze({__proto__:null,exists:function(){return!!window.YospaceAdManagement},init:function(e,t){t.ssai&&(!function(e){Object.defineProperty(e,"currentTime",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.currentTime:e.ssai.provider.getContentCurrentTime(e)}return s(e)},set:function(t){var s;if(e.ssai){if(e.ssai.state.adProgress)return;return null===(s=e.ssai.provider)||void 0===s?void 0:s.setContentCurrentTime(e,t)}}}),Object.defineProperty(e,"duration",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.duration:e.ssai.provider.getContentDuration(e)}return n(e)},set:function(){}})}(t),Object.assign(t.ssai,function(){const e=new YospaceAdManagement.SessionProperties;return e.setUserAgent(navigator.userAgent),{properties:e}}()))},srcIsValid:function(e){return"yospace"==e.type},onload:function(e,t){t&&t.src&&Z(t.src,e)},getContentCurrentTime:function(e){const t=s(e),r=e.ssai.session;return r?r.getContentPositionForPlayhead(1e3*t)/1e3:t},setContentCurrentTime:function(e,t){const s=e.ssai.session;return r(e,s?s.getPlayheadForContentPosition(1e3*t)/1e3:t)},onNewSrc:function(e){},getContentDuration:function(e){const t=e.ssai.session,s=n(e);return t?t.getContentPositionForPlayhead(t.getDuration())/1e3:s},getAdType:function(){},getPreviousActiveAdStart:function(e,t){const s=e.ssai.session;if(!s)return;const r=s.getAdBreaks();let i;const n=1e3*t;return r.forEach(e=>{void 0===i&&e.getStart()<n&&e.isActive()&&(i=e)}),void 0!==i?i.getStart()/1e3:void 0}});const Y=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?r:i})(e._customElements,t))(e),J=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class SSAIAdUi extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-ui",this.append(...this.player.createComponents("flowplayer-ssai-indicator","flowplayer-ssai-timeline","flowplayer-ssai-controls"))}}class SSAITimeline extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-timeline";const t=document.createElement("div");t.className="fp-ssai-progress",this.append(t),this.player.on(a,()=>{t.classList.remove("go"),"--ssai-percent-complete --ssai-percent-previous".split(" ").forEach(e=>this.style.setProperty(e,"0"))}),this.player.on("ad-progress",e=>{var s,r,i;const n=null===(i=null===(r=null===(s=e.detail)||void 0===s?void 0:s.data)||void 0===r?void 0:r.stream_data)||void 0===i?void 0:i.adProgressData;if(!n)return;const a=n.currentTime/n.duration*100,o=t.style.getPropertyValue("--ssai-percent-complete");t.classList.remove("go"),t.style.setProperty("--ssai-percent-previous",o),t.style.setProperty("--ssai-percent-complete",a.toFixed(3)),t.classList.add("go")})}}function ee(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}class SSAIControls extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-controls",this.createLeftZone(),this.createRightZone()}createRightZone(){const e=document.createElement("div");e.className="fp-ssai-right-zone",e.append(...this.player.createComponents("flowplayer-volume-control"),...this.fsIcons()),this.append(e)}createLeftZone(){const e=document.createElement("div");e.className="fp-ssai-left-zone",e.append(...this.player.createComponents("flowplayer-control-buttons"),this.remainingTimeComponent()),this.append(e)}fsIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(e=>(e.onclick=()=>this.player.toggleFullScreen(),e))}remainingTimeComponent(){const e=document.createElement("div");return e.className="fp-ssai-remaining",this.player.on("ad-progress",t=>{var s,r;const i=null===(r=null===(s=t.detail.data)||void 0===s?void 0:s.stream_data)||void 0===r?void 0:r.adProgressData;i&&(e.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let r=Math.floor(e/60);return e-=60*r,s>=1?(r-=60*s,t+s+":"+ee(r)+":"+ee(e)):t+ee(r)+":"+ee(e)}(i.duration-i.currentTime))}),e}}class SSAIAdIndicator extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-indicator",this.player.on("ad-started",e=>{var t,s,r;const i=null===(r=null===(s=null===(t=e.detail)||void 0===t?void 0:t.data)||void 0===s?void 0:s.ad)||void 0===r?void 0:r.getAdPodInfo();i&&(this.textContent=`${this.player.i18n("ads.indicator","ADS")} ${i.getAdPosition()} / ${i.getTotalAds()}`)})}}var te;const se=[X,new class Dai{async init(e,t){var s,r;if(t.ssai)return this.make_analytics(t),await H(t,!0),(null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai)?void 0:console.warn("google.ima.dai unavailable")}async onload(e,t){var s,r,i;if(await H(e,!0),null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai){if((null===(i=e.ssai)||void 0===i?void 0:i.streamManager)||(e.ssai.streamManager=j(e)),this.src=t,this.isPod=!!t.customAssetKey||!!t.requestStreamUrl,this.isVod=!!t.contentSourceId||!!t.videoId||!!t.requestStreamUrl,this.isPod)return this.requestPodStream(e.ssai.streamManager,t);this.requestStream(e.ssai.streamManager,t)}else t.backupStream&&e.setSrc(t.backupStream)}onNewSrc(e,t){var s;t.src!==this.daiStream&&(null===(s=e.ssai.streamManager)||void 0===s||s.reset())}make_analytics(e){const t=Analytics.of(e,{required_keys:R,events:T,optional_keys:P});e.on("config",()=>{var s;return Analytics.mergeMetadata(t,null===(s=e.opts)||void 0===s?void 0:s.metadata)})}exists(){return!0}getAdType(){if(this.currentAd)switch(this.currentAd.getAdPodInfo().getPodIndex()){case 0:return B.Preroll;case-1:return B.Postroll;case-2:return;default:return B.Midroll}}getContentCurrentTime(e){const t=e.ssai.streamManager,s=e.currentTime;return t?t.contentTimeForStreamTime(s):s}setContentCurrentTime(e,t){}getContentDuration(e){const t=e.ssai.streamManager,s=e.duration;return t?t.contentTimeForStreamTime(s):s}getPreviousActiveAdStart(e,t){var s,r;const i=null===(r=null===(s=e.ssai)||void 0===s?void 0:s.streamManager)||void 0===r?void 0:r.previousCuePointForStreamTime(t);if(i&&!i.played)return i.start}srcIsValid(e){return"google/dai"==e.type}requestStream(e,t){const s=this.isVod?new google.ima.dai.api.VODStreamRequest:new google.ima.dai.api.LiveStreamRequest;e.requestStream(Object.assign(s,t))}requestPodStream(e,t){const s=this.isVod?new google.ima.dai.api.PodVodStreamRequest:new google.ima.dai.api.PodStreamRequest;e.requestStream(Object.assign(s,t))}buildPodStreamURL(e,t){return e.replace("[[STREAMID]]",t)}}],re=((te=class Ssai{constructor(e){this.umd=e,J(e,"flowplayer-ssai-ui",SSAIAdUi),J(e,"flowplayer-ssai-timeline",SSAITimeline),J(e,"flowplayer-ssai-controls",SSAIControls),J(e,"flowplayer-ssai-indicator",SSAIAdIndicator)}init(e,t,i){se.forEach(e=>{if(i.ssai||!e.exists())return;const n=Y(i,"flowplayer-ssai-ui");t.append(n),i.ssai={provider:e,ui:n,state:{snapback:!1}},e.init(t,i),i.on("seeked",()=>function(e){if(e.opt("live"))return;if(!e.ssai)return;const{provider:t,state:i}=e.ssai;if(i.snapback)return i.snapback=!1;const n=s(e),a=t.getPreviousActiveAdStart(e,n);void 0!==a&&(i.snapback=!0,i.snapbackTime=n,r(e,a))}(i)),i.on("src",t=>{i.setState("ssai-ad-active",!1),i.ssai&&(i.ssai.state={snapback:!1},e.onNewSrc(i,t.detail))})})}onload(e,t,s,r){var i;(null===(i=s.ssai)||void 0===i?void 0:i.provider)&&s.ssai.provider.onload(s,r)}wants(e,t,s){let r=!1;return se.forEach(e=>{if(!r&&e.exists()&&e.srcIsValid(t))return r=!0}),r}}).events=o,te);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const s=e.flowplayer;return"function"==typeof s?(s(t),t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t),t)}(window,re)}));
7
+ */const S=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return u}static get ENGINE_MAP(){return g}static get OS_MAP(){return m}static get PLATFORMS_MAP(){return p}}.parse(window.navigator.userAgent),{platform:w,os:_,browser:M}=S,A=e=>e&&e.toLowerCase();var E={rnd:Math.random().toString(36).substr(2,32),os:A(_.name+(_.versionName?" "+_.versionName:"")),device:A(w.type),browser:A(M.name),browser_version:(M&&M.version?M.version:"unknown").split(".").shift(),plugin_version:"3.16.0-rc.2"};const U="https://fp-eu-w1-aai.flowplayer.com/in",k="POST",T=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],R=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],P=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],O=d("ads/analytics"),F=RequestQueue.of(),q=(...e)=>Object.assign({},...e);class Analytics{constructor(e,t={}){this.emitter=e,this.metadata=q(E,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),O(this),this.wireup()}static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,q(e.metadata,t,{player_version:"3.16.0-rc.2"})),e}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,r=q(this.metadata,{event_type:e},s),i=Analytics.pluck_valid_keys(this,r),n=Analytics.ensure_required_keys(this,i);if(O(`Event[${e}]`,{payload:i,observation:s}),n.length)return O(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${n}`,i);RequestQueue.rpush(F,[U,k,i])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}var B;function C(e,t){var s;switch(t){case B.Preroll:return 0;case B.Postroll:return-1;default:return null===(s=e.ssai)||void 0===s?void 0:s.provider.getContentCurrentTime(e)}}function D(e,t,s){var r,i,n,a;const o=null===(r=t.ssai)||void 0===r?void 0:r.provider.getAdType(),d=null===(a=null===(n=null===(i=t.ssai)||void 0===i?void 0:i.provider)||void 0===n?void 0:n.src)||void 0===a?void 0:a.analyticsId,c={ad_break_time:C(t,o),ad_muted:t.muted,event_type:e};o&&Object.assign(c,{ad_type:o}),d&&Object.assign(c,{ad_tag_id:d}),s&&"duration"in s&&Object.assign(c,{ad_remaining_seconds:s.duration-s.currentTime,ad_duration_seconds:s.duration}),s&&"getAdId"in s&&Object.assign(c,{vast_ad_id:s.getAdId()}),t.emit("health:record",{event:"ads/"+e,detail:c}),t.emit(e,Object.assign(c,{data:s}))}function N(e,t){var s;e.setState("ssai-ad-active",!0);const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress={currentTime:0,duration:t},L(e,r))}function I(e,t){var s;const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress=t,L(e,r))}function x(e){if(!e.ssai)return;const t=e.ssai.state;e.setState("ssai-ad-active",!1),delete t.adProgress,void 0!==t.rate&&(e.playbackRate=t.rate,delete t.rate),"number"==typeof t.snapbackTime&&(r(e,t.snapbackTime),delete t.snapbackTime)}function L(e,t){const s=e.playbackRate;1!==s&&(t.rate=s,e.playbackRate=1)}!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(B||(B={}));const Q=navigator.languages||[navigator.language];function j(e){const t=e.ssai.ui,s=new google.ima.dai.api.UiSettings,r=e.opt("lang")||function(){try{return Q.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().find(e=>!e.includes("-"))||"en";s.setLocale(r);const i=new google.ima.dai.api.StreamManager(e,t,s);return i.addEventListener([google.ima.dai.api.StreamEvent.Type.LOADED,google.ima.dai.api.StreamEvent.Type.ERROR,google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED,google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED,google.ima.dai.api.StreamEvent.Type.AD_PROGRESS,google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED,google.ima.dai.api.StreamEvent.Type.RESUMED,google.ima.dai.api.StreamEvent.Type.PAUSED,google.ima.dai.api.StreamEvent.Type.STARTED,google.ima.dai.api.StreamEvent.Type.COMPLETE,google.ima.dai.api.StreamEvent.Type.SKIPPED,google.ima.dai.api.StreamEvent.Type.CLICK],t=>{!function(e,t,s){switch(s.type){case google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED:return async function(e,t){var s,r;const i=t.getStreamData().streamId,n=e.ssai.provider;if(!i||!n.isPod)return;if(!n.isVod){const t=null===(s=n.src)||void 0===s?void 0:s.streamUrl;return t?(n.daiStream=n.buildPodStreamURL(t,i),e.setSrc(n.daiStream)):console.error("streamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#create_a_simple_video_player_2")}const a=null===(r=n.src)||void 0===r?void 0:r.requestStreamUrl;if(!a)return console.error("requestStreamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#vod-pod-serving_1");try{n.daiStream=await a(e.ssai.streamManager,i),e.ssai.streamManager.loadStreamMetadata(),e.setSrc(n.daiStream)}catch(t){z(e)}}(e,s);case google.ima.dai.api.StreamEvent.Type.RESUMED:return D("ad-resumed",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.PAUSED:return D("ad-paused",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.COMPLETE:return D("ad-completed",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.SKIPPED:return D("ad-skipped",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.LOADED:return function(e,t){const s=t.getStreamData().url,r=e.ssai.provider;if(!s||r.isPod&&!r.isVod)return;r.daiStream=s,e.setSrc(s)}(e,s);case google.ima.dai.api.StreamEvent.Type.STARTED:return e.ssai.provider.currentAd=s.getAd(),D("ad-started",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED:return N(e),D("ad-break-started",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED:return D(a,e,V(e,s)),x(e),e.ssai.provider.currentAd=void 0;case google.ima.dai.api.StreamEvent.Type.ERROR:return z(e,s);case google.ima.dai.api.StreamEvent.Type.AD_PROGRESS:{const t=V(e,s);return I(e,t.stream_data.adProgressData),D("ad-progress",e,t)}case google.ima.dai.api.StreamEvent.Type.CLICK:(function(e,t){if(!e.paused)e.togglePlay(!1)})(e)}}(e,0,t)},!1),e.on("ID3",({data:e})=>{const t=null==e?void 0:e.cue;if(!t)return;const s={},r=t.value;s[r.key]=r.data,i.onTimedMetadata(s)}),e.on("ssai:hls:metadata",e=>{var t;null===(t=e.detail)||void 0===t||t.samples.forEach(e=>i.processMetadata("ID3",e.data,e.pts))}),e.on("ssai:dash:metadata",e=>{const t=e.detail;if(!t)return;const s=t.event.messageData,r=t.event.calculatedPresentationTime;i.processMetadata("urn:google:dai:2018",s,r)}),i}function V(e,t){return{stream_data:t.getStreamData(),ad:e.ssai.provider.currentAd}}function z(e,t){var s,r;const i=e.ssai.provider;if(null===(s=i.src)||void 0===s?void 0:s.backupStream)return e.setSrc(i.src.backupStream);e.emit("error",{message:(null===(r=null==t?void 0:t.getStreamData())||void 0===r?void 0:r.errorMessage)||"error loading stream"})}const W=d("ads/ima/sdk");var G;async function H(e,t){var s;const r=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(t?null==r?void 0:r.dai:r)return void W(":noop");const i=t?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":e._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(e){return new Promise((t,s)=>{let r=document.querySelector(`script[src='${e}']`);if(r)return K(r,t,s);r=document.createElement("script"),r.setAttribute("state",G.LOADING),K(r,t,s),r.src=e,document.head.appendChild(r)})}(i),void W(":loaded")}catch(e){W(":error "+e.message,e)}}function K(e,t,s){const r=e.getAttribute("state");if(r&&[G.ERROR,G.LOADED].includes(r))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",G.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",G.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(G||(G={}));const $=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends $.AnalyticEventObserver{constructor(e){super(),this.video=e}onAdvertBreakStart(e){const t=e.getDuration();if(!e.isActive()&&t){const e=s(this.video);r(this.video,e+t/1e3)}N(this.video,e.getStart()),D("ad-break-started",this.video)}onAdvertBreakEnd(){x(this.video),D(a,this.video)}onAdvertStart(e){}onAdvertEnd(){}onTrackingEvent(e){}}function Z(e,t){YospaceAdManagement.SessionVOD.create(e,t.ssai.properties,e=>{const r=e.getPayload();if(r.getSessionResult()===YospaceAdManagement.SessionResult.INITIALISED){t.ssai.session=r;const e=new EventObserver(t);r.addAnalyticObserver(e),t.setSrc({src:r.getPlaybackUrl()}),setInterval(()=>{const e=1e3*s(t);r.onPlayheadUpdate(e),function(e,t,s){const r=e.getCurrentAdBreak();if(!r)return;const i={currentTime:s-r.getStart(),duration:r.getDuration()};I(t,i),D("ad-progress",t,{stream_data:i})}(r,t,e)},250)}else console.warn("YoSpace Failed to initialise session. ResultCode = "+r.getResultCode())})}var X=Object.freeze({__proto__:null,exists:function(){return!!window.YospaceAdManagement},init:function(e,t){t.ssai&&(!function(e){Object.defineProperty(e,"currentTime",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.currentTime:e.ssai.provider.getContentCurrentTime(e)}return s(e)},set:function(t){var s;if(e.ssai){if(e.ssai.state.adProgress)return;return null===(s=e.ssai.provider)||void 0===s?void 0:s.setContentCurrentTime(e,t)}}}),Object.defineProperty(e,"duration",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.duration:e.ssai.provider.getContentDuration(e)}return n(e)},set:function(){}})}(t),Object.assign(t.ssai,function(){const e=new YospaceAdManagement.SessionProperties;return e.setUserAgent(navigator.userAgent),{properties:e}}()))},srcIsValid:function(e){return"yospace"==e.type},onload:function(e,t){t&&t.src&&Z(t.src,e)},getContentCurrentTime:function(e){const t=s(e),r=e.ssai.session;return r?r.getContentPositionForPlayhead(1e3*t)/1e3:t},setContentCurrentTime:function(e,t){const s=e.ssai.session;return r(e,s?s.getPlayheadForContentPosition(1e3*t)/1e3:t)},onNewSrc:function(e){},getContentDuration:function(e){const t=e.ssai.session,s=n(e);return t?t.getContentPositionForPlayhead(t.getDuration())/1e3:s},getAdType:function(){},getPreviousActiveAdStart:function(e,t){const s=e.ssai.session;if(!s)return;const r=s.getAdBreaks();let i;const n=1e3*t;return r.forEach(e=>{void 0===i&&e.getStart()<n&&e.isActive()&&(i=e)}),void 0!==i?i.getStart()/1e3:void 0}});const Y=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?r:i})(e._customElements,t))(e),J=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class SSAIAdUi extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-ui",this.append(...this.player.createComponents("flowplayer-ssai-indicator","flowplayer-ssai-timeline","flowplayer-ssai-controls"))}}class SSAITimeline extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-timeline";const t=document.createElement("div");t.className="fp-ssai-progress",this.append(t),this.player.on(a,()=>{t.classList.remove("go"),"--ssai-percent-complete --ssai-percent-previous".split(" ").forEach(e=>this.style.setProperty(e,"0"))}),this.player.on("ad-progress",e=>{var s,r,i;const n=null===(i=null===(r=null===(s=e.detail)||void 0===s?void 0:s.data)||void 0===r?void 0:r.stream_data)||void 0===i?void 0:i.adProgressData;if(!n)return;const a=n.currentTime/n.duration*100,o=t.style.getPropertyValue("--ssai-percent-complete");t.classList.remove("go"),t.style.setProperty("--ssai-percent-previous",o),t.style.setProperty("--ssai-percent-complete",a.toFixed(3)),t.classList.add("go")})}}function ee(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}class SSAIControls extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-controls",this.createLeftZone(),this.createRightZone()}createRightZone(){const e=document.createElement("div");e.className="fp-ssai-right-zone",e.append(...this.player.createComponents("flowplayer-volume-control"),...this.fsIcons()),this.append(e)}createLeftZone(){const e=document.createElement("div");e.className="fp-ssai-left-zone",e.append(...this.player.createComponents("flowplayer-control-buttons"),this.remainingTimeComponent()),this.append(e)}fsIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(e=>(e.onclick=()=>this.player.toggleFullScreen(),e))}remainingTimeComponent(){const e=document.createElement("div");return e.className="fp-ssai-remaining",this.player.on("ad-progress",t=>{var s,r;const i=null===(r=null===(s=t.detail.data)||void 0===s?void 0:s.stream_data)||void 0===r?void 0:r.adProgressData;i&&(e.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let r=Math.floor(e/60);return e-=60*r,s>=1?(r-=60*s,t+s+":"+ee(r)+":"+ee(e)):t+ee(r)+":"+ee(e)}(i.duration-i.currentTime))}),e}}class SSAIAdIndicator extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-indicator",this.player.on("ad-started",e=>{var t,s,r;const i=null===(r=null===(s=null===(t=e.detail)||void 0===t?void 0:t.data)||void 0===s?void 0:s.ad)||void 0===r?void 0:r.getAdPodInfo();i&&(this.textContent=`${this.player.i18n("ads.indicator","ADS")} ${i.getAdPosition()} / ${i.getTotalAds()}`)})}}var te;const se=[X,new class Dai{async init(e,t){var s,r;if(t.ssai)return this.make_analytics(t),await H(t,!0),(null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai)?void 0:console.warn("google.ima.dai unavailable")}async onload(e,t){var s,r,i;if(await H(e,!0),null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai){if((null===(i=e.ssai)||void 0===i?void 0:i.streamManager)||(e.ssai.streamManager=j(e)),this.src=t,this.isPod=!!t.customAssetKey||!!t.requestStreamUrl,this.isVod=!!t.contentSourceId||!!t.videoId||!!t.requestStreamUrl,this.isPod)return this.requestPodStream(e.ssai.streamManager,t);this.requestStream(e.ssai.streamManager,t)}else t.backupStream&&e.setSrc(t.backupStream)}onNewSrc(e,t){var s;t.src!==this.daiStream&&(null===(s=e.ssai.streamManager)||void 0===s||s.reset())}make_analytics(e){const t=Analytics.of(e,{required_keys:R,events:T,optional_keys:P});e.on("config",()=>{var s;return Analytics.mergeMetadata(t,null===(s=e.opts)||void 0===s?void 0:s.metadata)})}exists(){return!0}getAdType(){if(this.currentAd)switch(this.currentAd.getAdPodInfo().getPodIndex()){case 0:return B.Preroll;case-1:return B.Postroll;case-2:return;default:return B.Midroll}}getContentCurrentTime(e){const t=e.ssai.streamManager,s=e.currentTime;return t?t.contentTimeForStreamTime(s):s}setContentCurrentTime(e,t){}getContentDuration(e){const t=e.ssai.streamManager,s=e.duration;return t?t.contentTimeForStreamTime(s):s}getPreviousActiveAdStart(e,t){var s,r;const i=null===(r=null===(s=e.ssai)||void 0===s?void 0:s.streamManager)||void 0===r?void 0:r.previousCuePointForStreamTime(t);if(i&&!i.played)return i.start}srcIsValid(e){return"google/dai"==e.type}requestStream(e,t){const s=this.isVod?new google.ima.dai.api.VODStreamRequest:new google.ima.dai.api.LiveStreamRequest;e.requestStream(Object.assign(s,t))}requestPodStream(e,t){const s=this.isVod?new google.ima.dai.api.PodVodStreamRequest:new google.ima.dai.api.PodStreamRequest;e.requestStream(Object.assign(s,t))}buildPodStreamURL(e,t){return e.replace("[[STREAMID]]",t)}}],re=((te=class Ssai{constructor(e){this.umd=e,J(e,"flowplayer-ssai-ui",SSAIAdUi),J(e,"flowplayer-ssai-timeline",SSAITimeline),J(e,"flowplayer-ssai-controls",SSAIControls),J(e,"flowplayer-ssai-indicator",SSAIAdIndicator)}init(e,t,i){se.forEach(e=>{if(i.ssai||!e.exists())return;const n=Y(i,"flowplayer-ssai-ui");t.append(n),i.ssai={provider:e,ui:n,state:{snapback:!1}},e.init(t,i),i.on("seeked",()=>function(e){if(e.opt("live"))return;if(!e.ssai)return;const{provider:t,state:i}=e.ssai;if(i.snapback)return i.snapback=!1;const n=s(e),a=t.getPreviousActiveAdStart(e,n);void 0!==a&&(i.snapback=!0,i.snapbackTime=n,r(e,a))}(i)),i.on("src",t=>{i.setState("ssai-ad-active",!1),i.ssai&&(i.ssai.state={snapback:!1},e.onNewSrc(i,t.detail))})})}onload(e,t,s,r){var i;(null===(i=s.ssai)||void 0===i?void 0:i.provider)&&s.ssai.provider.onload(s,r)}wants(e,t,s){let r=!1;return se.forEach(e=>{if(!r&&e.exists()&&e.srcIsValid(t))return r=!0}),r}}).events=o,te);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const s=e.flowplayer;return"function"==typeof s?(s(t),t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t),t)}(window,re)}));
@@ -820,6 +820,8 @@ declare const NO_CONTROLS = "no-controls";
820
820
 
821
821
  declare const NO_DVR = "no-timeline";
822
822
 
823
+ declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
824
+
823
825
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
824
826
 
825
827
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -960,7 +962,6 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
960
962
  disabled: boolean;
961
963
  /* Excluded from this release type: started */
962
964
  /* Excluded from this release type: token */
963
- tracks?: VideoTrack[];
964
965
  /* Excluded from this release type: _customElements */
965
966
  /* Excluded from this release type: _storage */
966
967
  };
@@ -1044,6 +1045,7 @@ declare type PlayerCustomEventsOverloads = {
1044
1045
  */
1045
1046
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
1046
1047
  /* Excluded from this release type: on */
1048
+ /* Excluded from this release type: on */
1047
1049
  /**
1048
1050
  * Listen to this event to create a recommendations grid using the data passed with the event.
1049
1051
  */
@@ -1062,6 +1064,11 @@ declare type PlayerCustomEventsOverloads = {
1062
1064
  /* Excluded from this release type: on */
1063
1065
  /* Excluded from this release type: on */
1064
1066
  /* Excluded from this release type: on */
1067
+ /* Excluded from this release type: on */
1068
+ /**
1069
+ * TODO: this is a workaround, since not all event overloads are typed. when all plugin work is finished, remove this
1070
+ * https://wowzamedia.jira.com/browse/PLAY-653
1071
+ */
1065
1072
  on<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1066
1073
  /* Excluded from this release type: on */
1067
1074
  /**
@@ -1086,9 +1093,12 @@ declare type PlayerCustomEventsOverloads = {
1086
1093
  */
1087
1094
  off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1088
1095
  /* Excluded from this release type: poll */
1096
+ emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1097
+ emit(event: never, data?: never): Player;
1098
+ /* Excluded from this release type: emit */
1099
+ /* Excluded from this release type: emit */
1089
1100
  /* Excluded from this release type: emit */
1090
1101
  /* Excluded from this release type: emit */
1091
- emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1092
1102
  /* Excluded from this release type: emit */
1093
1103
  };
1094
1104
 
@@ -1196,6 +1206,17 @@ declare const /**
1196
1206
  */
1197
1207
  PROGRESS = "progress";
1198
1208
 
1209
+ /**
1210
+ * @public
1211
+ */
1212
+ declare type QselOption = {
1213
+ height: number;
1214
+ level: number;
1215
+ text: string;
1216
+ /* Excluded from this release type: videoCodec */
1217
+ width: number;
1218
+ };
1219
+
1199
1220
  /**
1200
1221
  * @public
1201
1222
  * emitted whenever a list of qualities has been made available
@@ -1214,27 +1235,11 @@ QUALITIES = "qualities";
1214
1235
  /**
1215
1236
  * @public
1216
1237
  */
1217
- declare type QualitiesEventDetail = QualityDetail[];
1238
+ declare type QualitiesEventDetail = QselOption[];
1218
1239
 
1219
- /**
1220
- * @public
1221
- */
1222
- declare type QualityDetail = {
1223
- level: number;
1224
- text: string;
1225
- width: number;
1226
- height: number;
1227
- videoCodec: string;
1228
- } | BitrateInfo | {
1229
- text: string | number;
1230
- encodingId: string;
1231
- spatialLayerId: number;
1232
- temporalLayerId: number;
1233
- maxSpatialLayerId: number;
1234
- maxTemporalLayerId: number;
1235
- height: number;
1236
- width: number;
1237
- };
1240
+ /* Excluded from this release type: _QualitiesEventDetail */
1241
+
1242
+ /* Excluded from this release type: _QualityDetail */
1238
1243
 
1239
1244
  declare enum QualityOpts {
1240
1245
  LOW = 1,
@@ -1406,20 +1411,14 @@ SEEKING_2 = "seeking";
1406
1411
 
1407
1412
  /**
1408
1413
  * @public
1409
- * allows plugins to listen for forced quality changes
1410
- * it should emit the index of the quality to set
1411
- * -1 is a special idx saying to use ABR if the plugin
1412
- * exposes an ABR implementation
1414
+ * @deprecated please use Qsel.events.SET_QUALITY
1413
1415
  */
1414
1416
  declare const /**
1415
1417
  @public
1416
1418
  * when a new player is inserted into the HTML
1417
1419
  */ /**
1418
1420
  * @public
1419
- * allows plugins to listen for forced quality changes
1420
- * it should emit the index of the quality to set
1421
- * -1 is a special idx saying to use ABR if the plugin
1422
- * exposes an ABR implementation
1421
+ * @deprecated please use Qsel.events.SET_QUALITY
1423
1422
  */
1424
1423
  SET_QUALITY = "quality:set";
1425
1424
 
@@ -1723,16 +1722,6 @@ declare const /**
1723
1722
  */
1724
1723
  VIDEO_TRACKS = "videoTracks";
1725
1724
 
1726
- /**
1727
- * @public
1728
- */
1729
- declare interface VideoTrack {
1730
- name: string;
1731
- /* Excluded from this release type: data */
1732
- default: boolean;
1733
- selected: boolean;
1734
- }
1735
-
1736
1725
  /**
1737
1726
  * @public
1738
1727
  * when a player enters the viewpoint