@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 {
@@ -541,13 +582,17 @@ FULLSCREEN_EXIT = "fullscreenexit";
541
582
  /**
542
583
  * @public
543
584
  */
544
- declare const GoogleAnalyticsUA: PluginCtor<Config, Player>;
585
+ declare const GoogleAnalyticsUA: PluginCtor<NoInfer<Config>, NoInfer<Player>>;
545
586
  export default GoogleAnalyticsUA;
546
587
 
547
588
  declare const GRABBING = "is-grabbing";
548
589
 
549
590
  declare const HAS_POSTER = "has-poster";
550
591
 
592
+ declare type HasGlobalSrcExtensios<PluginSrcs extends unknown[]> = ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
593
+
594
+ declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnion<PickSrcExtensions<PluginBareConfigs>> extends never ? false : true;
595
+
551
596
  declare const HOVERED = "is-hovered";
552
597
 
553
598
  declare const IN_VIEWPORT = "is-in-viewport";
@@ -657,19 +702,24 @@ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwn
657
702
 
658
703
  declare const LOADING = "is-loading";
659
704
 
660
- declare type MapToConfigs<Arr extends PluginCtor[]> = {
661
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
705
+ declare type MapToBareConfigs<Plugins extends PluginCtor[]> = {
706
+ [PluginType in keyof Plugins]: ExtractBareConfig<Plugins[PluginType]>;
662
707
  };
663
708
 
664
- declare type MapToPlayerApiExtensions<Arr extends PluginCtor[]> = {
665
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer _uConfigType, PlayerWith<infer PlayerAPIExtension>> ? PlayerAPIExtension : never;
709
+ declare type MapToPlayerExtensions<Plugins extends PluginCtor[]> = {
710
+ [PluginIndex in keyof Plugins]: ExtractPluginPlayerExtension<Plugins[PluginIndex]>;
666
711
  };
667
712
 
668
713
  declare const MENU_OPENED = "has-menu-opened";
669
714
 
670
- declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
715
+ /**
716
+ * Combines plugin config and returns a type derived from Config
717
+ */
718
+ declare type MergeConfigs<Plugins extends PluginCtor[]> = MergePluginConfigs<MapToBareConfigs<Plugins>>;
719
+
720
+ declare type MergePlayerExtensions<Plugins extends PluginCtor[]> = ArrayToIntersection<MapToPlayerExtensions<Plugins>>;
671
721
 
672
- declare type MergePlayerAPIExtensions<Arr extends PluginCtor[]> = ArrayToIntersection<MapToPlayerApiExtensions<Arr>>;
722
+ declare type MergePluginConfigs<PluginBareConfigs extends unknown[]> = HasSrcExtensions<PluginBareConfigs> extends true ? ConfigWithSourceExtensions<PluginBareConfigs> : ConfigWith<ArrayToIntersection<PluginBareConfigs>>;
673
723
 
674
724
  /**
675
725
  * @public
@@ -764,8 +814,6 @@ declare const NO_CONTROLS = "no-controls";
764
814
 
765
815
  declare const NO_DVR = "no-timeline";
766
816
 
767
- declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
768
-
769
817
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
770
818
 
771
819
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -784,6 +832,7 @@ declare type OVPMetadata = {
784
832
  category_name?: string;
785
833
  duration?: number;
786
834
  tags?: string;
835
+ playlist_title?: string;
787
836
  };
788
837
 
789
838
  /**
@@ -799,6 +848,26 @@ PAUSE = "pause";
799
848
 
800
849
  declare const PAUSED = "is-paused";
801
850
 
851
+ declare type PickGlobalSrcExtension<PluginSrcs extends unknown[]> = {
852
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
853
+ type: string;
854
+ } ? unknown : PluginSrcs[Index];
855
+ };
856
+
857
+ /**
858
+ * Maps incoming array to the src extension type
859
+ * @example
860
+ * ```
861
+ * PickSrcExtensions<[
862
+ * {configProp: boolean, src: UnsafeSource<{srcProp: boolean}>},
863
+ * {}
864
+ * ]> // = [{srcProp: boolean}, never]
865
+ * ```
866
+ */
867
+ declare type PickSrcExtensions<PluginBareConfigs extends unknown[]> = {
868
+ [PluginType in keyof PluginBareConfigs]: ExtractSrcExtension<PluginBareConfigs[PluginType]>;
869
+ };
870
+
802
871
  /**
803
872
  * @public
804
873
  */
@@ -920,6 +989,8 @@ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap
920
989
  [DVR]: DvrEventDetail;
921
990
  [RETRY]: RetryEventDetail;
922
991
  [RECOVER]: RecoverEventDetail;
992
+ [QUALITIES]: QualitiesEventDetail;
993
+ [QUALITY_CHANGE]: QualityChangeEventDetail;
923
994
  /* Excluded from this release type: audioonlysource */
924
995
  /* Excluded from this release type: renderplugin */
925
996
  /* Excluded from this release type: "seek:queued" */
@@ -976,7 +1047,10 @@ declare type PlayerCustomEventsOverloads = {
976
1047
  * Emitted when the set of underlying qualities has changed.
977
1048
  */
978
1049
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
979
- /* Excluded from this release type: on */
1050
+ /**
1051
+ * Emitted when the media changes quality.
1052
+ */
1053
+ on(event: typeof QUALITY_CHANGE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITY_CHANGE]>) => void): Player;
980
1054
  /* Excluded from this release type: on */
981
1055
  /**
982
1056
  * Listen to this event to create a recommendations grid using the data passed with the event.
@@ -1031,7 +1105,6 @@ declare type PlayerCustomEventsOverloads = {
1031
1105
  /* Excluded from this release type: emit */
1032
1106
  /* Excluded from this release type: emit */
1033
1107
  /* Excluded from this release type: emit */
1034
- /* Excluded from this release type: emit */
1035
1108
  };
1036
1109
 
1037
1110
  declare type PlayerEmittableCustomEventsDetailMap = {
@@ -1039,7 +1112,6 @@ declare type PlayerEmittableCustomEventsDetailMap = {
1039
1112
  [CONTEXT_MENU]: ContextMenuEventDetail;
1040
1113
  [VIEW_ENTER]: ViewEnterEventDetail;
1041
1114
  [VIEW_LEAVE]: ViewLeaveEventDetail;
1042
- [QUALITIES]: QualitiesEventDetail;
1043
1115
  [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1044
1116
  };
1045
1117
 
@@ -1141,11 +1213,16 @@ PROGRESS = "progress";
1141
1213
  /**
1142
1214
  * @public
1143
1215
  */
1144
- declare type QselOption = {
1145
- height: number;
1216
+ declare type QselOption = (Level & {
1146
1217
  level: number;
1147
- text: string;
1148
- /* Excluded from this release type: videoCodec */
1218
+ }) | BitrateInfo | {
1219
+ name: string | number;
1220
+ encodingId: string;
1221
+ spatialLayerId: number;
1222
+ temporalLayerId: number;
1223
+ maxSpatialLayerId: number;
1224
+ maxTemporalLayerId: number;
1225
+ height: number;
1149
1226
  width: number;
1150
1227
  };
1151
1228
 
@@ -1169,9 +1246,29 @@ QUALITIES = "qualities";
1169
1246
  */
1170
1247
  declare type QualitiesEventDetail = QselOption[];
1171
1248
 
1172
- /* Excluded from this release type: _QualitiesEventDetail */
1249
+ /**
1250
+ * @public
1251
+ * emitted whenever the media changes quality
1252
+ */
1253
+ declare const /**
1254
+ @public
1255
+ * when a new player is inserted into the HTML
1256
+ */ /**
1257
+ * @public
1258
+ * emitted whenever the media changes quality
1259
+ */
1260
+ QUALITY_CHANGE = "qualitychange";
1173
1261
 
1174
- /* Excluded from this release type: _QualityDetail */
1262
+ /**
1263
+ * @public
1264
+ */
1265
+ declare type QualityChangeEventDetail = {
1266
+ before: Level | BitrateInfo;
1267
+ after: Level | BitrateInfo;
1268
+ plugin: string;
1269
+ automatic: boolean;
1270
+ downscale: boolean;
1271
+ };
1175
1272
 
1176
1273
  declare enum QualityOpts {
1177
1274
  LOW = 1,
@@ -1377,14 +1474,14 @@ declare type SourceEventDetail = SourceObj;
1377
1474
  /**
1378
1475
  * @public
1379
1476
  */
1380
- declare type SourceObj = {
1477
+ declare type SourceObj<T = unknown> = {
1381
1478
  src?: SourceStr;
1382
1479
  /**
1383
1480
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1384
1481
  */
1385
1482
  type?: string;
1386
1483
  drm?: DRMSourceConfiguration;
1387
- };
1484
+ } & T;
1388
1485
 
1389
1486
  /**
1390
1487
  * @public
@@ -1511,7 +1608,7 @@ declare const TV = "is-tv";
1511
1608
  /**
1512
1609
  * @public
1513
1610
  */
1514
- declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
1611
+ declare type UnsafeSource<SrcMixin = unknown> = SourceStr | SourceObj<SrcMixin> | Array<SourceStr | SourceObj<SrcMixin>>;
1515
1612
 
1516
1613
  /**
1517
1614
  * @public
@@ -1607,9 +1704,6 @@ declare const WILL_PLAY = "will-play";
1607
1704
 
1608
1705
  declare const WILL_SEEK = "will-seek";
1609
1706
 
1610
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = PluginPlayer & {
1611
- opts: PluginConfig;
1612
- setOpts(config: PluginConfig): void;
1613
- };
1707
+ declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1614
1708
 
1615
1709
  export { }
@@ -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.google_analytics=t())}(this,(function(){"use strict";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 i=e.flowplayer;return"function"==typeof i?(i(t),t):(Array.isArray(i.extensions)||(i.extensions=[]),~i.extensions.indexOf(t)||i.extensions.push(t),t)}(window,class GoogleAnalyticsPlugin{constructor(e){this.muted=!1,this.ga_extensions=[],this.quartiles=[0,0,0],this.ad_type="preroll",this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0,this.event_categories={live:"Live",videos:"Videos"},this.event_actions={fullscreen_enter:"fullscreen_enter",fullscreen_exit:"fullscreen_exit",video_player_load:"video_player_load",video_start:"video_start",video_click_play:"video_click_play",video_pause:"video_pause",video_resume:"video_resume",video_mute:"video_mute",video_unmute:"video_unmute",video_25_percent:"video_25_percent",video_50_percent:"video_50_percent",video_75_percent:"video_75_percent",video_complete:"video_complete",live_start:"live_start",live_click_play:"live_click_play",live_pause:"live_pause",live_resume:"live_resume",live_mute:"live_mute",live_unmute:"live_unmute",live_complete:"live_complete",ad_start_preroll:"ad_start_preroll",ad_start_midroll:"ad_start_midroll",ad_start_postroll:"ad_start_postroll",ad_completed_preroll:"ad_completed_preroll",ad_completed_midroll:"ad_completed_midroll",ad_completed_postroll:"ad_completed_postroll",ad_skipped_preroll:"ad_skipped_preroll",ad_skipped_midroll:"ad_skipped_midroll",ad_skipped_postroll:"ad_skipped_postroll",ad_break_completed:"ad_break_completed"},console.warn("universal analytics by Google has been sunset, please use the ga4 plugin"),this.flowplayer=e}init(e,t,i){this.config=e,this.video=i,this.muted=i.muted,i.on(["mount","timeupdate","play","ended","pause","playing","volumechange","ad-started","ad-completed","ad-skipped","ad-break-completed","config","play","fullscreenenter","fullscreenexit"],t=>{switch(t.type){case"playing":this.track(e.live?this.event_actions.live_resume:this.event_actions.video_resume);break;case"pause":if(Math.abs(i.duration-i.currentTime)<1)break;this.track(e.live?this.event_actions.live_pause:this.event_actions.video_pause);break;case"play":i.hasState("is-starting")&&this.track(e.live?this.event_actions.live_start:this.event_actions.video_start),this.track(e.live?this.event_actions.live_click_play:this.event_actions.video_click_play);break;case"mount":this.track(this.event_actions.video_player_load);break;case"timeupdate":this.progress(i);break;case"ended":setTimeout(()=>{this.track(e.live?this.event_actions.live_complete:this.event_actions.video_complete),this.reset()},0);break;case"volumechange":this.volumechange(i);break;case"ad-started":this.adstarted(t);break;case"ad-completed":this.adcompleted(t);break;case"ad-break-completed":this.adbreakcompleted();break;case"config":this.configured(t.detail);break;case"fullscreenenter":this.track(this.event_actions.fullscreen_enter);break;case"fullscreenexit":this.track(this.event_actions.fullscreen_exit);break;case"ad-skipped":this.adskipped()}})}setup_ga(e){window.ga&&!this.ga_extensions.length&&e.forEach((e,t)=>{var i;window.ga("create",e,"auto","ext"+(t+1)),(null===(i=this.config)||void 0===i?void 0:i.ga.custom_data)&&window.ga("ext"+(t+1)+".set",this.config.ga.custom_data),this.ga_extensions.push("ext"+(t+1))})}progress(e){e.opts.live||(e.currentTime/e.duration>.25&&0===this.quartiles[0]?(this.quartiles[0]=1,this.track(this.event_actions.video_25_percent)):e.currentTime/e.duration>.5&&0===this.quartiles[1]?(this.quartiles[1]=1,this.track(this.event_actions.video_50_percent)):e.currentTime/e.duration>.75&&0===this.quartiles[2]&&(this.quartiles[2]=1,this.track(this.event_actions.video_75_percent)))}volumechange(e){this.muted!==e.muted&&(this.muted=e.muted,e.muted?this.track(e.opts.live?this.event_actions.live_mute:this.event_actions.video_mute):this.track(e.opts.live?this.event_actions.live_unmute:this.event_actions.video_unmute))}reset(){this.quartiles=[0,0,0],this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0}configured(e){var t,i;(null===(t=null==e?void 0:e.ga)||void 0===t?void 0:t.event_actions)&&(this.event_actions=e.ga.event_actions),(null===(i=null==e?void 0:e.ga)||void 0===i?void 0:i.event_categories)&&(this.event_categories=e.ga.event_categories)}checkForAdCounter(e,t){return e.replace("[x]",t+"")}adstarted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.ad_type="midroll",this.midroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_midroll,this.midroll_counter));break;case"postroll":this.ad_type="postroll",this.postroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_postroll,this.postroll_counter));break;default:this.ad_type="preroll",this.preroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_preroll,this.preroll_counter))}}adcompleted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.track(this.event_actions.ad_completed_midroll);break;case"postroll":this.track(this.event_actions.ad_completed_postroll);break;default:this.track(this.event_actions.ad_completed_preroll)}}adskipped(){if(this.ad_type)switch(this.ad_type){case"midroll":this.track(this.event_actions.ad_skipped_midroll);break;case"postroll":this.track(this.event_actions.ad_skipped_postroll);break;default:this.track(this.event_actions.ad_skipped_preroll)}else this.track(this.event_actions.ad_skipped_preroll)}adbreakcompleted(){this.track(this.event_actions.ad_break_completed)}pushToDataLayer(e,t,i){var s;if(window.dataLayer)try{window.dataLayer.push({event:"Flowplayer",video_name:i,action:e,category:t,duration:null===(s=this.video)||void 0===s?void 0:s.duration})}catch(e){}}track(e){var t,i,s,o,a;if(!this.config||!this.config.ga||!e||(null===(t=null==this?void 0:this.video)||void 0===t?void 0:t.hasState("consent-no-tracking")))return;const l=(null===(i=this.video)||void 0===i?void 0:i.opts.live)?this.event_categories.live:this.event_categories.videos,r=null===(s=this.config.ga)||void 0===s?void 0:s.ga_instances,n=(null===(o=null==this?void 0:this.config)||void 0===o?void 0:o.title)||(null===(a=this.config.metadata)||void 0===a?void 0:a.title)||"unknown video";return this.config.ga.data_layer_tracking?this.pushToDataLayer(e,l,n):(this.setup_ga(r),this.ga_extensions.length&&void 0!==window.ga&&null!==window.ga?void this.ga_extensions.forEach(t=>{window.ga(t+".send","event",l,e,n)}):console.debug("ga console.send","event",l,e,n))}})}));
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.google_analytics=t())}(this,(function(){"use strict";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 i=e.flowplayer;return"function"==typeof i?(i(t),t):(Array.isArray(i.extensions)||(i.extensions=[]),~i.extensions.indexOf(t)||i.extensions.push(t),t)}(window,class GoogleAnalyticsPlugin{constructor(e){this.muted=!1,this.ga_extensions=[],this.quartiles=[0,0,0],this.ad_type="preroll",this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0,this.event_categories={live:"Live",videos:"Videos"},this.event_actions={fullscreen_enter:"fullscreen_enter",fullscreen_exit:"fullscreen_exit",video_player_load:"video_player_load",video_start:"video_start",video_click_play:"video_click_play",video_pause:"video_pause",video_resume:"video_resume",video_seeking:"video_seeking",video_ratechange:"video_ratechange",video_qualitychange:"video_qualitychange",video_mute:"video_mute",video_unmute:"video_unmute",video_25_percent:"video_25_percent",video_50_percent:"video_50_percent",video_75_percent:"video_75_percent",video_complete:"video_complete",live_start:"live_start",live_click_play:"live_click_play",live_pause:"live_pause",live_resume:"live_resume",live_ratechange:"live_ratechange",live_seeking:"live_seeking",live_qualitychange:"live_qualitychange",live_mute:"live_mute",live_unmute:"live_unmute",live_complete:"live_complete",ad_start_preroll:"ad_start_preroll",ad_start_midroll:"ad_start_midroll",ad_start_postroll:"ad_start_postroll",ad_completed_preroll:"ad_completed_preroll",ad_completed_midroll:"ad_completed_midroll",ad_completed_postroll:"ad_completed_postroll",ad_skipped_preroll:"ad_skipped_preroll",ad_skipped_midroll:"ad_skipped_midroll",ad_skipped_postroll:"ad_skipped_postroll",ad_break_completed:"ad_break_completed"},console.warn("universal analytics by Google has been sunset, please use the ga4 plugin"),this.flowplayer=e}init(e,t,i){this.config=e,this.video=i,this.muted=i.muted,i.on(["mount","timeupdate","play","ended","pause","playing","volumechange","ad-started","ad-completed","ad-skipped","ad-break-completed","config","play","fullscreenenter","fullscreenexit"],t=>{switch(t.type){case"playing":this.track(e.live?this.event_actions.live_resume:this.event_actions.video_resume);break;case"pause":if(Math.abs(i.duration-i.currentTime)<1)break;this.track(e.live?this.event_actions.live_pause:this.event_actions.video_pause);break;case"play":i.hasState("is-starting")&&this.track(e.live?this.event_actions.live_start:this.event_actions.video_start),this.track(e.live?this.event_actions.live_click_play:this.event_actions.video_click_play);break;case"mount":this.track(this.event_actions.video_player_load);break;case"timeupdate":this.progress(i);break;case"ended":setTimeout(()=>{this.track(e.live?this.event_actions.live_complete:this.event_actions.video_complete),this.reset()},0);break;case"volumechange":this.volumechange(i);break;case"ad-started":this.adstarted(t);break;case"ad-completed":this.adcompleted(t);break;case"ad-break-completed":this.adbreakcompleted();break;case"config":this.configured(t.detail);break;case"fullscreenenter":this.track(this.event_actions.fullscreen_enter);break;case"fullscreenexit":this.track(this.event_actions.fullscreen_exit);break;case"ad-skipped":this.adskipped()}})}setup_ga(e){window.ga&&!this.ga_extensions.length&&e.forEach((e,t)=>{var i;window.ga("create",e,"auto","ext"+(t+1)),(null===(i=this.config)||void 0===i?void 0:i.ga.custom_data)&&window.ga("ext"+(t+1)+".set",this.config.ga.custom_data),this.ga_extensions.push("ext"+(t+1))})}progress(e){e.opts.live||(e.currentTime/e.duration>.25&&0===this.quartiles[0]?(this.quartiles[0]=1,this.track(this.event_actions.video_25_percent)):e.currentTime/e.duration>.5&&0===this.quartiles[1]?(this.quartiles[1]=1,this.track(this.event_actions.video_50_percent)):e.currentTime/e.duration>.75&&0===this.quartiles[2]&&(this.quartiles[2]=1,this.track(this.event_actions.video_75_percent)))}volumechange(e){this.muted!==e.muted&&(this.muted=e.muted,e.muted?this.track(e.opts.live?this.event_actions.live_mute:this.event_actions.video_mute):this.track(e.opts.live?this.event_actions.live_unmute:this.event_actions.video_unmute))}reset(){this.quartiles=[0,0,0],this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0}configured(e){var t,i;(null===(t=null==e?void 0:e.ga)||void 0===t?void 0:t.event_actions)&&(this.event_actions=e.ga.event_actions),(null===(i=null==e?void 0:e.ga)||void 0===i?void 0:i.event_categories)&&(this.event_categories=e.ga.event_categories)}checkForAdCounter(e,t){return e.replace("[x]",t+"")}adstarted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.ad_type="midroll",this.midroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_midroll,this.midroll_counter));break;case"postroll":this.ad_type="postroll",this.postroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_postroll,this.postroll_counter));break;default:this.ad_type="preroll",this.preroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_preroll,this.preroll_counter))}}adcompleted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.track(this.event_actions.ad_completed_midroll);break;case"postroll":this.track(this.event_actions.ad_completed_postroll);break;default:this.track(this.event_actions.ad_completed_preroll)}}adskipped(){if(this.ad_type)switch(this.ad_type){case"midroll":this.track(this.event_actions.ad_skipped_midroll);break;case"postroll":this.track(this.event_actions.ad_skipped_postroll);break;default:this.track(this.event_actions.ad_skipped_preroll)}else this.track(this.event_actions.ad_skipped_preroll)}adbreakcompleted(){this.track(this.event_actions.ad_break_completed)}pushToDataLayer(e,t,i){var s;if(window.dataLayer)try{window.dataLayer.push({event:"Flowplayer",video_name:i,action:e,category:t,duration:null===(s=this.video)||void 0===s?void 0:s.duration})}catch(e){}}track(e){var t,i,s,a,o;if(!this.config||!this.config.ga||!e||(null===(t=null==this?void 0:this.video)||void 0===t?void 0:t.hasState("consent-no-tracking")))return;const l=(null===(i=this.video)||void 0===i?void 0:i.opts.live)?this.event_categories.live:this.event_categories.videos,r=null===(s=this.config.ga)||void 0===s?void 0:s.ga_instances,n=(null===(a=null==this?void 0:this.config)||void 0===a?void 0:a.title)||(null===(o=this.config.metadata)||void 0===o?void 0:o.title)||"unknown video";return this.config.ga.data_layer_tracking?this.pushToDataLayer(e,l,n):(this.setup_ga(r),this.ga_extensions.length&&void 0!==window.ga&&null!==window.ga?void this.ga_extensions.forEach(t=>{window.ga(t+".send","event",l,e,n)}):console.debug("ga console.send","event",l,e,n))}})}));
package/plugins/hls.d.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  /// <reference types="node" />
2
2
 
3
3
  import type { BitrateInfo } from 'dashjs';
4
+ import type { Get } from 'type-fest';
4
5
  import Hls from 'hls.js';
5
6
  import type { HlsConfig } from 'hls.js';
7
+ import type { Level } from 'hls.js';
6
8
  import type { MediaKeyFunc } from 'hls.js';
9
+ import type { SetFieldType } from 'type-fest';
10
+ import type { TupleToUnion } from 'type-fest';
7
11
 
8
12
  /* Excluded from this release type: AnyLoader */
9
13
 
@@ -83,6 +87,26 @@ declare const /**
83
87
  */
84
88
  CLICK = "click";
85
89
 
90
+ /**
91
+ * For plugins that add new properties to all source types, combine their src-mixins into one SourceObject
92
+ * @example
93
+ * ```
94
+ * type Combined = CombineGlobalSrcExtensions<DRMPlugin, PluginWithFooFieldInSrc> // Combined = SourceObject<DRMConfig & FooFieldConfig>
95
+ * ```
96
+ */
97
+ declare type CombineGlobalSrcExtensions<PluginSrcs extends unknown[]> = HasGlobalSrcExtensios<PluginSrcs> extends false ? SourceObj : SourceObj & ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
98
+
99
+ /**
100
+ * For plugins that define a new src type, make a union of all new src.type declarations
101
+ * @example
102
+ * ```
103
+ * type Combined = CombineNewSourceTypes<RTSPlugin, SSAIPlugin> // Combined = DRMConfig | FooFieldConfig
104
+ * ```
105
+ */
106
+ declare type CombineNewSourceTypes<PluginSrcs extends unknown[]> = TupleToUnion<FilterNewSourceTypes<PluginSrcs>>;
107
+
108
+ declare type CombineSrc<PluginSrcs extends unknown[]> = UnsafeSource<CombineGlobalSrcExtensions<PluginSrcs> | (CombineNewSourceTypes<PluginSrcs> & CombineGlobalSrcExtensions<PluginSrcs>)>;
109
+
86
110
  /* Excluded from this release type: Component */
87
111
 
88
112
  /* Excluded from this release type: Components */
@@ -143,6 +167,10 @@ declare interface Config {
143
167
  */
144
168
  declare type ConfigWith<T> = Config & T;
145
169
 
170
+ declare type ConfigWithSourceExtensions<PluginBareConfigs extends unknown[]> = Omit<ConfigWith<ArrayToIntersection<PluginBareConfigs>>, "src"> & {
171
+ src?: CombineSrc<PickSrcExtensions<PluginBareConfigs>>;
172
+ };
173
+
146
174
  /* Excluded from this release type: CONTENT_REAL_LOAD_START */
147
175
 
148
176
  /**
@@ -392,6 +420,7 @@ declare namespace events_2 {
392
420
  SOURCE,
393
421
  REAP,
394
422
  QUALITIES,
423
+ QUALITY_CHANGE,
395
424
  VIDEO_TRACKS,
396
425
  SET_QUALITY,
397
426
  VIDEO_TRACK_SELECT,
@@ -407,8 +436,20 @@ declare namespace events_2 {
407
436
  }
408
437
  }
409
438
 
439
+ declare type ExtractBareConfig<Plugins extends PluginCtor> = Plugins extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
440
+
441
+ declare type ExtractPluginPlayerExtension<Plugin extends PluginCtor> = Plugin extends PluginCtor<infer _uConfigType, PlayerWith<infer PluginPlayer>> ? PluginPlayer : never;
442
+
410
443
  declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
411
444
 
445
+ declare type ExtractSrcExtension<PluginBareConfig> = Get<PluginBareConfig, "src"> extends UnsafeSource<infer SrcMixinType> ? SrcMixinType : never;
446
+
447
+ declare type FilterNewSourceTypes<PluginSrcs extends unknown[]> = {
448
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
449
+ type: string;
450
+ } ? PluginSrcs[Index] : never;
451
+ };
452
+
412
453
  /**
413
454
  * @public
414
455
  */
@@ -451,7 +492,7 @@ declare interface FlowplayerUMD extends FlowplayerUMDBase {
451
492
  * Register plugins in flowplayer
452
493
  * @returns flowplayer instance with registered plugins
453
494
  */
454
- <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<ConfigWith<MergeConfigs<PluginCtors>>, PlayerWith<MergePlayerAPIExtensions<PluginCtors>>>;
495
+ <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<MergeConfigs<PluginCtors>, PlayerWith<MergePlayerExtensions<PluginCtors>>>;
455
496
  }
456
497
 
457
498
  declare interface FlowplayerUMDBase {
@@ -552,10 +593,14 @@ declare const GRABBING = "is-grabbing";
552
593
 
553
594
  declare const HAS_POSTER = "has-poster";
554
595
 
596
+ declare type HasGlobalSrcExtensios<PluginSrcs extends unknown[]> = ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
597
+
598
+ declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnion<PickSrcExtensions<PluginBareConfigs>> extends never ? false : true;
599
+
555
600
  /**
556
601
  * @public
557
602
  */
558
- declare const HLS: PluginCtor<HLSConfig, HLSPlayer> & HLSAPI;
603
+ declare const HLS: PluginCtor<NoInfer<HLSConfig>, NoInfer<HLSPlayer>> & NoInfer<HLSAPI>;
559
604
  export default HLS;
560
605
 
561
606
  /**
@@ -712,19 +757,24 @@ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwn
712
757
 
713
758
  declare const LOADING = "is-loading";
714
759
 
715
- declare type MapToConfigs<Arr extends PluginCtor[]> = {
716
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
760
+ declare type MapToBareConfigs<Plugins extends PluginCtor[]> = {
761
+ [PluginType in keyof Plugins]: ExtractBareConfig<Plugins[PluginType]>;
717
762
  };
718
763
 
719
- declare type MapToPlayerApiExtensions<Arr extends PluginCtor[]> = {
720
- [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer _uConfigType, PlayerWith<infer PlayerAPIExtension>> ? PlayerAPIExtension : never;
764
+ declare type MapToPlayerExtensions<Plugins extends PluginCtor[]> = {
765
+ [PluginIndex in keyof Plugins]: ExtractPluginPlayerExtension<Plugins[PluginIndex]>;
721
766
  };
722
767
 
723
768
  declare const MENU_OPENED = "has-menu-opened";
724
769
 
725
- declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
770
+ /**
771
+ * Combines plugin config and returns a type derived from Config
772
+ */
773
+ declare type MergeConfigs<Plugins extends PluginCtor[]> = MergePluginConfigs<MapToBareConfigs<Plugins>>;
774
+
775
+ declare type MergePlayerExtensions<Plugins extends PluginCtor[]> = ArrayToIntersection<MapToPlayerExtensions<Plugins>>;
726
776
 
727
- declare type MergePlayerAPIExtensions<Arr extends PluginCtor[]> = ArrayToIntersection<MapToPlayerApiExtensions<Arr>>;
777
+ declare type MergePluginConfigs<PluginBareConfigs extends unknown[]> = HasSrcExtensions<PluginBareConfigs> extends true ? ConfigWithSourceExtensions<PluginBareConfigs> : ConfigWith<ArrayToIntersection<PluginBareConfigs>>;
728
778
 
729
779
  /**
730
780
  * @public
@@ -819,8 +869,6 @@ declare const NO_CONTROLS = "no-controls";
819
869
 
820
870
  declare const NO_DVR = "no-timeline";
821
871
 
822
- declare type NoInfer_2<T> = [T][T extends any ? 0 : never];
823
-
824
872
  /* Excluded from this release type: NON_RECOVERABLE_ERROR */
825
873
 
826
874
  /* Excluded from this release type: NonRecoverableErrorEventDetail */
@@ -839,6 +887,7 @@ declare type OVPMetadata = {
839
887
  category_name?: string;
840
888
  duration?: number;
841
889
  tags?: string;
890
+ playlist_title?: string;
842
891
  };
843
892
 
844
893
  /**
@@ -854,6 +903,26 @@ PAUSE = "pause";
854
903
 
855
904
  declare const PAUSED = "is-paused";
856
905
 
906
+ declare type PickGlobalSrcExtension<PluginSrcs extends unknown[]> = {
907
+ [Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
908
+ type: string;
909
+ } ? unknown : PluginSrcs[Index];
910
+ };
911
+
912
+ /**
913
+ * Maps incoming array to the src extension type
914
+ * @example
915
+ * ```
916
+ * PickSrcExtensions<[
917
+ * {configProp: boolean, src: UnsafeSource<{srcProp: boolean}>},
918
+ * {}
919
+ * ]> // = [{srcProp: boolean}, never]
920
+ * ```
921
+ */
922
+ declare type PickSrcExtensions<PluginBareConfigs extends unknown[]> = {
923
+ [PluginType in keyof PluginBareConfigs]: ExtractSrcExtension<PluginBareConfigs[PluginType]>;
924
+ };
925
+
857
926
  /**
858
927
  * @public
859
928
  */
@@ -975,6 +1044,8 @@ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap
975
1044
  [DVR]: DvrEventDetail;
976
1045
  [RETRY]: RetryEventDetail;
977
1046
  [RECOVER]: RecoverEventDetail;
1047
+ [QUALITIES]: QualitiesEventDetail;
1048
+ [QUALITY_CHANGE]: QualityChangeEventDetail;
978
1049
  /* Excluded from this release type: audioonlysource */
979
1050
  /* Excluded from this release type: renderplugin */
980
1051
  /* Excluded from this release type: "seek:queued" */
@@ -1031,7 +1102,10 @@ declare type PlayerCustomEventsOverloads = {
1031
1102
  * Emitted when the set of underlying qualities has changed.
1032
1103
  */
1033
1104
  on(event: typeof QUALITIES, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITIES]>) => void): Player;
1034
- /* Excluded from this release type: on */
1105
+ /**
1106
+ * Emitted when the media changes quality.
1107
+ */
1108
+ on(event: typeof QUALITY_CHANGE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof QUALITY_CHANGE]>) => void): Player;
1035
1109
  /* Excluded from this release type: on */
1036
1110
  /**
1037
1111
  * Listen to this event to create a recommendations grid using the data passed with the event.
@@ -1086,7 +1160,6 @@ declare type PlayerCustomEventsOverloads = {
1086
1160
  /* Excluded from this release type: emit */
1087
1161
  /* Excluded from this release type: emit */
1088
1162
  /* Excluded from this release type: emit */
1089
- /* Excluded from this release type: emit */
1090
1163
  };
1091
1164
 
1092
1165
  declare type PlayerEmittableCustomEventsDetailMap = {
@@ -1094,7 +1167,6 @@ declare type PlayerEmittableCustomEventsDetailMap = {
1094
1167
  [CONTEXT_MENU]: ContextMenuEventDetail;
1095
1168
  [VIEW_ENTER]: ViewEnterEventDetail;
1096
1169
  [VIEW_LEAVE]: ViewLeaveEventDetail;
1097
- [QUALITIES]: QualitiesEventDetail;
1098
1170
  [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1099
1171
  };
1100
1172
 
@@ -1196,11 +1268,16 @@ PROGRESS = "progress";
1196
1268
  /**
1197
1269
  * @public
1198
1270
  */
1199
- declare type QselOption = {
1200
- height: number;
1271
+ declare type QselOption = (Level & {
1201
1272
  level: number;
1202
- text: string;
1203
- /* Excluded from this release type: videoCodec */
1273
+ }) | BitrateInfo | {
1274
+ name: string | number;
1275
+ encodingId: string;
1276
+ spatialLayerId: number;
1277
+ temporalLayerId: number;
1278
+ maxSpatialLayerId: number;
1279
+ maxTemporalLayerId: number;
1280
+ height: number;
1204
1281
  width: number;
1205
1282
  };
1206
1283
 
@@ -1224,9 +1301,29 @@ QUALITIES = "qualities";
1224
1301
  */
1225
1302
  declare type QualitiesEventDetail = QselOption[];
1226
1303
 
1227
- /* Excluded from this release type: _QualitiesEventDetail */
1304
+ /**
1305
+ * @public
1306
+ * emitted whenever the media changes quality
1307
+ */
1308
+ declare const /**
1309
+ @public
1310
+ * when a new player is inserted into the HTML
1311
+ */ /**
1312
+ * @public
1313
+ * emitted whenever the media changes quality
1314
+ */
1315
+ QUALITY_CHANGE = "qualitychange";
1228
1316
 
1229
- /* Excluded from this release type: _QualityDetail */
1317
+ /**
1318
+ * @public
1319
+ */
1320
+ declare type QualityChangeEventDetail = {
1321
+ before: Level | BitrateInfo;
1322
+ after: Level | BitrateInfo;
1323
+ plugin: string;
1324
+ automatic: boolean;
1325
+ downscale: boolean;
1326
+ };
1230
1327
 
1231
1328
  declare enum QualityOpts {
1232
1329
  LOW = 1,
@@ -1437,14 +1534,14 @@ declare type SourceEventDetail = SourceObj;
1437
1534
  /**
1438
1535
  * @public
1439
1536
  */
1440
- declare type SourceObj = {
1537
+ declare type SourceObj<T = unknown> = {
1441
1538
  src?: SourceStr;
1442
1539
  /**
1443
1540
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1444
1541
  */
1445
1542
  type?: string;
1446
1543
  drm?: DRMSourceConfiguration;
1447
- };
1544
+ } & T;
1448
1545
 
1449
1546
  /**
1450
1547
  * @public
@@ -1571,7 +1668,7 @@ declare const TV = "is-tv";
1571
1668
  /**
1572
1669
  * @public
1573
1670
  */
1574
- declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
1671
+ declare type UnsafeSource<SrcMixin = unknown> = SourceStr | SourceObj<SrcMixin> | Array<SourceStr | SourceObj<SrcMixin>>;
1575
1672
 
1576
1673
  /**
1577
1674
  * @public
@@ -1667,9 +1764,6 @@ declare const WILL_PLAY = "will-play";
1667
1764
 
1668
1765
  declare const WILL_SEEK = "will-seek";
1669
1766
 
1670
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = PluginPlayer & {
1671
- opts: PluginConfig;
1672
- setOpts(config: PluginConfig): void;
1673
- };
1767
+ declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1674
1768
 
1675
1769
  export { }