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

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
 
@@ -1563,16 +1562,6 @@ declare const /**
1563
1562
  */
1564
1563
  VIDEO_TRACKS = "videoTracks";
1565
1564
 
1566
- /**
1567
- * @public
1568
- */
1569
- declare interface VideoTrack {
1570
- name: string;
1571
- /* Excluded from this release type: data */
1572
- default: boolean;
1573
- selected: boolean;
1574
- }
1575
-
1576
1565
  /**
1577
1566
  * @public
1578
1567
  * 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
 
@@ -1562,16 +1561,6 @@ declare const /**
1562
1561
  */
1563
1562
  VIDEO_TRACKS = "videoTracks";
1564
1563
 
1565
- /**
1566
- * @public
1567
- */
1568
- declare interface VideoTrack {
1569
- name: string;
1570
- /* Excluded from this release type: data */
1571
- default: boolean;
1572
- selected: boolean;
1573
- }
1574
-
1575
1564
  /**
1576
1565
  * @public
1577
1566
  * when a player enters the viewpoint
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
 
3
3
  import type { BitrateInfo } from 'dashjs';
4
+ import type { Level } from 'hls.js';
4
5
  import type { MediaKeyFunc } from 'hls.js';
5
6
 
6
7
  /* Excluded from this release type: AnyLoader */
@@ -401,6 +402,13 @@ declare namespace events {
401
402
  }
402
403
  }
403
404
 
405
+ declare namespace events_2 {
406
+ export {
407
+ VIDEO_TRACK_SELECT_2 as VIDEO_TRACK_SELECT,
408
+ VIDEO_TRACKS_2 as VIDEO_TRACKS
409
+ }
410
+ }
411
+
404
412
  declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
405
413
 
406
414
  /**
@@ -762,6 +770,8 @@ declare const NO_CONTROLS = "no-controls";
762
770
 
763
771
  declare const NO_DVR = "no-timeline";
764
772
 
773
+ declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
774
+
765
775
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
766
776
 
767
777
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -782,6 +792,8 @@ declare type OVPMetadata = {
782
792
  tags?: string;
783
793
  };
784
794
 
795
+ /* Excluded from this release type: PARSE_TRACKS */
796
+
785
797
  /**
786
798
  * @public
787
799
  */
@@ -902,7 +914,6 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
902
914
  disabled: boolean;
903
915
  /* Excluded from this release type: started */
904
916
  /* Excluded from this release type: token */
905
- tracks?: VideoTrack[];
906
917
  /* Excluded from this release type: _customElements */
907
918
  /* Excluded from this release type: _storage */
908
919
  };
@@ -986,6 +997,7 @@ declare type PlayerCustomEventsOverloads = {
986
997
  */
987
998
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
988
999
  /* Excluded from this release type: on */
1000
+ /* Excluded from this release type: on */
989
1001
  /**
990
1002
  * Listen to this event to create a recommendations grid using the data passed with the event.
991
1003
  */
@@ -1004,6 +1016,11 @@ declare type PlayerCustomEventsOverloads = {
1004
1016
  /* Excluded from this release type: on */
1005
1017
  /* Excluded from this release type: on */
1006
1018
  /* Excluded from this release type: on */
1019
+ /* Excluded from this release type: on */
1020
+ /**
1021
+ * TODO: this is a workaround, since not all event overloads are typed. when all plugin work is finished, remove this
1022
+ * https://wowzamedia.jira.com/browse/PLAY-653
1023
+ */
1007
1024
  on<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1008
1025
  /* Excluded from this release type: on */
1009
1026
  /**
@@ -1028,9 +1045,12 @@ declare type PlayerCustomEventsOverloads = {
1028
1045
  */
1029
1046
  off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1030
1047
  /* Excluded from this release type: poll */
1048
+ emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1049
+ emit(event: never, data?: never): Player;
1050
+ /* Excluded from this release type: emit */
1051
+ /* Excluded from this release type: emit */
1031
1052
  /* Excluded from this release type: emit */
1032
1053
  /* Excluded from this release type: emit */
1033
- emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1034
1054
  /* Excluded from this release type: emit */
1035
1055
  };
1036
1056
 
@@ -1138,6 +1158,17 @@ declare const /**
1138
1158
  */
1139
1159
  PROGRESS = "progress";
1140
1160
 
1161
+ /**
1162
+ * @public
1163
+ */
1164
+ declare type QselOption = {
1165
+ height: number;
1166
+ level: number;
1167
+ text: string;
1168
+ /* Excluded from this release type: videoCodec */
1169
+ width: number;
1170
+ };
1171
+
1141
1172
  /**
1142
1173
  * @public
1143
1174
  * emitted whenever a list of qualities has been made available
@@ -1156,27 +1187,11 @@ QUALITIES = "qualities";
1156
1187
  /**
1157
1188
  * @public
1158
1189
  */
1159
- declare type QualitiesEventDetail = QualityDetail[];
1190
+ declare type QualitiesEventDetail = QselOption[];
1160
1191
 
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
- };
1192
+ /* Excluded from this release type: _QualitiesEventDetail */
1193
+
1194
+ /* Excluded from this release type: _QualityDetail */
1180
1195
 
