@flowplayer/player 3.11.1 → 3.11.2-rc.0

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 (49) hide show
  1. package/core.js +1 -1
  2. package/default.js +1 -1
  3. package/embed.js +2 -2
  4. package/index.d.ts +0 -3
  5. package/package.json +39 -1
  6. package/plugins/ads.d.ts +775 -0
  7. package/plugins/ads.js +1 -1
  8. package/plugins/airplay.d.ts +377 -0
  9. package/plugins/analytics.d.ts +242 -0
  10. package/plugins/analytics.js +1 -1
  11. package/plugins/asel.d.ts +360 -0
  12. package/plugins/audio.d.ts +347 -0
  13. package/plugins/chapters.d.ts +391 -0
  14. package/plugins/chromecast.d.ts +422 -0
  15. package/plugins/consent.d.ts +373 -0
  16. package/plugins/context-menu.d.ts +212 -0
  17. package/plugins/cuepoints.d.ts +0 -3
  18. package/plugins/dash.d.ts +235 -0
  19. package/plugins/drm.d.ts +248 -0
  20. package/plugins/endscreen.d.ts +407 -0
  21. package/plugins/fas.d.ts +364 -0
  22. package/plugins/float-on-scroll.d.ts +367 -0
  23. package/plugins/ga4.d.ts +454 -0
  24. package/plugins/gemius.d.ts +385 -0
  25. package/plugins/google-analytics.d.ts +456 -0
  26. package/plugins/health.d.ts +385 -0
  27. package/plugins/health.js +1 -1
  28. package/plugins/hls.d.ts +229 -0
  29. package/plugins/id3.d.ts +198 -0
  30. package/plugins/iframe.d.ts +356 -0
  31. package/plugins/keyboard.d.ts +189 -0
  32. package/plugins/media-session.d.ts +189 -0
  33. package/plugins/message.d.ts +193 -0
  34. package/plugins/ovp.d.ts +411 -0
  35. package/plugins/playlist.d.ts +394 -0
  36. package/plugins/preview.d.ts +243 -0
  37. package/plugins/qsel.d.ts +352 -0
  38. package/plugins/qul.d.ts +220 -0
  39. package/plugins/rts.d.ts +273 -0
  40. package/plugins/share.d.ts +361 -0
  41. package/plugins/speed.d.ts +346 -0
  42. package/plugins/ssai.d.ts +412 -0
  43. package/plugins/ssai.js +1 -1
  44. package/plugins/subtitles.d.ts +362 -0
  45. package/plugins/thumbnails.d.ts +375 -0
  46. package/plugins/tizen.d.ts +430 -0
  47. package/plugins/vtsel.d.ts +348 -0
  48. package/plugins/webos.d.ts +430 -0
  49. package/util/loader.d.ts +0 -3
