@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
@@ -758,8 +808,6 @@ declare const NO_CONTROLS = "no-controls";
758
808
 
759
809
  declare const NO_DVR = "no-timeline";
760
810
 
761
- declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
762
-
763
811
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
764
812
 
765
813
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -778,6 +826,7 @@ declare type OVPMetadata = {
778
826
  category_name?: string;
779
827
  duration?: number;
780
828
  tags?: string;
829
+ playlist_title?: string;
781
830
  };
782
831
 
783
832
  /**
@@ -793,6 +842,26 @@ PAUSE = "pause";
793
842
 
794
843
  declare const PAUSED = "is-paused";
795
844
 
845
+ declare type PickGlobalSrcExtension<PluginSrcs extends unknown[]> = {
846
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
847
+ type: string;
848
+ } ? unknown : PluginSrcs[Index];
849
+ };
850
+
851
+ /**
852
+ * Maps incoming array to the src extension type
853
+ * @example
854
+ * ```
855
+ * PickSrcExtensions<[
856
+ * {configProp: boolean, src: UnsafeSource<{srcProp: boolean}>},
857
+ * {}
858
+ * ]> // = [{srcProp: boolean}, never]
859
+ * ```
860
+ */
861
+ declare type PickSrcExtensions<PluginBareConfigs extends unknown[]> = {
862
+ [PluginType in keyof PluginBareConfigs]: ExtractSrcExtension<PluginBareConfigs[PluginType]>;
863
+ };
864
+
796
865
  /**
797
866
  * @public
798
867
  */
@@ -914,6 +983,8 @@ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap
914
983
  [DVR]: DvrEventDetail;
915
984
  [RETRY]: RetryEventDetail;
916
985
  [RECOVER]: RecoverEventDetail;
986
+ [QUALITIES]: QualitiesEventDetail;
987
+ [QUALITY_CHANGE]: QualityChangeEventDetail;
917
988
  /* Excluded from this release type: audioonlysource */
918
989
  /* Excluded from this release type: renderplugin */
919
990
  /* Excluded from this release type: "seek:queued" */
@@ -970,7 +1041,10 @@ declare type PlayerCustomEventsOverloads = {
970
1041
  * Emitted when the set of underlying qualities has changed.
971
1042
  */
972
1043
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
973
- /* Excluded from this release type: on */
1044
+ /**
1045
+ * Emitted when the media changes quality.
1046
+ */
1047
+ on(event: typeof QUALITY_CHANGE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITY_CHANGE]>) => void): Player;
974
1048
  /* Excluded from this release type: on */
975
1049
  /**
976
1050
  * Listen to this event to create a recommendations grid using the data passed with the event.
@@ -1025,7 +1099,6 @@ declare type PlayerCustomEventsOverloads = {
1025
1099
  /* Excluded from this release type: emit */
1026
1100
  /* Excluded from this release type: emit */
1027
1101
  /* Excluded from this release type: emit */
1028
- /* Excluded from this release type: emit */
1029
1102
  };
1030
1103
 