1181
1196
  declare enum QualityOpts {
1182
1197
  LOW = 1,
@@ -1348,20 +1363,14 @@ SEEKING_2 = "seeking";
1348
1363
 
1349
1364
  /**
1350
1365
  * @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
1366
+ * @deprecated please use Qsel.events.SET_QUALITY
1355
1367
  */
1356
1368
  declare const /**
1357
1369
  @public
1358
1370
  * when a new player is inserted into the HTML
1359
1371
  */ /**
1360
1372
  * @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
1373
+ * @deprecated please use Qsel.events.SET_QUALITY
1365
1374
  */
1366
1375
  SET_QUALITY = "quality:set";
1367
1376
 
@@ -1454,6 +1463,8 @@ declare namespace states {
1454
1463
  }
1455
1464
  }
1456
1465
 
1466
+ /* Excluded from this release type: SWITCH */
1467
+
1457
1468
  /**
1458
1469
  * @public
1459
1470
  */
@@ -1517,6 +1528,8 @@ TOUCH_START = "touchstart";
1517
1528
 
1518
1529
  declare const TOUCHED = "is-touched";
1519
1530
 
1531
+ /* Excluded from this release type: TRACKS */
1532
+
1520
1533
  declare const TV = "is-tv";
1521
1534
 
1522
1535
  /**
@@ -1537,6 +1550,11 @@ declare const /**
1537
1550
  */
1538
1551
  VIDEO_TRACK_SELECT = "tracks:video:select";
1539
1552
 
1553
+ /**
1554
+ * @public
1555
+ */
1556
+ declare const VIDEO_TRACK_SELECT_2 = "tracks:video:select";
1557
+
1540
1558
  /**
1541
1559
  * @public
1542
1560
  * emitted whenever multiple video tracks are detected
@@ -1553,13 +1571,46 @@ VIDEO_TRACKS = "videoTracks";
1553
1571
  /**
1554
1572
  * @public
1555
1573
  */
