@flowplayer/player 3.19.0 → 3.20.0-rc.6

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 (60) hide show
  1. package/core/events.d.ts +13 -0
  2. package/core/events.js +7 -2
  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 +119 -25
  8. package/package.json +1 -1
  9. package/plugins/ads.d.ts +120 -26
  10. package/plugins/ads.js +1 -1
  11. package/plugins/airplay.d.ts +120 -26
  12. package/plugins/analytics.d.ts +120 -26
  13. package/plugins/analytics.js +1 -1
  14. package/plugins/asel.d.ts +120 -26
  15. package/plugins/audio.d.ts +120 -26
  16. package/plugins/chapters.d.ts +120 -26
  17. package/plugins/chromecast.d.ts +146 -34
  18. package/plugins/chromecast.js +1 -1
  19. package/plugins/comscore.d.ts +120 -26
  20. package/plugins/consent.d.ts +120 -26
  21. package/plugins/context-menu.d.ts +120 -26
  22. package/plugins/cuepoints.d.ts +120 -26
  23. package/plugins/dash.d.ts +119 -25
  24. package/plugins/dash.js +1 -1
  25. package/plugins/drm.d.ts +120 -26
  26. package/plugins/endscreen.d.ts +120 -26
  27. package/plugins/fas.d.ts +120 -26
  28. package/plugins/float-on-scroll.d.ts +120 -26
  29. package/plugins/ga4.d.ts +120 -26
  30. package/plugins/ga4.js +1 -1
  31. package/plugins/gemius.d.ts +120 -26
  32. package/plugins/google-analytics.d.ts +120 -26
  33. package/plugins/google-analytics.js +1 -1
  34. package/plugins/hls.d.ts +120 -26
  35. package/plugins/hls.js +1 -1
  36. package/plugins/id3.d.ts +120 -26
  37. package/plugins/iframe.d.ts +119 -25
  38. package/plugins/keyboard.d.ts +120 -26
  39. package/plugins/media-session.d.ts +120 -26
  40. package/plugins/message.d.ts +120 -26
  41. package/plugins/ovp.d.ts +120 -26
  42. package/plugins/playlist.d.ts +125 -26
  43. package/plugins/playlist.js +1 -1
  44. package/plugins/preview.d.ts +120 -26
  45. package/plugins/qsel.d.ts +120 -26
  46. package/plugins/qsel.js +1 -1
  47. package/plugins/qul.d.ts +120 -26
  48. package/plugins/rts.d.ts +120 -26
  49. package/plugins/rts.js +2 -2
  50. package/plugins/share.d.ts +153 -26
  51. package/plugins/speed.d.ts +141 -30
  52. package/plugins/ssai.d.ts +120 -28
  53. package/plugins/ssai.js +2 -2
  54. package/plugins/subtitles.d.ts +120 -26
  55. package/plugins/thumbnails.d.ts +135 -30
  56. package/plugins/tizen.d.ts +120 -26
  57. package/plugins/vtsel.d.ts +119 -26
  58. package/plugins/webos.d.ts +120 -26
  59. package/util/loader.d.ts +120 -26
  60. package/util/loader.js +0 -1
@@ -1,7 +1,11 @@
1
1
  /// <reference types="node" />
2
2
 
3
3
  import type { BitrateInfo } from 'dashjs';
4
+ import type { Get } from 'type-fest';
5
+ import type { Level } from 'hls.js';
4
6
  import type { MediaKeyFunc } from 'hls.js';
7
+ import type { SetFieldType } from 'type-fest';
8
+ import type { TupleToUnion } from 'type-fest';
5
9
 
6
10
  /* Excluded from this release type: AnyLoader */
7
11
 
@@ -79,6 +83,26 @@ declare const /**
79
83
  */
80
84
  CLICK = "click";
81
85
 
86
+ /**
87
+ * For plugins that add new properties to all source types, combine their src-mixins into one SourceObject
88
+ * @example
89
+ * ```
90
+ * type Combined = CombineGlobalSrcExtensions<DRMPlugin, PluginWithFooFieldInSrc> // Combined = SourceObject<DRMConfig & FooFieldConfig>
91
+ * ```
92
+ */
93
+ declare type CombineGlobalSrcExtensions<PluginSrcs extends unknown[]> = HasGlobalSrcExtensios<PluginSrcs> extends false ? SourceObj : SourceObj & ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
94
+
95
+ /**
96
+ * For plugins that define a new src type, make a union of all new src.type declarations
97
+ * @example
98
+ * ```
99
+ * type Combined = CombineNewSourceTypes<RTSPlugin, SSAIPlugin> // Combined = DRMConfig | FooFieldConfig
100
+ * ```
101
+ */
102
+ declare type CombineNewSourceTypes<PluginSrcs extends unknown[]> = TupleToUnion<FilterNewSourceTypes<PluginSrcs>>;
103
+
104
+ declare type CombineSrc<PluginSrcs extends unknown[]> = UnsafeSource<CombineGlobalSrcExtensions<PluginSrcs> | (CombineNewSourceTypes<PluginSrcs> & CombineGlobalSrcExtensions<PluginSrcs>)>;
105
+
82
106
  /* Excluded from this release type: Component */