1031
1104
  declare type PlayerEmittableCustomEventsDetailMap = {
@@ -1033,7 +1106,6 @@ declare type PlayerEmittableCustomEventsDetailMap = {
1033
1106
  [CONTEXT_MENU]: ContextMenuEventDetail;
1034
1107
  [VIEW_ENTER]: ViewEnterEventDetail;
1035
1108
  [VIEW_LEAVE]: ViewLeaveEventDetail;
1036
- [QUALITIES]: QualitiesEventDetail;
1037
1109
  [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1038
1110
  };
1039
1111
 
@@ -1135,11 +1207,16 @@ PROGRESS = "progress";
1135
1207
  /**
1136
1208
  * @public
1137
1209
  */
1138
- declare type QselOption = {
1139
- height: number;
1210
+ declare type QselOption = (Level & {
1140
1211
  level: number;
1141
- text: string;
1142
- /* Excluded from this release type: videoCodec */
1212
+ }) | BitrateInfo | {
1213
+ name: string | number;
1214
+ encodingId: string;
1215
+ spatialLayerId: number;
1216
+ temporalLayerId: number;
1217
+ maxSpatialLayerId: number;
1218
+ maxTemporalLayerId: number;
1219
+ height: number;
1143
1220
  width: number;
1144
1221
  };
1145
1222
 
@@ -1163,9 +1240,29 @@ QUALITIES = "qualities";
1163
1240
  */
1164
1241
  declare type QualitiesEventDetail = QselOption[];
1165
1242
 
1166
- /* Excluded from this release type: _QualitiesEventDetail */
1243
+ /**
1244
+ * @public
1245
+ * emitted whenever the media changes quality
1246
+ */
1247
+ declare const /**
1248
+ @public
1249
+ * when a new player is inserted into the HTML
1250
+ */ /**
1251
+ * @public
1252
+ * emitted whenever the media changes quality
1253
+ */
1254
+ QUALITY_CHANGE = "qualitychange";
1167
1255
 
1168
- /* Excluded from this release type: _QualityDetail */
1256
+ /**
1257
+ * @public
1258
+ */
1259
+ declare type QualityChangeEventDetail = {
1260
+ before: Level | BitrateInfo;
1261
+ after: Level | BitrateInfo;
1262
+ plugin: string;
1263
+ automatic: boolean;
1264
+ downscale: boolean;
1265
+ };
1169
1266
 
1170
1267
  declare enum QualityOpts {
1171
1268
  LOW = 1,
@@ -1371,14 +1468,14 @@ declare type SourceEventDetail = SourceObj;
1371
1468
  /**
1372
1469
  * @public
1373
1470
  */
1374
- declare type SourceObj = {
1471
+ declare type SourceObj<T = unknown> = {
1375
1472
  src?: SourceStr;
1376
1473
  /**
1377
1474
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1378
1475
  */
1379
1476
  type?: string;
1380
1477
  drm?: DRMSourceConfiguration;
1381
- };
1478
+ } & T;
1382
1479
 
1383
1480
  /**
1384
1481
  * @public
@@ -1505,7 +1602,7 @@ declare const TV = "is-tv";
1505
1602
  /**
1506
1603
  * @public
1507
1604
  */
1508
- declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
1605
+ declare type UnsafeSource<SrcMixin = unknown> = SourceStr | SourceObj<SrcMixin> | Array<SourceStr | SourceObj<SrcMixin>>;
1509
1606
 
1510
1607
  /**
1511
1608
  * @public
@@ -1598,7 +1695,7 @@ WAITING_2 = "waiting";
1598
1695
  /**
1599
1696
  * @public
1600
1697
  */
1601
- declare const Webos: PluginCtor<WebosConfig, Player>;
1698
+ declare const Webos: PluginCtor<NoInfer<WebosConfig>, NoInfer<Player>>;
1602
1699
  export default Webos;
1603
1700
 
1604
1701
  declare type WebosConfig = ConfigWith<{
@@ -1613,9 +1710,6 @@ declare const WILL_PLAY = "will-play";
1613
1710
 
1614
1711
  declare const WILL_SEEK = "will-seek";
1615
1712
 
1616
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = PluginPlayer & {
1617
- opts: PluginConfig;
1618
- setOpts(config: PluginConfig): void;
1619
- };
1713
+ declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1620
1714
 
1621
1715
  export { }
package/util/loader.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
  /**
@@ -234,7 +262,7 @@ DBL_CLICK = "dblclick";
234
262
  * issue/127
235
263
  */
236
264
  export declare function define<PluginConfig extends Config = Config, PluginPlayer extends Player = Player, PublicAPI = unknown>(root: any, // TODO type this to PlayerRoot
237
- plugin: PluginCtor<NoInfer_2<PluginConfig>, NoInfer_2<PluginPlayer>> & NoInfer_2<PublicAPI>): typeof plugin;
265
+ plugin: PluginCtor<NoInfer<PluginConfig>, NoInfer<PluginPlayer>> & NoInfer<PublicAPI>): typeof plugin;
238
266
 
239
267
  declare const DESTROYED = "is-destroyed";
240
268
 
@@ -390,6 +418,7 @@ declare namespace events {
390
418
  SOURCE,
391
419
  REAP,
392
420
  QUALITIES,
421
+ QUALITY_CHANGE,
393
422
  VIDEO_TRACKS,
394
423
  SET_QUALITY,
395
424
  VIDEO_TRACK_SELECT,
@@ -405,8 +434,20 @@ declare namespace events {
405
434
  }
406
435
  }
407
436
 
437
+ declare type ExtractBareConfig<Plugins extends PluginCtor> = Plugins extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
438
+
439
+ declare type ExtractPluginPlayerExtension<Plugin extends PluginCtor> = Plugin extends PluginCtor<infer _uConfigType, PlayerWith<infer PluginPlayer>> ? PluginPlayer : never;
440
+
408
441
  declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
409
442
 
443
+ declare type ExtractSrcExtension<PluginBareConfig> = Get<PluginBareConfig, "src"> extends UnsafeSource<infer SrcMixinType> ? SrcMixinType : never;
444
+
445
+ declare type FilterNewSourceTypes<PluginSrcs extends unknown[]> = {
446
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
447
+ type: string;
448
+ } ? PluginSrcs[Index] : never;
449
+ };
450
+
410
451
  /**
411
452
  * @public
412
453
  */
@@ -449,7 +490,7 @@ declare interface FlowplayerUMD extends FlowplayerUMDBase {
449
490
  * Register plugins in flowplayer
450
491
  * @returns flowplayer instance with registered plugins
451
492
  */
452
- <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<ConfigWith<MergeConfigs<PluginCtors>>, PlayerWith<MergePlayerAPIExtensions<PluginCtors>>>;
493
+ <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<MergeConfigs<PluginCtors>, PlayerWith<MergePlayerExtensions<PluginCtors>>>;
453
494
  }
454
495
 
455
496
  declare interface FlowplayerUMDBase {
@@ -550,6 +591,10 @@ declare const GRABBING = "is-grabbing";
550
591
 
551
592
  declare const HAS_POSTER = "has-poster";
552
593
 
594
+ declare type HasGlobalSrcExtensios<PluginSrcs extends unknown[]> = ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
595
+
596
+ declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnion<PickSrcExtensions<PluginBareConfigs>> extends never ? false : true;
597
+
553
598
  declare const HOVERED = "is-hovered";
554
599
 
555
600
  declare const IN_VIEWPORT = "is-in-viewport";
@@ -664,19 +709,24 @@ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwn
664
709
 
665
710
  declare const LOADING = "is-loading";
666
711
 
667
- declare type MapToConfigs<Arr extends PluginCtor[]> = {
668
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
712
+ declare type MapToBareConfigs<Plugins extends PluginCtor[]> = {
713
+ [PluginType in keyof Plugins]: ExtractBareConfig<Plugins[PluginType]>;
669
714
  };
670
715
 
671
- declare type MapToPlayerApiExtensions<Arr extends PluginCtor[]> = {
672
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer _uConfigType, PlayerWith<infer PlayerAPIExtension>> ? PlayerAPIExtension : never;
716
+ declare type MapToPlayerExtensions<Plugins extends PluginCtor[]> = {
717
+ [PluginIndex in keyof Plugins]: ExtractPluginPlayerExtension<Plugins[PluginIndex]>;
673
718
  };
674
719
 
675
720
  declare const MENU_OPENED = "has-menu-opened";
676
721
 
677
- declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
722
+ /**
723
+ * Combines plugin config and returns a type derived from Config
724
+ */
725
+ declare type MergeConfigs<Plugins extends PluginCtor[]> = MergePluginConfigs<MapToBareConfigs<Plugins>>;
726
+
727
+ declare type MergePlayerExtensions<Plugins extends PluginCtor[]> = ArrayToIntersection<MapToPlayerExtensions<Plugins>>;
678
728
 
679
- declare type MergePlayerAPIExtensions<Arr extends PluginCtor[]> = ArrayToIntersection<MapToPlayerApiExtensions<Arr>>;
729
+ declare type MergePluginConfigs<PluginBareConfigs extends unknown[]> = HasSrcExtensions<PluginBareConfigs> extends true ? ConfigWithSourceExtensions<PluginBareConfigs> : ConfigWith<ArrayToIntersection<PluginBareConfigs>>;
680
730
 
681
731
  /**
682
732
  * @public
@@ -776,8 +826,6 @@ declare const NO_CONTROLS = "no-controls";
776
826
 
777
827
  declare const NO_DVR = "no-timeline";
778
828
 
779
- declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
780
-
781
829
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
782
830
 
783
831
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -796,6 +844,7 @@ declare type OVPMetadata = {
796
844
  category_name?: string;
797
845
  duration?: number;
798
846
  tags?: string;
847
+ playlist_title?: string;
799
848
  };
800
849
 
801
850
  /**
@@ -811,6 +860,26 @@ PAUSE = "pause";
811
860
 
812
861
  declare const PAUSED = "is-paused";
813
862
 
863
+ declare type PickGlobalSrcExtension<PluginSrcs extends unknown[]> = {
864
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
865
+ type: string;
866
+ } ? unknown : PluginSrcs[Index];
867
+ };
868
+
869
+ /**
870
+ * Maps incoming array to the src extension type
871
+ * @example
872
+ * ```
873
+ * PickSrcExtensions<[
874
+ * {configProp: boolean, src: UnsafeSource<{srcProp: boolean}>},
875
+ * {}
876
+ * ]> // = [{srcProp: boolean}, never]
877
+ * ```
878
+ */
879
+ declare type PickSrcExtensions<PluginBareConfigs extends unknown[]> = {
880
+ [PluginType in keyof PluginBareConfigs]: ExtractSrcExtension<PluginBareConfigs[PluginType]>;
881
+ };
882
+
814
883
  /**
815
884
  * @public
816
885
  */
@@ -932,6 +1001,8 @@ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap
932
1001
  [DVR]: DvrEventDetail;
933
1002
  [RETRY]: RetryEventDetail;
934
1003
  [RECOVER]: RecoverEventDetail;
1004
+ [QUALITIES]: QualitiesEventDetail;
1005
+ [QUALITY_CHANGE]: QualityChangeEventDetail;
935
1006
  /* Excluded from this release type: audioonlysource */
936
1007
  /* Excluded from this release type: renderplugin */
937
1008
  /* Excluded from this release type: "seek:queued" */
@@ -988,7 +1059,10 @@ declare type PlayerCustomEventsOverloads = {
988
1059
  * Emitted when the set of underlying qualities has changed.
989
1060
  */
990
1061
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
991
- /* Excluded from this release type: on */
1062
+ /**
1063
+ * Emitted when the media changes quality.
1064
+ */
1065
+ on(event: typeof QUALITY_CHANGE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITY_CHANGE]>) => void): Player;
992
1066
  /* Excluded from this release type: on */
993
1067
  /**
994
1068
  * Listen to this event to create a recommendations grid using the data passed with the event.
@@ -1043,7 +1117,6 @@ declare type PlayerCustomEventsOverloads = {
1043
1117
  /* Excluded from this release type: emit */
1044
1118
  /* Excluded from this release type: emit */
1045
1119
  /* Excluded from this release type: emit */
1046
- /* Excluded from this release type: emit */
1047
1120
  };
1048
1121
 
1049
1122
  declare type PlayerEmittableCustomEventsDetailMap = {
@@ -1051,7 +1124,6 @@ declare type PlayerEmittableCustomEventsDetailMap = {
1051
1124
  [CONTEXT_MENU]: ContextMenuEventDetail;
1052
1125
  [VIEW_ENTER]: ViewEnterEventDetail;
1053
1126
  [VIEW_LEAVE]: ViewLeaveEventDetail;
1054
- [QUALITIES]: QualitiesEventDetail;
1055
1127
  [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1056
1128
  };
1057
1129
 
@@ -1153,11 +1225,16 @@ PROGRESS = "progress";
1153
1225
  /**
1154
1226
  * @public
1155
1227
  */
1156
- declare type QselOption = {
1157
- height: number;
1228
+ declare type QselOption = (Level & {
1158
1229
  level: number;
1159
- text: string;
1160
- /* Excluded from this release type: videoCodec */
1230
+ }) | BitrateInfo | {
1231
+ name: string | number;
1232
+ encodingId: string;
1233
+ spatialLayerId: number;
1234
+ temporalLayerId: number;
1235
+ maxSpatialLayerId: number;
1236
+ maxTemporalLayerId: number;
1237
+ height: number;
1161
1238
  width: number;
1162
1239
  };
1163
1240
 
@@ -1181,9 +1258,29 @@ QUALITIES = "qualities";
1181
1258
  */
1182
1259
  declare type QualitiesEventDetail = QselOption[];
1183
1260
 
1184
- /* Excluded from this release type: _QualitiesEventDetail */
1261
+ /**
1262
+ * @public
1263
+ * emitted whenever the media changes quality
1264
+ */
1265
+ declare const /**
1266
+ @public
1267
+ * when a new player is inserted into the HTML
1268
+ */ /**
1269
+ * @public
1270
+ * emitted whenever the media changes quality
1271
+ */
1272
+ QUALITY_CHANGE = "qualitychange";
1185
1273
 
1186
- /* Excluded from this release type: _QualityDetail */
1274
+ /**
1275
+ * @public
1276
+ */
1277
+ declare type QualityChangeEventDetail = {
1278
+ before: Level | BitrateInfo;
1279
+ after: Level | BitrateInfo;
1280
+ plugin: string;
1281
+ automatic: boolean;
1282
+ downscale: boolean;
1283
+ };
1187
1284
 
1188
1285
  declare enum QualityOpts {
1189
1286
  LOW = 1,
@@ -1394,14 +1491,14 @@ declare type SourceEventDetail = SourceObj;
1394
1491
  /**
1395
1492
  * @public
1396
1493
  */
1397
- declare type SourceObj = {
1494
+ declare type SourceObj<T = unknown> = {
1398
1495
  src?: SourceStr;
1399
1496
  /**
1400
1497
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1401
1498
  */
1402
1499
  type?: string;
1403
1500
  drm?: DRMSourceConfiguration;
1404
- };
1501
+ } & T;
1405
1502
 
1406
1503
  /**
1407
1504
  * @public
@@ -1528,7 +1625,7 @@ declare const TV = "is-tv";
1528
1625
  /**
1529
1626
  * @public
1530
1627
  */
1531
- declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
1628
+ declare type UnsafeSource<SrcMixin = unknown> = SourceStr | SourceObj<SrcMixin> | Array<SourceStr | SourceObj<SrcMixin>>;
1532
1629
 
1533
1630
  /**
1534
1631
  * @public
@@ -1624,9 +1721,6 @@ declare const WILL_PLAY = "will-play";
1624
1721
 
1625
1722
  declare const WILL_SEEK = "will-seek";
1626
1723
 
1627
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = PluginPlayer & {
1628
- opts: PluginConfig;
1629
- setOpts(config: PluginConfig): void;
1630
- };
1724
+ declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1631
1725
 
1632
1726
  export { }
package/util/loader.js CHANGED
@@ -43,7 +43,6 @@ exports.isESM = isESM;
43
43
  function root() {
44
44
  if (typeof window !== "undefined")
45
45
  return window;
46
- // eslint-disable-next-line no-undef
47
46
  if (typeof global !== "undefined")
48
47
  return global;
49
48
  return {};