1556
- declare interface VideoTrack {
1574
+ declare const VIDEO_TRACKS_2 = "videoTracks";
1575
+
1576
+ /**
1577
+ * @public
1578
+ */
1579
+ export declare type VideoTrack = VideoTrackBasic & {
1580
+ /**
1581
+ * Returns `true` if a video track is enabled at a specific time. Otherwise, returns `false`.
1582
+ When switching to another video track, set this property to `true` for the corresponding track. For example, `player.tracks[0].selected = true`.
1583
+ */
1584
+ selected: boolean;
1585
+ };
1586
+
1587
+ /**
1588
+ * @public
1589
+ */
1590
+ export declare interface VideoTrackBasic {
1591
+ /**
1592
+ * Determines the name or label of the video track.
1593
+ */
1557
1594
  name: string;
1558
1595
  /* Excluded from this release type: data */
1596
+ /**
1597
+ * Returns `true` if a video track is enabled by default once the `src` is set for the player.
1598
+ */
1559
1599
  default: boolean;
1560
- selected: boolean;
1561
1600
  }
1562
1601
 
1602
+ /**
1603
+ * @public
1604
+ */
1605
+ export declare type VideoTrackSelectEventDetail = {
1606
+ track: VideoTrackBasic;
1607
+ };
1608
+
1609
+ /**
1610
+ * @public
1611
+ */
1612
+ export declare type VideoTracksEventDetail = VideoTrack[];
1613
+
1563
1614
  /**
1564
1615
  * @public
1565
1616
  * when a player enters the viewpoint
@@ -1609,10 +1660,48 @@ VOLUME_CHANGE = "volumechange";
1609
1660
 
1610
1661
  /**
1611
1662
  * @public
1663
+ * The Video Track Selection plugin allows you to configure the player with a single stream that contains multiple video tracks.
1664
+ * See {@link https://developer.wowza.com/docs/wowza-flowplayer/plugins/vtsel/| Official documentation}
1612
1665
  */
1613
- declare const Vtsel: PluginCtor<Config, Player>;
1666
+ declare const Vtsel: PluginCtor<Config, VtselPlayer> & VtselAPI;
1614
1667
  export default Vtsel;
1615
1668
 
1669
+ /**
1670
+ * @public
1671
+ */
1672
+ export declare type VtselAPI = {
1673
+ events: VtselEvents;
1674
+ };
1675
+
1676
+ /**
1677
+ * @public
1678
+ */
1679
+ export declare type VtselEvents = typeof events_2;
1680
+
1681
+ /**
1682
+ * @public
1683
+ */
1684
+ export declare type VtselPlayer = PlayerWith<{
1685
+ /**
1686
+ * An array of all available tracks. The array is populated only if the source that's being played provides multiple video tracks. If there's only one video track, the length property indicates one element exists inside the array.
1687
+ */
1688
+ tracks?: VideoTrack[];
1689
+ /**
1690
+ * Emitted when a different video track is enabled.
1691
+ * @param event - "VIDEO_TRACK_SELECT"
1692
+ * @param handler - Event handler with basic information about selected track
1693
+ */
1694
+ on(event: VtselEvents["VIDEO_TRACK_SELECT"], handler: (e: FPEvent<VideoTrackSelectEventDetail>) => void): Player;
1695
+ /**
1696
+ * Emitted when the player detects a `src` with multiple video tracks. For information about tracks and their properties, see the {@link https://developer.wowza.com/docs/wowza-flowplayer/plugins/vtsel/#properties| Properties} section.
1697
+ * @param event - "VIDEO_TRACKS"
1698
+ * @param handler - Event handler with video tracks details supplied
1699
+ */
1700
+ on(event: VtselEvents["VIDEO_TRACKS"], handler: (e: FPEvent<VideoTracksEventDetail>) => void): Player;
1701
+ /* Excluded from this release type: videoTracks */
1702
+ /* Excluded from this release type: emit */
1703
+ }>;
1704
+
1616
1705
  declare const WAITING = "is-waiting";
1617
1706
 
1618
1707
  /**
package/plugins/vtsel.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.vtsel=t())}(this,(function(){"use strict";const e=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const s=window.customElements.get(t);if(!s)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const t="fp-on",n="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.menuHeader=document.createElement("div"),this.menuTitle=document.createElement("h3"),this.olEle=document.createElement("ol"),this.olEle.id=i(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menuHeader.classList.add("fp-menu-header"),this.menuHeader.append(this.menuTitle,this.closeEle),this.menu.classList.add("fp-menu"),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add("fp-menu-container"),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",t=>{if(t.defaultPrevented)return;t.preventDefault();const n=this.menuContainer.open;n||(s(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,e.root.classList.toggle("has-menu-opened",!n),this.summaryEle.setAttribute("aria-expanded",n?"false":"true")}),this.addEventListener("focusin",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","true")}),this.addEventListener("focusout",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","false")}),this.append(this.menuContainer),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("aria-expanded","false"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(t){if(this.className=t.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=t.id||i()),this.summaryEle.setAttribute("aria-label",t.menuTitle||"Menu"),t.summaryTitle&&(this.summaryEle.textContent=t.summaryTitle),t.summaryIcon){const n=e(this.player,t.summaryIcon);n.setAttribute("tabindex",""),this.summaryEle.append(n)}t.menuTitle&&(this.menuTitle.textContent=t.menuTitle),this.menu.classList.toggle("fp-icons",!!t.icons),this.addEventListener(t.options_event,e=>{this.render(e.data)}),t.item_selected_event&&this.addEventListener(t.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.toggle_visibility(!(null==e?void 0:e.length)))}menuOption(e,t){const n=document.createElement("li");n.setAttribute("role","menuitem"),n.setAttribute("aria-selected","false"),n.setAttribute("tabindex","0"),e.icon&&n.append(e.icon);const s=document.createElement("span");s.textContent=e.text,n.append(s),n.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(n),e.selected&&this.select_item(t)}select_item(e){this.options.forEach((n,s)=>{n.classList.toggle(t,s===e)})}unselect_item(){this.options.forEach(e=>{e.classList.remove(t)})}toggle_visibility(e){this.classList.toggle(n,e),this.menu.style.setProperty("display",e?"none":"flex")}}function s(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector("details[open].fp-menu-container");n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}function i(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(s(),this.active_menu=void 0)}));function r(e,t,n){const s=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(s),e}var a;!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}(),function(e){e[e.Idle=0]="Idle",e[e.Receiving=1]="Receiving"}(a||(a={}));var o=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){var n,s,i,r,a;n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=a.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=a.normalizePath(i.path),a.buildURLFromParts(i)}var r=a.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return n.alwaysNormalize?(r.path=a.normalizePath(r.path),a.buildURLFromParts(r)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=s.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var c={scheme:o.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(c.netLoc=o.netLoc,"/"!==r.path[0]))if(r.path){var u=o.path,d=u.substring(0,u.lastIndexOf("/")+1)+r.path;c.path=a.normalizePath(d)}else c.path=o.path,r.params||(c.params=o.params,r.query||(c.query=o.query));return null===c.path&&(c.path=n.alwaysNormalize?a.normalizePath(r.path):r.path),a.buildURLFromParts(c)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(i,"");e.length!==(e=e.replace(r,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a}));const l=/#EXT-X-MEDIA:(.*)/g,c=/(.+?)=(".*?"|.*?)(?:,|$)/g;function u(e,t,n,s){let i=n;const r={name:e,default:n,data:s||[]};return Object.defineProperty(r,"selected",{get:()=>i,set(e){var n;"boolean"==typeof e&&i!==e&&(i&&1===(null===(n=t.tracks)||void 0===n?void 0:n.filter(e=>e.selected).length)||(i=e,e&&t.emit("tracks:video:select",{track:r})))}})}class AttrList{constructor(e){"string"==typeof e&&(e=AttrList.parseAttrList(e)),Object.keys(e).forEach(t=>{e.hasOwnProperty(t)&&("X-"===t.substring(0,2)&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])})}bool(e){return"YES"===this[e]}static parseAttrList(e){let t;const n={};for(c.lastIndex=0;null!==(t=c.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1));n[t[1].trim()]=e}return n}}var d;const m=((d=class Vtsel{constructor(e){((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,"flowplayer-video-menu",FlowplayerMenu)}init(t,n,s){const i=e(s,"flowplayer-video-menu");i instanceof FlowplayerMenu&&i.setMenuAttrs({summaryTitle:s.i18n("vtsel.button_txt","Video"),menuTitle:s.i18n("vtsel.menu_title","Video Track"),class:"fp-vsel",options_event:Vtsel.events.TRACKS,item_selected_event:Vtsel.events.SWITCH}),s.on("parse:video:tracks",e=>{const t=e.detail;t&&function(e,t,n){var s,i,r,a;let c,d=0;for(l.lastIndex=0;null!==(c=l.exec(t));){const t=new AttrList(c[1]);if("VIDEO"===t.TYPE){let l=null===(s=e.tracks)||void 0===s?void 0:s.find(e=>e.name===(t.NAME||t.LANGUAGE||"Track "+d));if(l||(l=u(t.NAME||t.LANGUAGE||d+++"",e,t.bool("DEFAULT")),t.bool("DEFAULT")&&(l.data=null===(i=e.hls)||void 0===i?void 0:i.levels.slice(0)),null===(r=e.tracks)||void 0===r||r.push(l)),t.bool("DEFAULT"))continue;const c={details:void 0,audioGroupIds:null===(a=e.hls)||void 0===a?void 0:a.levels[0].audioGroupIds,attrs:{},urlId:0,url:[t.URI?o.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):""],uri:t.URI?o.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):"",level:l.data.length,name:"level "+l.data.length};l.data.push(c)}}}(s,t.manifest,t.url)}),s.on("loadeddata",()=>{if(s.tracks&&s.tracks.length)return s.emit("videoTracks",s.tracks);s.tracks=s.videoTracks?Array.from(s.videoTracks).map((e,t)=>u(e.label?e.label:"track "+t,s,e.selected)):[u("default",s,!0)],s.emit("videoTracks",s.tracks)}),s.on("mount",(function(){var e;null===(e=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(s,s.hasState("is-tv")?"flowplayer-tv-menu":"flowplayer-control"))||void 0===e||e.append(i)})),s.on("src",()=>{s.tracks=[],r(i,Vtsel.events.TRACKS,[])}),s.on("videoTracks",()=>{const e=s.tracks;e&&Array.isArray(e)&&(r(i,Vtsel.events.TRACKS,e.map(e=>({text:e.name,onclick:()=>e.selected=!0}))),r(i,Vtsel.events.SWITCH,{selected_index:e.findIndex(e=>e.default)}),i instanceof FlowplayerMenu&&i.toggle_visibility((null==e?void 0:e.length)<2))}),s.on("tracks:video:select",e=>{const t=e.detail.track,n=s.tracks;if(!t||!n||!Array.isArray(n))return;if(r(i,Vtsel.events.SWITCH,{selected_index:n.indexOf(t)}),!s.opts.is_native||!s.videoTracks)return;s.videoTracks[n.indexOf(t)].selected=!0;const a=n.find(e=>e.selected&&e!==t);a&&(a.selected=!1,s.videoTracks[n.indexOf(a)].selected=!1)}),s.on("rts/status",e=>{var t;const n=e.detail.status,o=e.detail.data;if(n===a.Idle)return r(i,Vtsel.events.TRACKS,[]),s.tracks=[];n===a.Receiving&&(null===(t=null==s?void 0:s.tracks)||void 0===t||t.push(u((null==o?void 0:o.sourceId)||"Main",s,!(null==o?void 0:o.sourceId),o)))})}}).events={TRACKS:"video:tracks",SWITCH:"video:update"},d);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 n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,m)}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.vtsel=t())}(this,(function(){"use strict";const e=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const s=window.customElements.get(t);if(!s)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const t="fp-on",n="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.menuHeader=document.createElement("div"),this.menuTitle=document.createElement("h3"),this.olEle=document.createElement("ol"),this.olEle.id=i(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menuHeader.classList.add("fp-menu-header"),this.menuHeader.append(this.menuTitle,this.closeEle),this.menu.classList.add("fp-menu"),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add("fp-menu-container"),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",t=>{if(t.defaultPrevented)return;t.preventDefault();const n=this.menuContainer.open;n||(s(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,e.root.classList.toggle("has-menu-opened",!n),this.summaryEle.setAttribute("aria-expanded",n?"false":"true")}),this.addEventListener("focusin",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","true")}),this.addEventListener("focusout",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","false")}),this.append(this.menuContainer),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("aria-expanded","false"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(t){if(this.className=t.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=t.id||i()),this.summaryEle.setAttribute("aria-label",t.menuTitle||"Menu"),t.summaryTitle&&(this.summaryEle.textContent=t.summaryTitle),t.summaryIcon){const n=e(this.player,t.summaryIcon);n.setAttribute("tabindex",""),this.summaryEle.append(n)}t.menuTitle&&(this.menuTitle.textContent=t.menuTitle),this.menu.classList.toggle("fp-icons",!!t.icons),this.addEventListener(t.options_event,e=>{this.render(e.data)}),t.item_selected_event&&this.addEventListener(t.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.toggle_visibility(!(null==e?void 0:e.length)))}menuOption(e,t){const n=document.createElement("li");n.setAttribute("role","menuitem"),n.setAttribute("aria-selected","false"),n.setAttribute("tabindex","0"),e.icon&&n.append(e.icon);const s=document.createElement("span");s.textContent=e.text,n.append(s),n.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(n),e.selected&&this.select_item(t)}select_item(e){this.options.forEach((n,s)=>{n.classList.toggle(t,s===e)})}unselect_item(){this.options.forEach(e=>{e.classList.remove(t)})}toggle_visibility(e){this.classList.toggle(n,e),this.menu.style.setProperty("display",e?"none":"flex")}}function s(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector("details[open].fp-menu-container");n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}function i(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(s(),this.active_menu=void 0)}));function r(e,t,n){const s=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(s),e}var o;!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}(),function(e){e[e.Idle=0]="Idle",e[e.Receiving=1]="Receiving"}(o||(o={}));var a=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){var n,s,i,r,o;n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var r=o.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return n.alwaysNormalize?(r.path=o.normalizePath(r.path),o.buildURLFromParts(r)):t;var a=o.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var l=s.exec(a.path);a.netLoc=l[1],a.path=l[2]}a.netLoc&&!a.path&&(a.path="/");var c={scheme:a.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(c.netLoc=a.netLoc,"/"!==r.path[0]))if(r.path){var u=a.path,d=u.substring(0,u.lastIndexOf("/")+1)+r.path;c.path=o.normalizePath(d)}else c.path=a.path,r.params||(c.params=a.params,r.query||(c.query=a.query));return null===c.path&&(c.path=n.alwaysNormalize?o.normalizePath(r.path):r.path),o.buildURLFromParts(c)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(i,"");e.length!==(e=e.replace(r,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=o}));const l=/#EXT-X-MEDIA:(.*)/g,c=/(.+?)=(".*?"|.*?)(?:,|$)/g;function u(e,t,n,s){let i=n;const r={name:e,default:n,data:s||[]};return Object.defineProperty(r,"selected",{get:()=>i,set(e){var n;"boolean"==typeof e&&i!==e&&(i&&1===(null===(n=t.tracks)||void 0===n?void 0:n.filter(e=>e.selected).length)||(i=e,e&&t.emit("tracks:video:select",{track:r})))}})}class AttrList{constructor(e){"string"==typeof e&&(e=AttrList.parseAttrList(e)),Object.keys(e).forEach(t=>{e.hasOwnProperty(t)&&("X-"===t.substring(0,2)&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])})}bool(e){return"YES"===this[e]}static parseAttrList(e){let t;const n={};for(c.lastIndex=0;null!==(t=c.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1));n[t[1].trim()]=e}return n}}var d,m=Object.freeze({__proto__:null,PARSE_TRACKS:"parse:video:tracks",VIDEO_TRACK_SELECT:"tracks:video:select",VIDEO_TRACKS:"videoTracks",TRACKS:"video:tracks",SWITCH:"video:update"});const p=((d=class Vtsel{constructor(e){((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,"flowplayer-video-menu",FlowplayerMenu)}init(t,n,s){const i=e(s,"flowplayer-video-menu");i instanceof FlowplayerMenu&&i.setMenuAttrs({summaryTitle:s.i18n("vtsel.button_txt","Video"),menuTitle:s.i18n("vtsel.menu_title","Video Track"),class:"fp-vsel",options_event:Vtsel.events.TRACKS,item_selected_event:Vtsel.events.SWITCH}),s.on("parse:video:tracks",e=>{const t=e.detail;t&&function(e,t,n){var s,i,r,o,c,d,m;let p,h=0;for(l.lastIndex=0;null!==(p=l.exec(t));){const t=new AttrList(p[1]);if("VIDEO"===t.TYPE){let l=null===(s=e.tracks)||void 0===s?void 0:s.find(e=>e.name===(t.NAME||t.LANGUAGE||"Track "+h));if(l||(l=u(t.NAME||t.LANGUAGE||h+++"",e,t.bool("DEFAULT")),t.bool("DEFAULT")&&(l.data=null===(i=e.hls)||void 0===i?void 0:i.levels.slice(0)),null===(r=e.tracks)||void 0===r||r.push(l)),t.bool("DEFAULT"))continue;const p={details:void 0,audioGroupIds:null===(o=e.hls)||void 0===o?void 0:o.levels[0].audioGroupIds,attrs:{},urlId:0,url:[t.URI?a.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):""],uri:t.URI?a.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):"",level:null===(c=l.data)||void 0===c?void 0:c.length,name:"level "+(null===(d=l.data)||void 0===d?void 0:d.length)};null===(m=l.data)||void 0===m||m.push(p)}}}(s,t.manifest,t.url)}),s.on("loadeddata",()=>{if(s.tracks&&s.tracks.length)return s.emit("videoTracks",s.tracks);s.tracks=s.videoTracks?Array.from(s.videoTracks).map((e,t)=>u(e.label?e.label:"track "+t,s,e.selected)):[u("default",s,!0)],s.emit("videoTracks",s.tracks)}),s.on("mount",(function(){var e;null===(e=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(s,s.hasState("is-tv")?"flowplayer-tv-menu":"flowplayer-control"))||void 0===e||e.append(i)})),s.on("src",()=>{s.tracks=[],r(i,Vtsel.events.TRACKS,[])}),s.on("videoTracks",()=>{const e=s.tracks;e&&Array.isArray(e)&&(r(i,Vtsel.events.TRACKS,e.map(e=>({text:e.name,onclick:()=>e.selected=!0}))),r(i,Vtsel.events.SWITCH,{selected_index:e.findIndex(e=>e.default)}),i instanceof FlowplayerMenu&&i.toggle_visibility((null==e?void 0:e.length)<2))}),s.on("tracks:video:select",e=>{const t=e.detail.track,n=s.tracks;if(!t||!n||!Array.isArray(n))return;if(r(i,Vtsel.events.SWITCH,{selected_index:n.indexOf(t)}),!s.opts.is_native||!s.videoTracks)return;s.videoTracks[n.indexOf(t)].selected=!0;const o=n.find(e=>e.selected&&e!==t);o&&(o.selected=!1,s.videoTracks[n.indexOf(o)].selected=!1)}),s.on("rts/status",e=>{var t;const n=e.detail.status,a=e.detail.data;if(n===o.Idle)return r(i,Vtsel.events.TRACKS,[]),s.tracks=[];n===o.Receiving&&(null===(t=null==s?void 0:s.tracks)||void 0===t||t.push(u((null==a?void 0:a.sourceId)||"Main",s,!(null==a?void 0:a.sourceId),a)))})}}).events=m,d);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 n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,p)}));