@flowplayer/player 3.19.0 → 3.20.0-rc.5

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
package/plugins/dash.d.ts CHANGED
@@ -2,10 +2,14 @@
2
2
 
3
3
  import type { BitrateInfo } from 'dashjs';
4
4
  import type * as DashJS from 'dashjs';
5
+ import type { Get } from 'type-fest';
6
+ import type { Level } from 'hls.js';
5
7
  import type { MediaKeyFunc } from 'hls.js';
6
8
  import type { MediaPlayerClass } from 'dashjs';
7
9
  import type { MediaSettings } from 'dashjs';
8
10
  import type { ProtectionDataSet } from 'dashjs';
11
+ import type { SetFieldType } from 'type-fest';
12
+ import type { TupleToUnion } from 'type-fest';
9
13
 
10
14
  declare namespace allEvents {
11
15
  export {
@@ -95,6 +99,26 @@ declare const /**
95
99
  */
96
100
  CLICK = "click";
97
101
 
102
+ /**
103
+ * For plugins that add new properties to all source types, combine their src-mixins into one SourceObject
104
+ * @example
105
+ * ```
106
+ * type Combined = CombineGlobalSrcExtensions<DRMPlugin, PluginWithFooFieldInSrc> // Combined = SourceObject<DRMConfig & FooFieldConfig>
107
+ * ```
108
+ */
109
+ declare type CombineGlobalSrcExtensions<PluginSrcs extends unknown[]> = HasGlobalSrcExtensios<PluginSrcs> extends false ? SourceObj : SourceObj & ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
110
+
111
+ /**
112
+ * For plugins that define a new src type, make a union of all new src.type declarations
113
+ * @example
114
+ * ```
115
+ * type Combined = CombineNewSourceTypes<RTSPlugin, SSAIPlugin> // Combined = DRMConfig | FooFieldConfig
116
+ * ```
117
+ */
118
+ declare type CombineNewSourceTypes<PluginSrcs extends unknown[]> = TupleToUnion<FilterNewSourceTypes<PluginSrcs>>;
119
+
120
+ declare type CombineSrc<PluginSrcs extends unknown[]> = UnsafeSource<CombineGlobalSrcExtensions<PluginSrcs> | (CombineNewSourceTypes<PluginSrcs> & CombineGlobalSrcExtensions<PluginSrcs>)>;
121
+
98
122
  /* Excluded from this release type: Component */
99
123
 
100
124
  /* Excluded from this release type: Components */
@@ -155,6 +179,10 @@ declare interface Config {
155
179
  */
156
180
  declare type ConfigWith<T> = Config & T;
157
181
 
182
+ declare type ConfigWithSourceExtensions<PluginBareConfigs extends unknown[]> = Omit<ConfigWith<ArrayToIntersection<PluginBareConfigs>>, "src"> & {
183
+ src?: CombineSrc<PickSrcExtensions<PluginBareConfigs>>;
184
+ };
185
+
158
186
  /* Excluded from this release type: CONTENT_REAL_LOAD_START */
159
187
 
160
188
  /**
@@ -449,6 +477,7 @@ declare namespace events {
449
477
  SOURCE,
450
478
  REAP,
451
479
  QUALITIES,
480
+ QUALITY_CHANGE,
452
481
  VIDEO_TRACKS,
453
482
  SET_QUALITY,
454
483
  VIDEO_TRACK_SELECT,
@@ -464,8 +493,20 @@ declare namespace events {
464
493
  }
465
494
  }
466
495
 
496
+ declare type ExtractBareConfig<Plugins extends PluginCtor> = Plugins extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
497
+
498
+ declare type ExtractPluginPlayerExtension<Plugin extends PluginCtor> = Plugin extends PluginCtor<infer _uConfigType, PlayerWith<infer PluginPlayer>> ? PluginPlayer : never;
499
+
467
500
  declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
468
501
 
502
+ declare type ExtractSrcExtension<PluginBareConfig> = Get<PluginBareConfig, "src"> extends UnsafeSource<infer SrcMixinType> ? SrcMixinType : never;
503
+
504
+ declare type FilterNewSourceTypes<PluginSrcs extends unknown[]> = {
505
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
506
+ type: string;
507
+ } ? PluginSrcs[Index] : never;
508
+ };
509
+
469
510
  /**
470
511
  * @public
471
512
  */
@@ -508,7 +549,7 @@ declare interface FlowplayerUMD extends FlowplayerUMDBase {
508
549
  * Register plugins in flowplayer
509
550
  * @returns flowplayer instance with registered plugins
510
551
  */
511
- <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<ConfigWith<MergeConfigs<PluginCtors>>, PlayerWith<MergePlayerAPIExtensions<PluginCtors>>>;
552
+ <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<MergeConfigs<PluginCtors>, PlayerWith<MergePlayerExtensions<PluginCtors>>>;
512
553
  }
513
554
 
514
555
  declare interface FlowplayerUMDBase {
@@ -609,6 +650,10 @@ declare const GRABBING = "is-grabbing";
609
650
 
610
651
  declare const HAS_POSTER = "has-poster";
611
652
 
653
+ declare type HasGlobalSrcExtensios<PluginSrcs extends unknown[]> = ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
654
+
655
+ declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnion<PickSrcExtensions<PluginBareConfigs>> extends never ? false : true;
656
+
612
657
  declare const HOVERED = "is-hovered";
613
658
 
614
659
  declare const IN_VIEWPORT = "is-in-viewport";
@@ -718,19 +763,24 @@ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwn
718
763
 
719
764
  declare const LOADING = "is-loading";
720
765
 
721
- declare type MapToConfigs<Arr extends PluginCtor[]> = {
722
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
766
+ declare type MapToBareConfigs<Plugins extends PluginCtor[]> = {
767
+ [PluginType in keyof Plugins]: ExtractBareConfig<Plugins[PluginType]>;
723
768
  };
724
769
 
725
- declare type MapToPlayerApiExtensions<Arr extends PluginCtor[]> = {
726
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer _uConfigType, PlayerWith<infer PlayerAPIExtension>> ? PlayerAPIExtension : never;
770
+ declare type MapToPlayerExtensions<Plugins extends PluginCtor[]> = {
771
+ [PluginIndex in keyof Plugins]: ExtractPluginPlayerExtension<Plugins[PluginIndex]>;
727
772
  };
728
773
 
729
774
  declare const MENU_OPENED = "has-menu-opened";
730
775
 
731
- declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
776
+ /**
777
+ * Combines plugin config and returns a type derived from Config
778
+ */
779
+ declare type MergeConfigs<Plugins extends PluginCtor[]> = MergePluginConfigs<MapToBareConfigs<Plugins>>;
780
+
781
+ declare type MergePlayerExtensions<Plugins extends PluginCtor[]> = ArrayToIntersection<MapToPlayerExtensions<Plugins>>;
732
782
 
733
- declare type MergePlayerAPIExtensions<Arr extends PluginCtor[]> = ArrayToIntersection<MapToPlayerApiExtensions<Arr>>;
783
+ declare type MergePluginConfigs<PluginBareConfigs extends unknown[]> = HasSrcExtensions<PluginBareConfigs> extends true ? ConfigWithSourceExtensions<PluginBareConfigs> : ConfigWith<ArrayToIntersection<PluginBareConfigs>>;
734
784
 
735
785
  /**
736
786
  * @public
@@ -825,8 +875,6 @@ declare const NO_CONTROLS = "no-controls";
825
875
 
826
876
  declare const NO_DVR = "no-timeline";
827
877
 
828
- declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
829
-
830
878
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
831
879
 
832
880
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -845,6 +893,7 @@ declare type OVPMetadata = {
845
893
  category_name?: string;
846
894
  duration?: number;
847
895
  tags?: string;
896
+ playlist_title?: string;
848
897
  };
849
898
 
850
899
  /**
@@ -860,6 +909,26 @@ PAUSE = "pause";
860
909
 
861
910
  declare const PAUSED = "is-paused";
862
911
 
912
+ declare type PickGlobalSrcExtension<PluginSrcs extends unknown[]> = {
913
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
914
+ type: string;
915
+ } ? unknown : PluginSrcs[Index];
916
+ };
917
+
918
+ /**
919
+ * Maps incoming array to the src extension type
920
+ * @example
921
+ * ```
922
+ * PickSrcExtensions<[
923
+ * {configProp: boolean, src: UnsafeSource<{srcProp: boolean}>},
924
+ * {}
925
+ * ]> // = [{srcProp: boolean}, never]
926
+ * ```
927
+ */
928
+ declare type PickSrcExtensions<PluginBareConfigs extends unknown[]> = {
929
+ [PluginType in keyof PluginBareConfigs]: ExtractSrcExtension<PluginBareConfigs[PluginType]>;
930
+ };
931
+
863
932
  /**
864
933
  * @public
865
934
  */
@@ -981,6 +1050,8 @@ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap
981
1050
  [DVR]: DvrEventDetail;
982
1051
  [RETRY]: RetryEventDetail;
983
1052
  [RECOVER]: RecoverEventDetail;
1053
+ [QUALITIES]: QualitiesEventDetail;
1054
+ [QUALITY_CHANGE]: QualityChangeEventDetail;
984
1055
  /* Excluded from this release type: audioonlysource */
985
1056
  /* Excluded from this release type: renderplugin */
986
1057
  /* Excluded from this release type: "seek:queued" */
@@ -1037,7 +1108,10 @@ declare type PlayerCustomEventsOverloads = {
1037
1108
  * Emitted when the set of underlying qualities has changed.
1038
1109
  */
1039
1110
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
1040
- /* Excluded from this release type: on */
1111
+ /**
1112
+ * Emitted when the media changes quality.
1113
+ */
1114
+ on(event: typeof QUALITY_CHANGE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITY_CHANGE]>) => void): Player;
1041
1115
  /* Excluded from this release type: on */
1042
1116
  /**
1043
1117
  * Listen to this event to create a recommendations grid using the data passed with the event.
@@ -1092,7 +1166,6 @@ declare type PlayerCustomEventsOverloads = {
1092
1166
  /* Excluded from this release type: emit */
1093
1167
  /* Excluded from this release type: emit */
1094
1168
  /* Excluded from this release type: emit */
1095
- /* Excluded from this release type: emit */
1096
1169
  };
1097
1170
 
1098
1171
  declare type PlayerEmittableCustomEventsDetailMap = {
@@ -1100,7 +1173,6 @@ declare type PlayerEmittableCustomEventsDetailMap = {
1100
1173
  [CONTEXT_MENU]: ContextMenuEventDetail;
1101
1174
  [VIEW_ENTER]: ViewEnterEventDetail;
1102
1175
  [VIEW_LEAVE]: ViewLeaveEventDetail;
1103
- [QUALITIES]: QualitiesEventDetail;
1104
1176
  [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1105
1177
  };
1106
1178
 
@@ -1202,11 +1274,16 @@ PROGRESS = "progress";
1202
1274
  /**
1203
1275
  * @public
1204
1276
  */
1205
- declare type QselOption = {
1206
- height: number;
1277
+ declare type QselOption = (Level & {
1207
1278
  level: number;
1208
- text: string;
1209
- /* Excluded from this release type: videoCodec */
1279
+ }) | BitrateInfo | {
1280
+ name: string | number;
1281
+ encodingId: string;
1282
+ spatialLayerId: number;
1283
+ temporalLayerId: number;
1284
+ maxSpatialLayerId: number;
1285
+ maxTemporalLayerId: number;
1286
+ height: number;
1210
1287
  width: number;
1211
1288
  };
1212
1289
 
@@ -1230,9 +1307,29 @@ QUALITIES = "qualities";
1230
1307
  */
1231
1308
  declare type QualitiesEventDetail = QselOption[];
1232
1309
 
1233
- /* Excluded from this release type: _QualitiesEventDetail */
1310
+ /**
1311
+ * @public
1312
+ * emitted whenever the media changes quality
1313
+ */
1314
+ declare const /**
1315
+ @public
1316
+ * when a new player is inserted into the HTML
1317
+ */ /**
1318
+ * @public
1319
+ * emitted whenever the media changes quality
1320
+ */
1321
+ QUALITY_CHANGE = "qualitychange";
1234
1322
 
1235
- /* Excluded from this release type: _QualityDetail */
1323
+ /**
1324
+ * @public
1325
+ */
1326
+ declare type QualityChangeEventDetail = {
1327
+ before: Level | BitrateInfo;
1328
+ after: Level | BitrateInfo;
1329
+ plugin: string;
1330
+ automatic: boolean;
1331
+ downscale: boolean;
1332
+ };
1236
1333
 
1237
1334
  declare enum QualityOpts {
1238
1335
  LOW = 1,
@@ -1438,14 +1535,14 @@ declare type SourceEventDetail = SourceObj;
1438
1535
  /**
1439
1536
  * @public
1440
1537
  */
1441
- declare type SourceObj = {
1538
+ declare type SourceObj<T = unknown> = {
1442
1539
  src?: SourceStr;
1443
1540
  /**
1444
1541
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1445
1542
  */
1446
1543
  type?: string;
1447
1544
  drm?: DRMSourceConfiguration;
1448
- };
1545
+ } & T;
1449
1546
 
1450
1547
  /**
1451
1548
  * @public
@@ -1572,7 +1669,7 @@ declare const TV = "is-tv";
1572
1669
  /**
1573
1670
  * @public
1574
1671
  */
1575
- declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
1672
+ declare type UnsafeSource<SrcMixin = unknown> = SourceStr | SourceObj<SrcMixin> | Array<SourceStr | SourceObj<SrcMixin>>;
1576
1673
 
1577
1674
  /**
1578
1675
  * @public
@@ -1668,9 +1765,6 @@ declare const WILL_PLAY = "will-play";
1668
1765
 
1669
1766
  declare const WILL_SEEK = "will-seek";
1670
1767
 
1671
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = PluginPlayer & {
1672
- opts: PluginConfig;
1673
- setOpts(config: PluginConfig): void;
1674
- };
1768
+ declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1675
1769
 
1676
1770
  export { }