@@ -0,0 +1,411 @@
1
+ import type { MediaKeyFunc } from 'hls.js';
2
+
3
+ declare type AnyPlugin<PluginOwnConfig extends KeyValue> = Plugin_2<PluginOwnConfig> | Loader<PluginOwnConfig>;
4
+
5
+ declare type ArrayToIntersection<T extends Array<unknown>> = T extends [infer Current, ...infer Remaining] ? Current & ArrayToIntersection<Remaining> : unknown;
6
+
7
+ declare type BitOpts = number;
8
+
9
+ declare type Component = {
10
+ onrender?: (config: Config, root: PlayerRoot, player: Player) => void;
11
+ onremove?: (config: Config, root: PlayerRoot, player: Player) => void;
12
+ };
13
+
14
+ declare interface Components {
15
+ render(key: string, args: any[]): void;
16
+ remove(key: string, args: any[]): void;
17
+ put(key: string, args: Component): void;
18
+ }
19
+
20
+ declare interface Config {
21
+ src?: UnsafeSource;
22
+ preload?: "none" | "metadata" | "auto";
23
+ controls?: boolean;
24
+ lang?: string;
25
+ start_time?: number;
26
+ autopause?: boolean;
27
+ rewind?: boolean;
28
+ loop?: boolean;
29
+ seamless?: boolean;
30
+ retry?: boolean;
31
+ autoplay?: BitOpts;
32
+ start_quality?: BitOpts;
33
+ live?: boolean;
34
+ poster?: string;
35
+ disabled?: boolean;
36
+ muted?: boolean;
37
+ /**
38
+ * is src handled by one of plugins loaders
39
+ */
40
+ is_native?: boolean;
41
+ /**
42
+ * bitflags for UI options
43
+ */
44
+ ui?: BitOpts;
45
+ /**
46
+ * your user access token
47
+ */
48
+ token?: string;
49
+ /**
50
+ * manually configured duration for pre-rendering usually
51
+ */
52
+ duration?: number;
53
+ /**
54
+ * can the content be seeked to any position
55
+ */
56
+ seekable?: boolean;
57
+ multiplay?: boolean;
58
+ ratio?: number | string;
59
+ logo?: string;
60
+ logo_href?: string;
61
+ logo_alt_text?: string;
62
+ title?: string;
63
+ description?: string;
64
+ /**
65
+ * the number of seconds to have in the buffer before dvr is activated
66
+ */
67
+ seconds_to_dvr?: number;
68
+ }
69
+
70
+ declare namespace Configs {
71
+ export {
72
+ BitOpts,
73
+ FlowplayerCustomElementRegistry,
74
+ Config,
75
+ CustomConfig,
76
+ PluginConfig
77
+ }
78
+ }
79
+
80
+ declare type ConfigWith<T> = Configs.Config & T;
81
+
82
+ declare type CustomConfig<T> = Config & T;
83
+
84
+ declare type DeviceId = string;
85
+
86
+ declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
87
+
88
+ declare type DRMConfiguration = {
89
+ license_server: string;
90
+ http_headers?: Record<string, string>;
91
+ certificate?: string;
92
+ vendor?: string | DRMVendorImplementation;
93
+ request_media_key_system_access_function?: MediaKeyFunc;
94
+ query_params?: Record<string, string>;
95
+ };
96
+
97
+ declare type DRMSourceConfiguration = {
98
+ [keysystem in DRM_KEYSYSTEM]?: DRMConfiguration;
99
+ };
100
+
101
+ declare type DRMVendorImplementation = {
102
+ fairplay_fetch_certificate: (url: string, cb: (certificate_data: Uint8Array) => void) => void;
103
+ fairplay_request_license: (url: string, params: {
104
+ message: any;
105
+ assetId: string;
106
+ }, cb: (license_data: Uint8Array) => void) => void;
107
+ };
108
+
109
+ declare namespace Flowplayer {
110
+ type SourceStr = Sources.SourceStr;
111
+ type DRM_KEYSYSTEM = Sources.DRM_KEYSYSTEM;
112
+ type SourceObj = Sources.SourceObj;
113
+ type DRMSourceConfiguration = Sources.DRMSourceConfiguration;
114
+ type SourceWith<T> = Sources.SourceWith<T>;
115
+ type UnsafeSource = Sources.UnsafeSource;
116
+ type SourceList = Sources.SourceList;
117
+ type DRMConfiguration = Sources.DRMConfiguration;
118
+ type DRMVendorImplementation = Sources.DRMVendorImplementation;
119
+ type BitOpts = Configs.BitOpts;
120
+ type FlowplayerCustomElementRegistry = Configs.FlowplayerCustomElementRegistry;
121
+ interface Config extends Configs.Config {
122
+ }
123
+ type CustomConfig<T> = Configs.CustomConfig<T>;
124
+ type PluginConfig<T> = Configs.PluginConfig<T>;
125
+ interface VideoTrack extends Players.VideoTrack {
126
+ }
127
+ interface FPEvent<T> extends Players.FPEvent<T> {
128
+ }
129
+ type DeviceId = Players.DeviceId;
130
+ type JSONPlayer = Players.JSONPlayer;
131
+ type PlayerRoot = Players.PlayerRoot;
132
+ interface Player extends Players.Player {
133
+ }
134
+ type PlayerState = Players.PlayerState;
135
+ interface FlowplayerUMD extends FlowplayerUMDs.FlowplayerUMD {
136
+ }
137
+ interface Components extends FlowplayerUMDs.Components {
138
+ }
139
+ type Component = FlowplayerUMDs.Component;
140
+ enum AutoplayOpts {
141
+ OFF,
142
+ ON,
143
+ AUDIO_REQUIRED
144
+ }
145
+ enum QualityOpts {
146
+ LOW,
147
+ MEDIUM,
148
+ HIGH
149
+ }
150
+ }
151
+
152
+ declare type FlowplayerCustomElementRegistry = Map<string, string>;
153
+
154
+ declare interface FlowplayerUMD extends FlowplayerUMDBase {
155
+ (selector: string, config?: Config): Player;
156
+ (element: HTMLElement, config?: Config): Player;
157
+ <T>(selector: string, config?: CustomConfig<T>): Player;
158
+ <T>(element: HTMLElement, config?: CustomConfig<T>): Player;
159
+ <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<CustomConfig<MergeConfigs<PluginCtors>>>;
160
+ }
161
+
162
+ declare interface FlowplayerUMDBase {
163
+ instances: Player[];
164
+ extensions: PluginCtor[];
165
+ events: Record<string, string>;
166
+ ads?: {
167
+ events: Record<string, string>;
168
+ };
169
+ states: Record<string, string>;
170
+ quality: typeof Flowplayer.QualityOpts;
171
+ commit: string;
172
+ version: string;
173
+ customElements: FlowplayerCustomElementRegistry;
174
+ defaultElements: Record<string, string>;
175
+ components: Components;
176
+ support: any;
177
+ autoplay: typeof Flowplayer.AutoplayOpts;
178
+ jwt: any;
179
+ loaders: any;
180
+ }
181
+
182
+ declare namespace FlowplayerUMDs {
183
+ export {
184
+ FlowplayerUMD,
185
+ FlowplayerUMDWithPlugins,
186
+ Components,
187
+ Component
188
+ }
189
+ }
190
+
191
+ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config> extends FlowplayerUMDBase {
192
+ (selector: string, config?: ConfigWithPlugins): Player;
193
+ (element: HTMLElement, config?: ConfigWithPlugins): Player;
194
+ }
195
+
196
+ declare interface FPEvent<T> extends CustomEvent<T> {
197
+ /**
198
+ * @deprecated
199
+ the data attribute has been migrated to details to match the CustomEvent spec
200
+ more info: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
201
+ */
202
+ data?: T;
203
+ }
204
+
205
+ declare type JSONPlayer = any;
206
+
207
+ declare type KeyValue = Record<string, any>;
208
+
209
+ declare const LIVE_COUNTDOWN_COMPLETE = "ovp:live:countdown:complete";
210
+
211
+ declare const LIVE_COUNTDOWN_START = "ovp:live:countdown:start";
212
+
213
+ declare const LIVE_COUNTDOWN_TICK = "ovp:live:countdown:tick";
214
+
215
+ declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Plugin_2<PluginOwnConfig> {
216
+ onload<T = KeyValue>(config: PluginConfig<T>, root: PlayerRoot, video: Player, src?: SourceObj): void;
217
+ wants<S = SourceObj, T = KeyValue>(srcString: SourceStr, srcObj: S, config: PluginConfig<T>): boolean;
218
+ wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
219
+ }
220
+
221
+ declare type MapToConfigs<Arr extends PluginCtor[]> = {
222
+ [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
223
+ };
224
+
225
+ declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
226
+
227
+ /**
228
+ * ovp plugin
229
+ */
230
+ declare class OVP implements Loader {
231
+ static events: typeof OVPEvents;
232
+ constructor(umd: FlowplayerUMD);
233
+ onload(opts: OVPConfig, _: PlayerRoot, video: Player, src: SourceObj): void;
234
+ wants(srcString: string, srcObj: SourceObj, _: OVPConfig): boolean;
235
+ init(opts: OVPConfig, root: PlayerRoot, video: Player): void;
236
+ }
237
+ export default OVP;
238
+
239
+ declare const OVP_ERROR = "ovp:error";
240
+
241
+ declare const OVP_MEDIA_CHANGED = "ovp:media:changed";
242
+
243
+ declare const OVP_MEDIA_REQUEST_COMPLETE = "ovp:request:media:complete";
244
+
245
+ declare const OVP_MEDIA_REQUEST_START = "ovp:request:start";
246
+
247
+ declare const OVP_PLAYLIST_REQUEST_COMPLETE = "ovp:request:playlist:complete";
248
+
249
+ declare const OVP_REALTIME_MESSAGE = "ovp:message:realtime";
250
+
251
+ declare type OVPConfig = ConfigWith<{
252
+ player_id?: string;
253
+ brand_color?: string;
254
+ metadata?: OVPMetadata;
255
+ recommendations?: Array<Recommendation> | false;
256
+ live_start_time?: number;
257
+ embed?: OVPConfig;
258
+ server_time_offset?: number;
259
+ domains?: Array<string>;
260
+ subtitles?: Array<string>;
261
+ chapters?: {
262
+ src: string;
263
+ };
264
+ thumbnails?: {
265
+ src: string;
266
+ };
267
+ }>;
268
+
269
+ declare namespace OVPEvents {
270
+ export {
271
+ OVP_ERROR,
272
+ OVP_MEDIA_REQUEST_START,
273
+ OVP_MEDIA_REQUEST_COMPLETE,
274
+ OVP_PLAYLIST_REQUEST_COMPLETE,
275
+ LIVE_COUNTDOWN_TICK,
276
+ LIVE_COUNTDOWN_START,
277
+ LIVE_COUNTDOWN_COMPLETE,
278
+ OVP_MEDIA_CHANGED,
279
+ OVP_REALTIME_MESSAGE
280
+ }
281
+ }
282
+
283
+ declare type OVPMetadata = {
284
+ player_id?: string;
285
+ media_id?: string;
286
+ ad_keywords?: string;
287
+ title?: string;
288
+ description?: string;
289
+ category_name?: string;
290
+ duration?: number;
291
+ tags?: string;
292
+ };
293
+
294
+ declare interface Player extends HTMLVideoElement {
295
+ renderPlugin: (pluginContainer: HTMLElement) => void;
296
+ toggleDisable: (flag: boolean) => void;
297
+ original_src: string;
298
+ root: PlayerRoot;
299
+ playerState: Record<string, boolean>;
300
+ reaper: Map<string, any> | 0;
301
+ hasState(state: PlayerState): boolean;
302
+ transitionState(to: PlayerState, from: PlayerState, timer?: number): void;
303
+ togglePlay(on?: boolean): Promise<void>;
304
+ toggleFullScreen(on?: boolean, state_only?: boolean): void;
305
+ toggleMute(on?: boolean): void;
306
+ destroy(): void;
307
+ render(): void;
308
+ render(component: string, args: any[]): void;
309
+ createComponents(...args: string[]): HTMLElement[];
310
+ setOpts(config: Config): void;
311
+ setSrc(sources: UnsafeSource): Player;
312
+ on<T>(event: string | string[], handler: (e: FPEvent<T>) => void): Player;
313
+ once<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
314
+ off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
315
+ poll<T>(event: string, data?: T): FPEvent<T>;
316
+ emit<T>(event: string, data?: T): Player;
317
+ setAttrs(attrs: Config): Player;
318
+ opt<T>(key: string, fallback?: T): T;
319
+ enqueueSeek(offset: number): any;
320
+ setState(state: string, flag: boolean): Player;
321
+ toJSON(): JSONPlayer;
322
+ i18n(k: string, fallback?: string): string;
323
+ deviceId(): DeviceId;
324
+ live_state: {
325
+ dvr?: boolean;
326
+ dvr_window?: number;
327
+ };
328
+ opts: Config;
329
+ plugins: Array<Plugin_2 | Loader>;
330
+ dvr_offset?: number;
331
+ message?: {
332
+ events: Record<string, string>;
333
+ };
334
+ disabled: boolean;
335
+ started?: boolean;
336
+ token: string;
337
+ tracks?: VideoTrack[];
338
+ _customElements: FlowplayerCustomElementRegistry;
339
+ _storage: Storage;
340
+ }
341
+
342
+ declare type PlayerRoot = HTMLElement & {
343
+ prevWidth?: number;
344
+ };
345
+
346
+ declare namespace Players {
347
+ export {
348
+ VideoTrack,
349
+ PlayerState,
350
+ FPEvent,
351
+ DeviceId,
352
+ JSONPlayer,
353
+ PlayerRoot,
354
+ Player
355
+ }
356
+ }
357
+
358
+ declare type PlayerState = string;
359
+
360
+ declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
361
+ /**
362
+ * a plugin must always implement the init method so a player instance knows how to initialize it
363
+ */
364
+ init<T>(config: PluginConfig<T>, container: PlayerRoot, player: Player): void;
365
+ init(config: PluginConfig<PluginOwnConfig>, container: PlayerRoot, player: Player): void;
366
+ }
367
+
368
+ declare type PluginConfig<T> = Config & T;
369
+
370
+ declare interface PluginCtor<PluginOwnConfig extends KeyValue = KeyValue> {
371
+ new (umd: FlowplayerUMD, player: Player): AnyPlugin<PluginOwnConfig>;
372
+ }
373
+
374
+ declare type Recommendation = OVPConfig;
375
+
376
+ declare type SourceList = Array<SourceObj>;
377
+
378
+ declare type SourceObj = {
379
+ src?: SourceStr;
380
+ type?: string;
381
+ drm?: DRMSourceConfiguration;
382
+ };
383
+
384
+ declare namespace Sources {
385
+ export {
386
+ SourceStr,
387
+ DRM_KEYSYSTEM,
388
+ SourceObj,
389
+ DRMSourceConfiguration,
390
+ SourceWith,
391
+ UnsafeSource,
392
+ SourceList,
393
+ DRMConfiguration,
394
+ DRMVendorImplementation
395
+ }
396
+ }
397
+
398
+ declare type SourceStr = string;
399
+
400
+ declare type SourceWith<T> = SourceObj & T;
401
+
402
+ declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
403
+
404
+ declare interface VideoTrack {
405
+ name: string;
406
+ data: any;
407
+ default: boolean;
408
+ selected: boolean;
409
+ }
410
+
411
+ export { }