83
107
 
84
108
  /* Excluded from this release type: Components */
@@ -139,6 +163,10 @@ declare interface Config {
139
163
  */
140
164
  declare type ConfigWith<T> = Config & T;
141
165
 
166
+ declare type ConfigWithSourceExtensions<PluginBareConfigs extends unknown[]> = Omit<ConfigWith<ArrayToIntersection<PluginBareConfigs>>, "src"> & {
167
+ src?: CombineSrc<PickSrcExtensions<PluginBareConfigs>>;
168
+ };
169
+
142
170
  /* Excluded from this release type: CONTENT_REAL_LOAD_START */
143
171
 
144
172
  /**
@@ -382,6 +410,7 @@ declare namespace events {
382
410
  SOURCE,
383
411
  REAP,
384
412
  QUALITIES,
413
+ QUALITY_CHANGE,
385
414
  VIDEO_TRACKS,
386
415
  SET_QUALITY,
387
416
  VIDEO_TRACK_SELECT,
@@ -397,8 +426,20 @@ declare namespace events {
397
426
  }
398
427
  }
399
428
 
429
+ declare type ExtractBareConfig<Plugins extends PluginCtor> = Plugins extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
430
+
431
+ declare type ExtractPluginPlayerExtension<Plugin extends PluginCtor> = Plugin extends PluginCtor<infer _uConfigType, PlayerWith<infer PluginPlayer>> ? PluginPlayer : never;
432
+
400
433
  declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
401
434
 
435
+ declare type ExtractSrcExtension<PluginBareConfig> = Get<PluginBareConfig, "src"> extends UnsafeSource<infer SrcMixinType> ? SrcMixinType : never;
436
+
437
+ declare type FilterNewSourceTypes<PluginSrcs extends unknown[]> = {
438
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
439
+ type: string;
440
+ } ? PluginSrcs[Index] : never;
441
+ };
442
+
402
443
  /**
403
444
  * @public
404
445
  */
@@ -441,7 +482,7 @@ declare interface FlowplayerUMD extends FlowplayerUMDBase {
441
482
  * Register plugins in flowplayer
442
483
  * @returns flowplayer instance with registered plugins
443
484
  */
444
- <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<ConfigWith<MergeConfigs<PluginCtors>>, PlayerWith<MergePlayerAPIExtensions<PluginCtors>>>;
485
+ <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<MergeConfigs<PluginCtors>, PlayerWith<MergePlayerExtensions<PluginCtors>>>;
445
486
  }
446
487
 
447
488
  declare interface FlowplayerUMDBase {
@@ -542,6 +583,10 @@ declare const GRABBING = "is-grabbing";
542
583
 
543
584
  declare const HAS_POSTER = "has-poster";
544
585
 
586
+ declare type HasGlobalSrcExtensios<PluginSrcs extends unknown[]> = ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
587
+
588
+ declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnion<PickSrcExtensions<PluginBareConfigs>> extends never ? false : true;
589
+
545
590
  declare const HOVERED = "is-hovered";
546
591
 
547
592
  declare const IN_VIEWPORT = "is-in-viewport";
@@ -651,19 +696,24 @@ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwn
651
696
 
652
697
  declare const LOADING = "is-loading";
653
698
 
654
- declare type MapToConfigs<Arr extends PluginCtor[]> = {
655
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
699
+ declare type MapToBareConfigs<Plugins extends PluginCtor[]> = {
700
+ [PluginType in keyof Plugins]: ExtractBareConfig<Plugins[PluginType]>;
656
701
  };
657
702
 
658
- declare type MapToPlayerApiExtensions<Arr extends PluginCtor[]> = {
659
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer _uConfigType, PlayerWith<infer PlayerAPIExtension>> ? PlayerAPIExtension : never;
703
+ declare type MapToPlayerExtensions<Plugins extends PluginCtor[]> = {
704
+ [PluginIndex in keyof Plugins]: ExtractPluginPlayerExtension<Plugins[PluginIndex]>;
660
705
  };
661
706
 
662
707
  declare const MENU_OPENED = "has-menu-opened";
663
708
 
664
- declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
709
+ /**
710
+ * Combines plugin config and returns a type derived from Config
711
+ */
712
+ declare type MergeConfigs<Plugins extends PluginCtor[]> = MergePluginConfigs<MapToBareConfigs<Plugins>>;
713
+
714
+ declare type MergePlayerExtensions<Plugins extends PluginCtor[]> = ArrayToIntersection<MapToPlayerExtensions<Plugins>>;
665
715
 
666
- declare type MergePlayerAPIExtensions<Arr extends PluginCtor[]> = ArrayToIntersection<MapToPlayerApiExtensions<Arr>>;
716
+ declare type MergePluginConfigs<PluginBareConfigs extends unknown[]> = HasSrcExtensions<PluginBareConfigs> extends true ? ConfigWithSourceExtensions<PluginBareConfigs> : ConfigWith<ArrayToIntersection<PluginBareConfigs>>;
667
717
 
668
718
  /**
669
719
  * @public
@@ -770,8 +820,6 @@ declare const NO_CONTROLS = "no-controls";
770
820
 
771
821
  declare const NO_DVR = "no-timeline";
772
822
 
773
- declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
774
-
775
823
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
776
824
 
777
825
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -790,6 +838,7 @@ declare type OVPMetadata = {
790
838
  category_name?: string;
791
839
  duration?: number;
792
840
  tags?: string;
841
+ playlist_title?: string;
793
842
  };
794
843
 
795
844
  /**
@@ -805,6 +854,26 @@ PAUSE = "pause";
805
854
 
806
855
  declare const PAUSED = "is-paused";
807
856
 
857
+ declare type PickGlobalSrcExtension<PluginSrcs extends unknown[]> = {
858
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
859
+ type: string;
860
+ } ? unknown : PluginSrcs[Index];
861
+ };
862
+
863
+ /**
864
+ * Maps incoming array to the src extension type
865
+ * @example
866
+ * ```
867
+ * PickSrcExtensions<[
868
+ * {configProp: boolean, src: UnsafeSource<{srcProp: boolean}>},
869
+ * {}
870
+ * ]> // = [{srcProp: boolean}, never]
871
+ * ```
872
+ */
873
+ declare type PickSrcExtensions<PluginBareConfigs extends unknown[]> = {
874
+ [PluginType in keyof PluginBareConfigs]: ExtractSrcExtension<PluginBareConfigs[PluginType]>;
875
+ };
876
+
808
877
  /**
809
878
  * @public
810
879
  */
@@ -926,6 +995,8 @@ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap
926
995
  [DVR]: DvrEventDetail;
927
996
  [RETRY]: RetryEventDetail;
928
997
  [RECOVER]: RecoverEventDetail;
998
+ [QUALITIES]: QualitiesEventDetail;
999
+ [QUALITY_CHANGE]: QualityChangeEventDetail;
929
1000
  /* Excluded from this release type: audioonlysource */
930
1001
  /* Excluded from this release type: renderplugin */
931
1002
  /* Excluded from this release type: "seek:queued" */
@@ -982,7 +1053,10 @@ declare type PlayerCustomEventsOverloads = {
982
1053
  * Emitted when the set of underlying qualities has changed.
983
1054
  */
984
1055
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
985
- /* Excluded from this release type: on */
1056
+ /**
1057
+ * Emitted when the media changes quality.
1058
+ */
1059
+ on(event: typeof QUALITY_CHANGE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITY_CHANGE]>) => void): Player;
986
1060
  /* Excluded from this release type: on */
987
1061
  /**
988
1062
  * Listen to this event to create a recommendations grid using the data passed with the event.
@@ -1037,7 +1111,6 @@ declare type PlayerCustomEventsOverloads = {
1037
1111
  /* Excluded from this release type: emit */
1038
1112
  /* Excluded from this release type: emit */
1039
1113
  /* Excluded from this release type: emit */
1040
- /* Excluded from this release type: emit */
1041
1114
  };
1042
1115
 
1043
1116
  declare type PlayerEmittableCustomEventsDetailMap = {
@@ -1045,7 +1118,6 @@ declare type PlayerEmittableCustomEventsDetailMap = {
1045
1118
  [CONTEXT_MENU]: ContextMenuEventDetail;
1046
1119
  [VIEW_ENTER]: ViewEnterEventDetail;
1047
1120
  [VIEW_LEAVE]: ViewLeaveEventDetail;
1048
- [QUALITIES]: QualitiesEventDetail;
1049
1121
  [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1050
1122
  };
1051
1123
 
@@ -1138,7 +1210,7 @@ PORTRAIT = "portrait";
1138
1210
  * The Animated Previews plugin adds an animated image showing a preview snippet of the VOD content.
1139
1211
  * See {@link https://developer.wowza.com/docs/wowza-flowplayer/plugins/animated-previews/| Official Documentation}
1140
1212
  */
1141
- declare const Preview: PluginCtor<PreviewConfig, Player> & PreviewAPI;
1213
+ declare const Preview: PluginCtor<NoInfer<PreviewConfig>, NoInfer<Player>> & NoInfer<PreviewAPI>;
1142
1214
  export default Preview;
1143
1215
 
1144
1216
  /**
@@ -1217,11 +1289,16 @@ PROGRESS = "progress";
1217
1289
  /**
1218
1290
  * @public
1219
1291
  */
1220
- declare type QselOption = {
1221
- height: number;
1292
+ declare type QselOption = (Level & {
1222
1293
  level: number;
1223
- text: string;
1224
- /* Excluded from this release type: videoCodec */
1294
+ }) | BitrateInfo | {
1295
+ name: string | number;
1296
+ encodingId: string;
1297
+ spatialLayerId: number;
1298
+ temporalLayerId: number;
1299
+ maxSpatialLayerId: number;
1300
+ maxTemporalLayerId: number;
1301
+ height: number;
1225
1302
  width: number;
1226
1303
  };
1227
1304
 
@@ -1245,9 +1322,29 @@ QUALITIES = "qualities";
1245
1322
  */
1246
1323
  declare type QualitiesEventDetail = QselOption[];
1247
1324
 
1248
- /* Excluded from this release type: _QualitiesEventDetail */
1325
+ /**
1326
+ * @public
1327
+ * emitted whenever the media changes quality
1328
+ */
1329
+ declare const /**
1330
+ @public
1331
+ * when a new player is inserted into the HTML
1332
+ */ /**
1333
+ * @public
1334
+ * emitted whenever the media changes quality
1335
+ */
1336
+ QUALITY_CHANGE = "qualitychange";
1249
1337
 
1250
- /* Excluded from this release type: _QualityDetail */
1338
+ /**
1339
+ * @public
1340
+ */
1341
+ declare type QualityChangeEventDetail = {
1342
+ before: Level | BitrateInfo;
1343
+ after: Level | BitrateInfo;
1344
+ plugin: string;
1345
+ automatic: boolean;
1346
+ downscale: boolean;
1347
+ };
1251
1348
 
1252
1349
  declare enum QualityOpts {
1253
1350
  LOW = 1,
@@ -1453,14 +1550,14 @@ declare type SourceEventDetail = SourceObj;
1453
1550
  /**
1454
1551
  * @public
1455
1552
  */
1456
- declare type SourceObj = {
1553
+ declare type SourceObj<T = unknown> = {
1457
1554
  src?: SourceStr;
1458
1555
  /**
1459
1556
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1460
1557
  */
1461
1558
  type?: string;
1462
1559
  drm?: DRMSourceConfiguration;
1463
- };
1560
+ } & T;
1464
1561
 
1465
1562
  /**
1466
1563
  * @public
@@ -1595,7 +1692,7 @@ declare const TV = "is-tv";
1595
1692
  /**
1596
1693
  * @public
1597
1694
  */
1598
- declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
1695
+ declare type UnsafeSource<SrcMixin = unknown> = SourceStr | SourceObj<SrcMixin> | Array<SourceStr | SourceObj<SrcMixin>>;
1599
1696
 
1600
1697
  /**
1601
1698
  * @public
@@ -1697,9 +1794,6 @@ declare const WILL_PLAY = "will-play";
1697
1794
 
1698
1795
  declare const WILL_SEEK = "will-seek";
1699
1796
 
1700
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = PluginPlayer & {
1701
- opts: PluginConfig;
1702
- setOpts(config: PluginConfig): void;
1703
- };
1797
+ declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1704
1798
 
1705
1799
  export { }
package/plugins/qsel.d.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  /// <reference types="node" />
2
2
 
3
3
  import type { BitrateInfo } from 'dashjs';
4
+ import type { Get } from 'type-fest';
5
+ import type { Level } from 'hls.js';
4
6
  import type { MediaKeyFunc } from 'hls.js';
7
+ import type { SetFieldType } from 'type-fest';
8
+ import type { TupleToUnion } from 'type-fest';
5
9
 
6
10
  /* Excluded from this release type: AnyLoader */
7
11
 
@@ -79,6 +83,26 @@ declare const /**
79
83
  */
80
84
  CLICK = "click";
81
85
 
86
+ /**
87
+ * For plugins that add new properties to all source types, combine their src-mixins into one SourceObject
88
+ * @example
89
+ * ```
90
+ * type Combined = CombineGlobalSrcExtensions<DRMPlugin, PluginWithFooFieldInSrc> // Combined = SourceObject<DRMConfig & FooFieldConfig>
91
+ * ```
92
+ */
93
+ declare type CombineGlobalSrcExtensions<PluginSrcs extends unknown[]> = HasGlobalSrcExtensios<PluginSrcs> extends false ? SourceObj : SourceObj & ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
94
+
95
+ /**
96
+ * For plugins that define a new src type, make a union of all new src.type declarations
97
+ * @example
98
+ * ```
99
+ * type Combined = CombineNewSourceTypes<RTSPlugin, SSAIPlugin> // Combined = DRMConfig | FooFieldConfig
100
+ * ```
101
+ */
102
+ declare type CombineNewSourceTypes<PluginSrcs extends unknown[]> = TupleToUnion<FilterNewSourceTypes<PluginSrcs>>;
103
+
104
+ declare type CombineSrc<PluginSrcs extends unknown[]> = UnsafeSource<CombineGlobalSrcExtensions<PluginSrcs> | (CombineNewSourceTypes<PluginSrcs> & CombineGlobalSrcExtensions<PluginSrcs>)>;
105
+
82
106
  /* Excluded from this release type: Component */
83
107
 
84
108
  /* Excluded from this release type: Components */
@@ -139,6 +163,10 @@ declare interface Config {
139
163
  */
140
164
  declare type ConfigWith<T> = Config & T;
141
165
 
166
+ declare type ConfigWithSourceExtensions<PluginBareConfigs extends unknown[]> = Omit<ConfigWith<ArrayToIntersection<PluginBareConfigs>>, "src"> & {
167
+ src?: CombineSrc<PickSrcExtensions<PluginBareConfigs>>;
168
+ };
169
+
142
170
  /* Excluded from this release type: CONTENT_REAL_LOAD_START */
143
171
 
144
172
  /**
@@ -382,6 +410,7 @@ declare namespace events {
382
410
  SOURCE,
383
411
  REAP,
384
412
  QUALITIES,
413
+ QUALITY_CHANGE,
385
414
  VIDEO_TRACKS,
386
415
  SET_QUALITY,
387
416
  VIDEO_TRACK_SELECT,
@@ -404,8 +433,20 @@ declare namespace events_2 {
404
433
  }
405
434
  }
406
435
 
436
+ declare type ExtractBareConfig<Plugins extends PluginCtor> = Plugins extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
437
+
438
+ declare type ExtractPluginPlayerExtension<Plugin extends PluginCtor> = Plugin extends PluginCtor<infer _uConfigType, PlayerWith<infer PluginPlayer>> ? PluginPlayer : never;
439
+
407
440
  declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
408
441
 
442
+ declare type ExtractSrcExtension<PluginBareConfig> = Get<PluginBareConfig, "src"> extends UnsafeSource<infer SrcMixinType> ? SrcMixinType : never;
443
+
444
+ declare type FilterNewSourceTypes<PluginSrcs extends unknown[]> = {
445
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
446
+ type: string;
447
+ } ? PluginSrcs[Index] : never;
448
+ };
449
+
409
450
  /**
410
451
  * @public
411
452
  */
@@ -448,7 +489,7 @@ declare interface FlowplayerUMD extends FlowplayerUMDBase {
448
489
  * Register plugins in flowplayer
449
490
  * @returns flowplayer instance with registered plugins
450
491
  */
451
- <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<ConfigWith<MergeConfigs<PluginCtors>>, PlayerWith<MergePlayerAPIExtensions<PluginCtors>>>;
492
+ <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<MergeConfigs<PluginCtors>, PlayerWith<MergePlayerExtensions<PluginCtors>>>;
452
493
  }
453
494
 
454
495
  declare interface FlowplayerUMDBase {
@@ -549,6 +590,10 @@ declare const GRABBING = "is-grabbing";
549
590
 
550
591
  declare const HAS_POSTER = "has-poster";
551
592
 
593
+ declare type HasGlobalSrcExtensios<PluginSrcs extends unknown[]> = ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
594
+
595
+ declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnion<PickSrcExtensions<PluginBareConfigs>> extends never ? false : true;
596
+
552
597
  declare const HOVERED = "is-hovered";
553
598
 
554
599
  declare const IN_VIEWPORT = "is-in-viewport";
@@ -658,19 +703,24 @@ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwn
658
703
 
659
704
  declare const LOADING = "is-loading";
660
705
 
661
- declare type MapToConfigs<Arr extends PluginCtor[]> = {
662
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
706
+ declare type MapToBareConfigs<Plugins extends PluginCtor[]> = {
707
+ [PluginType in keyof Plugins]: ExtractBareConfig<Plugins[PluginType]>;
663
708
  };
664
709
 
665
- declare type MapToPlayerApiExtensions<Arr extends PluginCtor[]> = {
666
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer _uConfigType, PlayerWith<infer PlayerAPIExtension>> ? PlayerAPIExtension : never;
710
+ declare type MapToPlayerExtensions<Plugins extends PluginCtor[]> = {
711
+ [PluginIndex in keyof Plugins]: ExtractPluginPlayerExtension<Plugins[PluginIndex]>;
667
712
  };
668
713
 
669
714
  declare const MENU_OPENED = "has-menu-opened";
670
715
 
671
- declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
716
+ /**
717
+ * Combines plugin config and returns a type derived from Config
718
+ */
719
+ declare type MergeConfigs<Plugins extends PluginCtor[]> = MergePluginConfigs<MapToBareConfigs<Plugins>>;
720
+
721
+ declare type MergePlayerExtensions<Plugins extends PluginCtor[]> = ArrayToIntersection<MapToPlayerExtensions<Plugins>>;
672
722
 
673
- declare type MergePlayerAPIExtensions<Arr extends PluginCtor[]> = ArrayToIntersection<MapToPlayerApiExtensions<Arr>>;
723
+ declare type MergePluginConfigs<PluginBareConfigs extends unknown[]> = HasSrcExtensions<PluginBareConfigs> extends true ? ConfigWithSourceExtensions<PluginBareConfigs> : ConfigWith<ArrayToIntersection<PluginBareConfigs>>;
674
724
 
675
725
  /**
676
726
  * @public
@@ -765,8 +815,6 @@ declare const NO_CONTROLS = "no-controls";
765
815
 
766
816
  declare const NO_DVR = "no-timeline";
767
817
 
768
- declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
769
-
770
818
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
771
819
 
772
820
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -785,6 +833,7 @@ declare type OVPMetadata = {
785
833
  category_name?: string;
786
834
  duration?: number;
787
835
  tags?: string;
836
+ playlist_title?: string;
788
837
  };
789
838
 
790
839
  /**
@@ -800,6 +849,26 @@ PAUSE = "pause";
800
849
 
801
850
  declare const PAUSED = "is-paused";
802
851
 
852
+ declare type PickGlobalSrcExtension<PluginSrcs extends unknown[]> = {
853
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
854
+ type: string;
855
+ } ? unknown : PluginSrcs[Index];
856
+ };
857
+
858
+ /**
859
+ * Maps incoming array to the src extension type
860
+ * @example
861
+ * ```
862
+ * PickSrcExtensions<[
863
+ * {configProp: boolean, src: UnsafeSource<{srcProp: boolean}>},
864
+ * {}
865
+ * ]> // = [{srcProp: boolean}, never]
866
+ * ```
867
+ */
868
+ declare type PickSrcExtensions<PluginBareConfigs extends unknown[]> = {
869
+ [PluginType in keyof PluginBareConfigs]: ExtractSrcExtension<PluginBareConfigs[PluginType]>;
870
+ };
871
+
803
872
  /**
804
873
  * @public
805
874
  */
@@ -921,6 +990,8 @@ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap
921
990
  [DVR]: DvrEventDetail;
922
991
  [RETRY]: RetryEventDetail;
923
992
  [RECOVER]: RecoverEventDetail;
993
+ [QUALITIES]: QualitiesEventDetail;
994
+ [QUALITY_CHANGE]: QualityChangeEventDetail;
924
995
  /* Excluded from this release type: audioonlysource */
925
996
  /* Excluded from this release type: renderplugin */
926
997
  /* Excluded from this release type: "seek:queued" */
@@ -977,7 +1048,10 @@ declare type PlayerCustomEventsOverloads = {
977
1048
  * Emitted when the set of underlying qualities has changed.
978
1049
  */
979
1050
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
980
- /* Excluded from this release type: on */
1051
+ /**
1052
+ * Emitted when the media changes quality.
1053
+ */
1054
+ on(event: typeof QUALITY_CHANGE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITY_CHANGE]>) => void): Player;
981
1055
  /* Excluded from this release type: on */
982
1056
  /**
983
1057
  * Listen to this event to create a recommendations grid using the data passed with the event.
@@ -1032,7 +1106,6 @@ declare type PlayerCustomEventsOverloads = {
1032
1106
  /* Excluded from this release type: emit */
1033
1107
  /* Excluded from this release type: emit */
1034
1108
  /* Excluded from this release type: emit */
1035
- /* Excluded from this release type: emit */
1036
1109
  };
1037
1110
 
1038
1111
  declare type PlayerEmittableCustomEventsDetailMap = {
@@ -1040,7 +1113,6 @@ declare type PlayerEmittableCustomEventsDetailMap = {
1040
1113
  [CONTEXT_MENU]: ContextMenuEventDetail;
1041
1114
  [VIEW_ENTER]: ViewEnterEventDetail;
1042
1115
  [VIEW_LEAVE]: ViewLeaveEventDetail;
1043
- [QUALITIES]: QualitiesEventDetail;
1044
1116
  [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1045
1117
  };
1046
1118
 
@@ -1144,7 +1216,7 @@ PROGRESS = "progress";
1144
1216
  * This plugin implements a selection menu for the different quality levels of a multi-rendition stream. This plugin can be used with HLS, MPEG-DASH, and Real-Time Streaming (RTS).
1145
1217
  * See {@link https://developer.wowza.com/docs/wowza-flowplayer/plugins/quality-selection/ |Official Documentation}
1146
1218
  */
1147
- declare const Qsel: PluginCtor<QselConfig, QselPlayer> & QselAPI;
1219
+ declare const Qsel: PluginCtor<NoInfer<QselConfig>, NoInfer<QselPlayer>> & NoInfer<QselAPI>;
1148
1220
  export default Qsel;
1149
1221
 
1150
1222
  /**
@@ -1177,11 +1249,16 @@ export declare type QselEvents = typeof events_2;
1177
1249
  /**
1178
1250
  * @public
1179
1251
  */
1180
- declare type QselOption = {
1181
- height: number;
1252
+ declare type QselOption = (Level & {
1182
1253
  level: number;
1183
- text: string;
1184
- /* Excluded from this release type: videoCodec */
1254
+ }) | BitrateInfo | {
1255
+ name: string | number;
1256
+ encodingId: string;
1257
+ spatialLayerId: number;
1258
+ temporalLayerId: number;
1259
+ maxSpatialLayerId: number;
1260
+ maxTemporalLayerId: number;
1261
+ height: number;
1185
1262
  width: number;
1186
1263
  };
1187
1264
 
@@ -1219,9 +1296,29 @@ QUALITIES = "qualities";
1219
1296
  */
1220
1297
  declare type QualitiesEventDetail = QselOption[];
1221
1298
 
1222
- /* Excluded from this release type: _QualitiesEventDetail */
1299
+ /**
1300
+ * @public
1301
+ * emitted whenever the media changes quality
1302
+ */
1303
+ declare const /**
1304
+ @public
1305
+ * when a new player is inserted into the HTML
1306
+ */ /**
1307
+ * @public
1308
+ * emitted whenever the media changes quality
1309
+ */
1310
+ QUALITY_CHANGE = "qualitychange";
1223
1311
 
1224
- /* Excluded from this release type: _QualityDetail */
1312
+ /**
1313
+ * @public
1314
+ */
1315
+ declare type QualityChangeEventDetail = {
1316
+ before: Level | BitrateInfo;
1317
+ after: Level | BitrateInfo;
1318
+ plugin: string;
1319
+ automatic: boolean;
1320
+ downscale: boolean;
1321
+ };
1225
1322
 
1226
1323
  declare enum QualityOpts {
1227
1324
  LOW = 1,
@@ -1448,14 +1545,14 @@ declare type SourceEventDetail = SourceObj;
1448
1545
  /**
1449
1546
  * @public
1450
1547
  */
1451
- declare type SourceObj = {
1548
+ declare type SourceObj<T = unknown> = {
1452
1549
  src?: SourceStr;
1453
1550
  /**
1454
1551
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1455
1552
  */
1456
1553
  type?: string;
1457
1554
  drm?: DRMSourceConfiguration;
1458
- };
1555
+ } & T;
1459
1556
 
1460
1557
  /**
1461
1558
  * @public
@@ -1586,7 +1683,7 @@ declare const TV = "is-tv";
1586
1683
  /**
1587
1684
  * @public
1588
1685
  */
1589
- declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
1686
+ declare type UnsafeSource<SrcMixin = unknown> = SourceStr | SourceObj<SrcMixin> | Array<SourceStr | SourceObj<SrcMixin>>;
1590
1687
 
1591
1688
  /**
1592
1689
  * @public
@@ -1682,9 +1779,6 @@ declare const WILL_PLAY = "will-play";
1682
1779
 
1683
1780
  declare const WILL_SEEK = "will-seek";
1684
1781
 
1685
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = PluginPlayer & {
1686
- opts: PluginConfig;
1687
- setOpts(config: PluginConfig): void;
1688
- };
1782
+ declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1689
1783
 
1690
1784
  export { }
package/plugins/qsel.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.qsel=t())}(this,(function(){"use strict";function e(e,t,n){const s=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;s.length;){if(null==e)return n;const t=s.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}const t=(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 n="fp-on",s="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=o(),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||(i(),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(e){if(this.className=e.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=e.id||o()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const n=t(this.player,e.summaryIcon);n.setAttribute("tabindex",""),this.summaryEle.append(n)}e.menuTitle&&(this.menuTitle.textContent=e.menuTitle),this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.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((t,s)=>{t.classList.toggle(n,s===e)})}unselect_item(){this.options.forEach(e=>{e.classList.remove(n)})}toggle_visibility(e){this.classList.toggle(s,e),this.menu.style.setProperty("display",e?"none":"flex")}}function i(){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 o(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function l(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}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(i(),this.active_menu=void 0)})),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){}}();var r,a=Object.freeze({__proto__:null,SET_QUALITY:"quality:set",TRACKS:"quality:tracks",SWITCH:"quality:update",QUALITIES:"qualities"});const u=((r=class Qsel{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-quality-menu",FlowplayerMenu)}init(n,s,i){if(!1===n.qsel)return;const o=t(i,"flowplayer-quality-menu");o instanceof FlowplayerMenu&&o.setMenuAttrs({summaryTitle:"HD",menuTitle:i.i18n("qsel.menu_title"),class:"fp-qsel",options_event:r.events.TRACKS,item_selected_event:r.events.SWITCH}),i.on("mount",(function(){var e;null===(e=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(i,i.hasState("is-tv")?"flowplayer-tv-menu":"flowplayer-control"))||void 0===e||e.append(o)})),i.on("qualities",t=>{if(!Array.isArray(t.detail))return;const s=t.detail,a=e(n,"qsel.labels",[]);l(o,r.events.TRACKS,s.flatMap((e,t)=>{if("boolean"==typeof a[t]&&!a[t])return[];let n=e.height?e.height+"p":e.text;return"number"==typeof e.height&&e.height>719&&(n+=" HD"),{text:a[t]||n,onclick:c.bind(0,i,e)}})),o instanceof FlowplayerMenu&&o.toggle_visibility(s.length<2)})}}).events=a,r);function c(e,t){e.emit("quality:set",t)}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,u)}));
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.qsel=t())}(this,(function(){"use strict";function e(e,t,n){const s=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;s.length;){if(null==e)return n;const t=s.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}const t=(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 n="fp-on",s="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=o(),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||(i(),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(e){if(this.className=e.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=e.id||o()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const n=t(this.player,e.summaryIcon);n.setAttribute("tabindex",""),this.summaryEle.append(n)}e.menuTitle&&(this.menuTitle.textContent=e.menuTitle),this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.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((t,s)=>{t.classList.toggle(n,s===e)})}unselect_item(){this.options.forEach(e=>{e.classList.remove(n)})}toggle_visibility(e){this.classList.toggle(s,e),this.menu.style.setProperty("display",e?"none":"flex")}}function i(){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 o(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function l(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}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(i(),this.active_menu=void 0)})),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){}}();var r,a=Object.freeze({__proto__:null,SET_QUALITY:"quality:set",TRACKS:"quality:tracks",SWITCH:"quality:update",QUALITIES:"qualities"});const u=((r=class Qsel{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-quality-menu",FlowplayerMenu)}init(n,s,i){if(!1===n.qsel)return;const o=t(i,"flowplayer-quality-menu");o instanceof FlowplayerMenu&&o.setMenuAttrs({summaryTitle:"HD",menuTitle:i.i18n("qsel.menu_title"),class:"fp-qsel",options_event:r.events.TRACKS,item_selected_event:r.events.SWITCH}),i.on("mount",(function(){var e;null===(e=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(i,i.hasState("is-tv")?"flowplayer-tv-menu":"flowplayer-control"))||void 0===e||e.append(o)})),i.on("qualities",t=>{if(!Array.isArray(t.detail))return;const s=t.detail,a=e(n,"qsel.labels",[]);l(o,r.events.TRACKS,s.flatMap((e,t)=>"boolean"!=typeof a[t]||a[t]?{text:m(e,a[t]),onclick:c.bind(0,i,e)}:[])),o instanceof FlowplayerMenu&&o.toggle_visibility(s.length<2)})}}).events=a,r);function c(e,t){e.emit("quality:set",t)}function m(e,t){return t||(e.height?`${e.height}p${e.height>719?" HD":""}`:e.width?`${e.width}p${e.height>1279?" HD":""}`:"name"in e&&e.name?e.name:"0p")}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,u)}));