@flowplayer/player 3.10.3 → 3.10.4-rc.2
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.
- package/core/events.d.ts +139 -12
- package/core.js +1 -1
- package/default.js +1 -1
- package/embed.js +2 -2
- package/index.d.ts +338 -279
- package/package.json +8 -2
- package/plugins/ads.js +1 -1
- package/plugins/analytics.js +1 -1
- package/plugins/health.js +1 -1
- package/plugins/ssai.js +1 -1
- package/types/configs.js +2 -0
- package/types/flowplayerUMD.js +2 -0
- package/types/index.js +17 -0
- package/types/player.js +2 -0
- package/types/plugin.js +2 -0
- package/types/sources.js +2 -0
- package/types/streaming.js +2 -0
- package/util/loader.d.ts +329 -9
- package/plugin.d.ts +0 -31
package/util/loader.d.ts
CHANGED
|
@@ -1,9 +1,329 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import type { MediaKeyFunc } from 'hls.js';
|
|
2
|
+
|
|
3
|
+
declare type AnyPlugin = Plugin_2 | Loader;
|
|
4
|
+
|
|
5
|
+
declare type BitOpts = number;
|
|
6
|
+
|
|
7
|
+
declare type Component = {
|
|
8
|
+
onrender?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
9
|
+
onremove?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
declare interface Components {
|
|
13
|
+
render(key: string, args: any[]): void;
|
|
14
|
+
remove(key: string, args: any[]): void;
|
|
15
|
+
put(key: string, args: Component): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare interface Config {
|
|
19
|
+
src?: UnsafeSource;
|
|
20
|
+
preload?: "none" | "metadata" | "auto";
|
|
21
|
+
controls?: boolean;
|
|
22
|
+
lang?: string;
|
|
23
|
+
start_time?: number;
|
|
24
|
+
autopause?: boolean;
|
|
25
|
+
rewind?: boolean;
|
|
26
|
+
loop?: boolean;
|
|
27
|
+
seamless?: boolean;
|
|
28
|
+
retry?: boolean;
|
|
29
|
+
autoplay?: BitOpts;
|
|
30
|
+
start_quality?: BitOpts;
|
|
31
|
+
live?: boolean;
|
|
32
|
+
poster?: string;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
muted?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* is src handled by one of plugins loaders
|
|
37
|
+
*/
|
|
38
|
+
is_native?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* bitflags for UI options
|
|
41
|
+
*/
|
|
42
|
+
ui?: BitOpts;
|
|
43
|
+
/**
|
|
44
|
+
* your user access token
|
|
45
|
+
*/
|
|
46
|
+
token?: string;
|
|
47
|
+
/**
|
|
48
|
+
* manually configured duration for pre-rendering usually
|
|
49
|
+
*/
|
|
50
|
+
duration?: number;
|
|
51
|
+
/**
|
|
52
|
+
* can the content be seeked to any position
|
|
53
|
+
*/
|
|
54
|
+
seekable?: boolean;
|
|
55
|
+
multiplay?: boolean;
|
|
56
|
+
ratio?: number | string;
|
|
57
|
+
logo?: string;
|
|
58
|
+
logo_href?: string;
|
|
59
|
+
logo_alt_text?: string;
|
|
60
|
+
title?: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
/**
|
|
63
|
+
* the number of seconds to have in the buffer before dvr is activated
|
|
64
|
+
*/
|
|
65
|
+
seconds_to_dvr?: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare namespace Configs {
|
|
69
|
+
export {
|
|
70
|
+
BitOpts,
|
|
71
|
+
FlowplayerCustomElementRegistry,
|
|
72
|
+
Config,
|
|
73
|
+
CustomConfig,
|
|
74
|
+
PluginConfig
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
declare type CustomConfig<T> = Config & T;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* adds support for asynchronous plugin loading`
|
|
82
|
+
* issue/127
|
|
83
|
+
*/
|
|
84
|
+
export declare function define(root: any, plugin: PluginCtor): PluginCtor;
|
|
85
|
+
|
|
86
|
+
declare type DeviceId = string;
|
|
87
|
+
|
|
88
|
+
declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
|
|
89
|
+
|
|
90
|
+
declare type DRMConfiguration = {
|
|
91
|
+
license_server: string;
|
|
92
|
+
http_headers?: Record<string, string>;
|
|
93
|
+
certificate?: string;
|
|
94
|
+
vendor?: string | DRMVendorImplementation;
|
|
95
|
+
request_media_key_system_access_function?: MediaKeyFunc;
|
|
96
|
+
query_params?: Record<string, string>;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
declare type DRMSourceConfiguration = {
|
|
100
|
+
[keysystem in DRM_KEYSYSTEM]?: DRMConfiguration;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
declare type DRMVendorImplementation = {
|
|
104
|
+
fairplay_fetch_certificate: (url: string, cb: (certificate_data: Uint8Array) => void) => void;
|
|
105
|
+
fairplay_request_license: (url: string, params: {
|
|
106
|
+
message: any;
|
|
107
|
+
assetId: string;
|
|
108
|
+
}, cb: (license_data: Uint8Array) => void) => void;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
declare namespace Flowplayer {
|
|
112
|
+
type SourceStr = Sources.SourceStr;
|
|
113
|
+
type DRM_KEYSYSTEM = Sources.DRM_KEYSYSTEM;
|
|
114
|
+
type SourceObj = Sources.SourceObj;
|
|
115
|
+
type DRMSourceConfiguration = Sources.DRMSourceConfiguration;
|
|
116
|
+
type SourceWith<T> = Sources.SourceWith<T>;
|
|
117
|
+
type UnsafeSource = Sources.UnsafeSource;
|
|
118
|
+
type SourceList = Sources.SourceList;
|
|
119
|
+
type DRMConfiguration = Sources.DRMConfiguration;
|
|
120
|
+
type DRMVendorImplementation = Sources.DRMVendorImplementation;
|
|
121
|
+
type BitOpts = Configs.BitOpts;
|
|
122
|
+
type FlowplayerCustomElementRegistry = Configs.FlowplayerCustomElementRegistry;
|
|
123
|
+
interface Config extends Configs.Config {
|
|
124
|
+
}
|
|
125
|
+
type CustomConfig<T> = Configs.CustomConfig<T>;
|
|
126
|
+
type PluginConfig<T> = Configs.PluginConfig<T>;
|
|
127
|
+
interface VideoTrack extends Players.VideoTrack {
|
|
128
|
+
}
|
|
129
|
+
interface FPEvent<T> extends Players.FPEvent<T> {
|
|
130
|
+
}
|
|
131
|
+
type DeviceId = Players.DeviceId;
|
|
132
|
+
type JSONPlayer = Players.JSONPlayer;
|
|
133
|
+
type PlayerRoot = Players.PlayerRoot;
|
|
134
|
+
interface Player extends Players.Player {
|
|
135
|
+
}
|
|
136
|
+
type PlayerState = Players.PlayerState;
|
|
137
|
+
interface FlowplayerUMD extends FlowplayerUMDs.FlowplayerUMD {
|
|
138
|
+
}
|
|
139
|
+
interface Components extends FlowplayerUMDs.Components {
|
|
140
|
+
}
|
|
141
|
+
type Component = FlowplayerUMDs.Component;
|
|
142
|
+
enum AutoplayOpts {
|
|
143
|
+
OFF,
|
|
144
|
+
ON,
|
|
145
|
+
AUDIO_REQUIRED
|
|
146
|
+
}
|
|
147
|
+
enum QualityOpts {
|
|
148
|
+
LOW,
|
|
149
|
+
MEDIUM,
|
|
150
|
+
HIGH
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare type FlowplayerCustomElementRegistry = Map<string, string>;
|
|
155
|
+
|
|
156
|
+
declare interface FlowplayerUMD {
|
|
157
|
+
(selector: string, config?: Config): Player;
|
|
158
|
+
<T>(selector: string, config?: CustomConfig<T>): Player;
|
|
159
|
+
(element: HTMLElement, config?: Config): Player;
|
|
160
|
+
<T>(element: HTMLElement, config?: CustomConfig<T>): Player;
|
|
161
|
+
(...plugins: PluginCtor[]): void;
|
|
162
|
+
instances: Player[];
|
|
163
|
+
extensions: PluginCtor[];
|
|
164
|
+
events: Record<string, string>;
|
|
165
|
+
ads?: {
|
|
166
|
+
events: Record<string, string>;
|
|
167
|
+
};
|
|
168
|
+
states: Record<string, string>;
|
|
169
|
+
quality: typeof Flowplayer.QualityOpts;
|
|
170
|
+
commit: string;
|
|
171
|
+
version: string;
|
|
172
|
+
customElements: FlowplayerCustomElementRegistry;
|
|
173
|
+
defaultElements: Record<string, string>;
|
|
174
|
+
components: Components;
|
|
175
|
+
support: any;
|
|
176
|
+
autoplay: typeof Flowplayer.AutoplayOpts;
|
|
177
|
+
jwt: any;
|
|
178
|
+
loaders: any;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare namespace FlowplayerUMDs {
|
|
182
|
+
export {
|
|
183
|
+
FlowplayerUMD,
|
|
184
|
+
Components,
|
|
185
|
+
Component
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
declare interface FPEvent<T> extends CustomEvent<T> {
|
|
190
|
+
/**
|
|
191
|
+
* @deprecated
|
|
192
|
+
the data attribute has been migrated to details to match the CustomEvent spec
|
|
193
|
+
more info: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
|
|
194
|
+
*/
|
|
195
|
+
data?: T;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export declare function isESM(): boolean;
|
|
199
|
+
|
|
200
|
+
declare type JSONPlayer = any;
|
|
201
|
+
|
|
202
|
+
declare type KeyValue = Record<string, any>;
|
|
203
|
+
|
|
204
|
+
declare interface Loader extends Plugin_2 {
|
|
205
|
+
onload<T = KeyValue>(config: PluginConfig<T>, root: PlayerRoot, video: Player, src?: SourceObj): void;
|
|
206
|
+
wants<S = SourceObj, T = KeyValue>(srcString: SourceStr, srcObj: S, config: PluginConfig<T>): boolean;
|
|
207
|
+
wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export declare function modules(): any;
|
|
211
|
+
|
|
212
|
+
declare interface Player extends HTMLVideoElement {
|
|
213
|
+
renderPlugin: (pluginContainer: HTMLElement) => void;
|
|
214
|
+
toggleDisable: (flag: boolean) => void;
|
|
215
|
+
original_src: string;
|
|
216
|
+
root: PlayerRoot;
|
|
217
|
+
playerState: Record<string, boolean>;
|
|
218
|
+
reaper: Map<string, any> | 0;
|
|
219
|
+
hasState(state: PlayerState): boolean;
|
|
220
|
+
transitionState(to: PlayerState, from: PlayerState, timer?: number): void;
|
|
221
|
+
togglePlay(on?: boolean): Promise<void>;
|
|
222
|
+
toggleFullScreen(on?: boolean, state_only?: boolean): void;
|
|
223
|
+
toggleMute(on?: boolean): void;
|
|
224
|
+
destroy(): void;
|
|
225
|
+
render(): void;
|
|
226
|
+
render(component: string, args: any[]): void;
|
|
227
|
+
createComponents(...args: string[]): HTMLElement[];
|
|
228
|
+
setOpts(config: Config): void;
|
|
229
|
+
setSrc(sources: UnsafeSource): Player;
|
|
230
|
+
on<T>(event: string | string[], handler: (e: FPEvent<T>) => void): Player;
|
|
231
|
+
once<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
|
|
232
|
+
off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
|
|
233
|
+
poll<T>(event: string, data?: T): FPEvent<T>;
|
|
234
|
+
emit<T>(event: string, data?: T): Player;
|
|
235
|
+
setAttrs(attrs: Config): Player;
|
|
236
|
+
opt<T>(key: string, fallback?: T): T;
|
|
237
|
+
enqueueSeek(offset: number): any;
|
|
238
|
+
setState(state: string, flag: boolean): Player;
|
|
239
|
+
toJSON(): JSONPlayer;
|
|
240
|
+
i18n(k: string, fallback?: string): string;
|
|
241
|
+
deviceId(): DeviceId;
|
|
242
|
+
live_state: {
|
|
243
|
+
dvr?: boolean;
|
|
244
|
+
dvr_window?: number;
|
|
245
|
+
};
|
|
246
|
+
opts: Config;
|
|
247
|
+
plugins: Array<Plugin_2 | Loader>;
|
|
248
|
+
dvr_offset?: number;
|
|
249
|
+
message?: {
|
|
250
|
+
events: Record<string, string>;
|
|
251
|
+
};
|
|
252
|
+
disabled: boolean;
|
|
253
|
+
started?: boolean;
|
|
254
|
+
token: string;
|
|
255
|
+
tracks?: VideoTrack[];
|
|
256
|
+
_customElements: FlowplayerCustomElementRegistry;
|
|
257
|
+
_storage: Storage;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
declare type PlayerRoot = HTMLElement & {
|
|
261
|
+
prevWidth?: number;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
declare namespace Players {
|
|
265
|
+
export {
|
|
266
|
+
VideoTrack,
|
|
267
|
+
PlayerState,
|
|
268
|
+
FPEvent,
|
|
269
|
+
DeviceId,
|
|
270
|
+
JSONPlayer,
|
|
271
|
+
PlayerRoot,
|
|
272
|
+
Player
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
declare type PlayerState = string;
|
|
277
|
+
|
|
278
|
+
declare interface Plugin_2 {
|
|
279
|
+
/**
|
|
280
|
+
* a plugin must always implement the init method so a player instance knows how to initialize it
|
|
281
|
+
*/
|
|
282
|
+
init<T>(config: PluginConfig<T>, container: PlayerRoot, player: Player): void;
|
|
283
|
+
init(config: Config, container: PlayerRoot, player: Player): void;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
declare type PluginConfig<T> = Config & T;
|
|
287
|
+
|
|
288
|
+
declare interface PluginCtor {
|
|
289
|
+
new (umd: FlowplayerUMD, player: Player): AnyPlugin;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export declare function root(): {};
|
|
293
|
+
|
|
294
|
+
declare type SourceList = Array<SourceObj>;
|
|
295
|
+
|
|
296
|
+
declare type SourceObj = {
|
|
297
|
+
src?: SourceStr;
|
|
298
|
+
type?: string;
|
|
299
|
+
drm?: DRMSourceConfiguration;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
declare namespace Sources {
|
|
303
|
+
export {
|
|
304
|
+
SourceStr,
|
|
305
|
+
DRM_KEYSYSTEM,
|
|
306
|
+
SourceObj,
|
|
307
|
+
DRMSourceConfiguration,
|
|
308
|
+
SourceWith,
|
|
309
|
+
UnsafeSource,
|
|
310
|
+
SourceList,
|
|
311
|
+
DRMConfiguration,
|
|
312
|
+
DRMVendorImplementation
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare type SourceStr = string;
|
|
317
|
+
|
|
318
|
+
declare type SourceWith<T> = SourceObj & T;
|
|
319
|
+
|
|
320
|
+
declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
|
|
321
|
+
|
|
322
|
+
declare interface VideoTrack {
|
|
323
|
+
name: string;
|
|
324
|
+
data: any;
|
|
325
|
+
default: boolean;
|
|
326
|
+
selected: boolean;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export { }
|
package/plugin.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Config
|
|
2
|
-
, Player
|
|
3
|
-
, PlayerRoot
|
|
4
|
-
, SourceObj
|
|
5
|
-
, SourceStr
|
|
6
|
-
, FlowplayerUMD
|
|
7
|
-
, PluginConfig,
|
|
8
|
-
SourceWith
|
|
9
|
-
} from "."
|
|
10
|
-
|
|
11
|
-
export interface Plugin {
|
|
12
|
-
/**
|
|
13
|
-
* a plugin must always implement the init method so a player instance knows how to initialize it
|
|
14
|
-
*/
|
|
15
|
-
init<T> (config : PluginConfig<T>, container : PlayerRoot, player : Player): void;
|
|
16
|
-
init (config : Config, container : PlayerRoot, player : Player): void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface Loader extends Plugin {
|
|
20
|
-
onload<T = Record<string, any>> (config : PluginConfig<T>, root : PlayerRoot, video : Player, src? : SourceObj): void;
|
|
21
|
-
wants<S = SourceObj, T = Record<string, any>> (srcString : SourceStr, srcObj : S, config : PluginConfig<T>): boolean;
|
|
22
|
-
wants<S = Record<string, any>, T = Record<string, any>> (srcString : SourceStr, srcObj : SourceWith<S>, config : PluginConfig<T>): boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface PluginCtor {
|
|
26
|
-
new (umd : FlowplayerUMD, player : Player): AnyPlugin
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type AnyPlugin =
|
|
30
|
-
| Plugin
|
|
31
|
-
| Loader
|