@flowplayer/player 3.11.2-rc.3 → 3.11.2-rc.4
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.js +1 -1
- package/default.js +1 -1
- package/embed.js +2 -2
- package/package.json +1 -1
- package/plugins/ads.d.ts +5 -432
- package/plugins/ads.js +1 -1
- package/plugins/airplay.d.ts +7 -60
- package/plugins/airplay.js +1 -1
- package/plugins/analytics.d.ts +74 -53
- package/plugins/analytics.js +1 -1
- package/plugins/chapters.d.ts +5 -74
- package/plugins/chapters.js +1 -1
- package/plugins/context-menu.d.ts +75 -19
- package/plugins/context-menu.js +1 -1
- package/plugins/cuepoints.d.ts +2 -16
- package/plugins/drm.d.ts +78 -47
- package/plugins/drm.js +1 -1
- package/plugins/fas.d.ts +5 -46
- package/plugins/fas.js +1 -1
- package/plugins/ga4.d.ts +30 -61
- package/plugins/ga4.js +1 -1
- package/plugins/google-analytics.d.ts +30 -63
- package/plugins/google-analytics.js +1 -1
- package/plugins/health.d.ts +5 -1
- package/plugins/health.js +1 -1
- package/plugins/hls.d.ts +6 -2
- package/plugins/hls.js +1 -1
- package/plugins/id3.d.ts +74 -13
- package/plugins/id3.js +1 -1
- package/plugins/iframe.d.ts +2 -18
- package/plugins/iframe.js +1 -1
- package/plugins/keyboard.d.ts +75 -5
- package/plugins/keyboard.js +1 -1
- package/plugins/media-session.d.ts +74 -4
- package/plugins/media-session.js +1 -1
- package/plugins/message.d.ts +74 -8
- package/plugins/message.js +1 -1
- package/plugins/ovp.d.ts +22 -44
- package/plugins/ovp.js +1 -1
- package/plugins/playlist.d.ts +5 -46
- package/plugins/playlist.js +1 -1
- package/plugins/share.d.ts +3 -37
- package/plugins/share.js +1 -1
- package/plugins/ssai.js +1 -1
- package/plugins/subtitles.d.ts +11 -13
- package/plugins/subtitles.js +1 -1
- package/plugins/thumbnails.d.ts +5 -50
- package/plugins/thumbnails.js +1 -1
- package/plugins/tizen.d.ts +7 -118
- package/plugins/tizen.js +1 -1
- package/plugins/vtsel.d.ts +3 -26
- package/plugins/vtsel.js +1 -1
- package/plugins/webos.d.ts +7 -118
- package/plugins/webos.js +1 -1
package/plugins/id3.d.ts
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import type { MediaKeyFunc } from 'hls.js';
|
|
2
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 enum AutoplayOpts {
|
|
8
|
+
OFF = 0,
|
|
9
|
+
ON = 1,
|
|
10
|
+
AUDIO_REQUIRED = 2
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
declare type BitOpts = number;
|
|
4
14
|
|
|
15
|
+
declare type Component = {
|
|
16
|
+
onrender?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
17
|
+
onremove?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
declare interface Components {
|
|
21
|
+
render(key: string, args: any[]): void;
|
|
22
|
+
remove(key: string, args: any[]): void;
|
|
23
|
+
put(key: string, args: Component): void;
|
|
24
|
+
}
|
|
25
|
+
|
|
5
26
|
declare interface Config {
|
|
6
27
|
src?: UnsafeSource;
|
|
7
28
|
preload?: "none" | "metadata" | "auto";
|
|
@@ -52,6 +73,11 @@ declare interface Config {
|
|
|
52
73
|
seconds_to_dvr?: number;
|
|
53
74
|
}
|
|
54
75
|
|
|
76
|
+
declare type CustomConfig<T> = Config & T;
|
|
77
|
+
|
|
78
|
+
declare const _default: PluginCtor<KeyValue>;
|
|
79
|
+
export default _default;
|
|
80
|
+
|
|
55
81
|
declare type DeviceId = string;
|
|
56
82
|
|
|
57
83
|
declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
|
|
@@ -77,13 +103,40 @@ declare type DRMVendorImplementation = {
|
|
|
77
103
|
}, cb: (license_data: Uint8Array) => void) => void;
|
|
78
104
|
};
|
|
79
105
|
|
|
80
|
-
declare
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
106
|
+
declare type FlowplayerCustomElementRegistry = Map<string, string>;
|
|
107
|
+
|
|
108
|
+
declare interface FlowplayerUMD extends FlowplayerUMDBase {
|
|
109
|
+
(selector: string, config?: Config): Player;
|
|
110
|
+
(element: HTMLElement, config?: Config): Player;
|
|
111
|
+
<T>(selector: string, config?: CustomConfig<T>): Player;
|
|
112
|
+
<T>(element: HTMLElement, config?: CustomConfig<T>): Player;
|
|
113
|
+
<PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<CustomConfig<MergeConfigs<PluginCtors>>>;
|
|
84
114
|
}
|
|
85
115
|
|
|
86
|
-
declare
|
|
116
|
+
declare interface FlowplayerUMDBase {
|
|
117
|
+
instances: Player[];
|
|
118
|
+
extensions: PluginCtor[];
|
|
119
|
+
events: Record<string, string>;
|
|
120
|
+
ads?: {
|
|
121
|
+
events: Record<string, string>;
|
|
122
|
+
};
|
|
123
|
+
states: Record<string, string>;
|
|
124
|
+
quality: typeof QualityOpts;
|
|
125
|
+
commit: string;
|
|
126
|
+
version: string;
|
|
127
|
+
customElements: FlowplayerCustomElementRegistry;
|
|
128
|
+
defaultElements: Record<string, string>;
|
|
129
|
+
components: Components;
|
|
130
|
+
support: any;
|
|
131
|
+
autoplay: typeof AutoplayOpts;
|
|
132
|
+
jwt: any;
|
|
133
|
+
loaders: any;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config> extends FlowplayerUMDBase {
|
|
137
|
+
(selector: string, config?: ConfigWithPlugins): Player;
|
|
138
|
+
(element: HTMLElement, config?: ConfigWithPlugins): Player;
|
|
139
|
+
}
|
|
87
140
|
|
|
88
141
|
declare interface FPEvent<T> extends CustomEvent<T> {
|
|
89
142
|
/**
|
|
@@ -94,14 +147,6 @@ declare interface FPEvent<T> extends CustomEvent<T> {
|
|
|
94
147
|
data?: T;
|
|
95
148
|
}
|
|
96
149
|
|
|
97
|
-
declare class ID3 implements Plugin_2 {
|
|
98
|
-
static events: typeof events;
|
|
99
|
-
init(_config: Config, _root: PlayerRoot, video: Player): void;
|
|
100
|
-
}
|
|
101
|
-
export default ID3;
|
|
102
|
-
|
|
103
|
-
declare const ID3_2 = "ID3";
|
|
104
|
-
|
|
105
150
|
declare type JSONPlayer = any;
|
|
106
151
|
|
|
107
152
|
declare type KeyValue = Record<string, any>;
|
|
@@ -112,6 +157,12 @@ declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Pl
|
|
|
112
157
|
wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
|
|
113
158
|
}
|
|
114
159
|
|
|
160
|
+
declare type MapToConfigs<Arr extends PluginCtor[]> = {
|
|
161
|
+
[PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
|
|
165
|
+
|
|
115
166
|
declare interface Player extends HTMLVideoElement {
|
|
116
167
|
renderPlugin: (pluginContainer: HTMLElement) => void;
|
|
117
168
|
toggleDisable: (flag: boolean) => void;
|
|
@@ -176,6 +227,16 @@ declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
|
176
227
|
|
|
177
228
|
declare type PluginConfig<T> = Config & T;
|
|
178
229
|
|
|
230
|
+
declare interface PluginCtor<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
231
|
+
new (umd: FlowplayerUMD, player: Player): AnyPlugin<PluginOwnConfig>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare enum QualityOpts {
|
|
235
|
+
LOW = 1,
|
|
236
|
+
MEDIUM = 2,
|
|
237
|
+
HIGH = 4
|
|
238
|
+
}
|
|
239
|
+
|
|
179
240
|
declare type SourceObj = {
|
|
180
241
|
src?: SourceStr;
|
|
181
242
|
type?: string;
|
package/plugins/id3.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.id3=n())}(this,(function(){"use strict";var e=Object.freeze({__proto__:null,ID3:"ID3"});class ID3{init(e,n,t){t.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label||"com.apple.streaming"==e.inBandMetadataTrackDispatchType?function(e,n){n.mode="hidden",n.addEventListener("cuechange",async()=>{Array.from(n.activeCues||[]).forEach(async n=>{(function(e){return"object"==typeof e.value&&"string"==typeof e.value.key&&!!e.value.data})(n)&&e.emit("ID3",{cue:n})})})}(t,e):void 0})}}return ID3.events=e,function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;if(null===document.currentScript)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;"function"==typeof t?t(n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n))}(window,ID3)
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.id3=n())}(this,(function(){"use strict";var e=Object.freeze({__proto__:null,ID3:"ID3"});class ID3{init(e,n,t){t.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label||"com.apple.streaming"==e.inBandMetadataTrackDispatchType?function(e,n){n.mode="hidden",n.addEventListener("cuechange",async()=>{Array.from(n.activeCues||[]).forEach(async n=>{(function(e){return"object"==typeof e.value&&"string"==typeof e.value.key&&!!e.value.data})(n)&&e.emit("ID3",{cue:n})})})}(t,e):void 0})}}return ID3.events=e,function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;if(null===document.currentScript)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;return"function"==typeof t?(t(n),n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n),n)}(window,ID3)}));
|
package/plugins/iframe.d.ts
CHANGED
|
@@ -147,24 +147,8 @@ declare interface FPEvent<T> extends CustomEvent<T> {
|
|
|
147
147
|
/**
|
|
148
148
|
* maybe handles iframe specific stuff if inside an iframe
|
|
149
149
|
*/
|
|
150
|
-
declare
|
|
151
|
-
|
|
152
|
-
* this is for interframe communication namespace
|
|
153
|
-
*
|
|
154
|
-
* all google libraries use different ones to talk to each other ("ima://" for instance)
|
|
155
|
-
* which means we might have listeners attached to the onmessage handler
|
|
156
|
-
* before flowplayer.instances actually exist.
|
|
157
|
-
*
|
|
158
|
-
* by namespacing our own events we can handle this much better
|
|
159
|
-
*/
|
|
160
|
-
static FLOWPLAYER_RPC_PROTOCOL: string;
|
|
161
|
-
static ATTACHED: boolean;
|
|
162
|
-
static is_flowplayer_message: (data: string) => boolean;
|
|
163
|
-
static message_body: (data: string) => string;
|
|
164
|
-
constructor(umd: FlowplayerUMD, player: Player);
|
|
165
|
-
init(config: Config, _root: unknown, video: Player): void;
|
|
166
|
-
}
|
|
167
|
-
export default Iframe;
|
|
150
|
+
declare const IframePlugin: PluginCtor<KeyValue>;
|
|
151
|
+
export default IframePlugin;
|
|
168
152
|
|
|
169
153
|
declare type JSONPlayer = any;
|
|
170
154
|
|
package/plugins/iframe.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.iframe=n())}(this,(function(){"use strict";class Iframe{constructor(e,n){Iframe.ATTACHED||(n.setState("is-iframe",!0),Iframe.ATTACHED=!0,window.addEventListener("message",(function(n){if(!Iframe.is_flowplayer_message(n.data))return;const t=e.instances||[],r=t[0];if(!r)return;t.length>1&&console.warn("Multiple player instances in iframe. Messaging supported with first instance only.");switch(Iframe.message_body(n.data)){case"pause":return r.togglePlay(!1);case"play":return r.togglePlay(!0)}})))}init(e,n,t){t.on("fullscreenenter",(function(){document.fullscreenEnabled||"function"==typeof t.webkitEnterFullscreen&&(t.webkitEnterFullscreen(),t.once("webkitendfullscreen",(function(){t.emit("fullscreenexit")})),t.on("ended",(function(){t.webkitExitFullscreen()})))}))}}
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.iframe=n())}(this,(function(){"use strict";class Iframe{constructor(e,n){Iframe.ATTACHED||(n.setState("is-iframe",!0),Iframe.ATTACHED=!0,window.addEventListener("message",(function(n){if(!Iframe.is_flowplayer_message(n.data))return;const t=e.instances||[],r=t[0];if(!r)return;t.length>1&&console.warn("Multiple player instances in iframe. Messaging supported with first instance only.");switch(Iframe.message_body(n.data)){case"pause":return r.togglePlay(!1);case"play":return r.togglePlay(!0)}})))}init(e,n,t){t.on("fullscreenenter",(function(){document.fullscreenEnabled||"function"==typeof t.webkitEnterFullscreen&&(t.webkitEnterFullscreen(),t.once("webkitendfullscreen",(function(){t.emit("fullscreenexit")})),t.on("ended",(function(){t.webkitExitFullscreen()})))}))}}Iframe.FLOWPLAYER_RPC_PROTOCOL="flowplayer://",Iframe.ATTACHED=!1,Iframe.is_flowplayer_message=function(e){return"string"==typeof e&&e.startsWith(Iframe.FLOWPLAYER_RPC_PROTOCOL)},Iframe.message_body=function(e){return e.slice(Iframe.FLOWPLAYER_RPC_PROTOCOL.length)},function(){try{return window.self!==window.top}catch(e){return!0}}()&&function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;if(null===document.currentScript)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;"function"==typeof t?t(n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n))}(window,Iframe);return Iframe}));
|
package/plugins/keyboard.d.ts
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import type { MediaKeyFunc } from 'hls.js';
|
|
2
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 enum AutoplayOpts {
|
|
8
|
+
OFF = 0,
|
|
9
|
+
ON = 1,
|
|
10
|
+
AUDIO_REQUIRED = 2
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
declare type BitOpts = number;
|
|
4
14
|
|
|
15
|
+
declare type Component = {
|
|
16
|
+
onrender?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
17
|
+
onremove?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
declare interface Components {
|
|
21
|
+
render(key: string, args: any[]): void;
|
|
22
|
+
remove(key: string, args: any[]): void;
|
|
23
|
+
put(key: string, args: Component): void;
|
|
24
|
+
}
|
|
25
|
+
|
|
5
26
|
declare interface Config {
|
|
6
27
|
src?: UnsafeSource;
|
|
7
28
|
preload?: "none" | "metadata" | "auto";
|
|
@@ -52,6 +73,11 @@ declare interface Config {
|
|
|
52
73
|
seconds_to_dvr?: number;
|
|
53
74
|
}
|
|
54
75
|
|
|
76
|
+
declare type CustomConfig<T> = Config & T;
|
|
77
|
+
|
|
78
|
+
declare const _default: PluginCtor<KeyValue>;
|
|
79
|
+
export default _default;
|
|
80
|
+
|
|
55
81
|
declare type DeviceId = string;
|
|
56
82
|
|
|
57
83
|
declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
|
|
@@ -79,6 +105,39 @@ declare type DRMVendorImplementation = {
|
|
|
79
105
|
|
|
80
106
|
declare type FlowplayerCustomElementRegistry = Map<string, string>;
|
|
81
107
|
|
|
108
|
+
declare interface FlowplayerUMD extends FlowplayerUMDBase {
|
|
109
|
+
(selector: string, config?: Config): Player;
|
|
110
|
+
(element: HTMLElement, config?: Config): Player;
|
|
111
|
+
<T>(selector: string, config?: CustomConfig<T>): Player;
|
|
112
|
+
<T>(element: HTMLElement, config?: CustomConfig<T>): Player;
|
|
113
|
+
<PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<CustomConfig<MergeConfigs<PluginCtors>>>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare interface FlowplayerUMDBase {
|
|
117
|
+
instances: Player[];
|
|
118
|
+
extensions: PluginCtor[];
|
|
119
|
+
events: Record<string, string>;
|
|
120
|
+
ads?: {
|
|
121
|
+
events: Record<string, string>;
|
|
122
|
+
};
|
|
123
|
+
states: Record<string, string>;
|
|
124
|
+
quality: typeof QualityOpts;
|
|
125
|
+
commit: string;
|
|
126
|
+
version: string;
|
|
127
|
+
customElements: FlowplayerCustomElementRegistry;
|
|
128
|
+
defaultElements: Record<string, string>;
|
|
129
|
+
components: Components;
|
|
130
|
+
support: any;
|
|
131
|
+
autoplay: typeof AutoplayOpts;
|
|
132
|
+
jwt: any;
|
|
133
|
+
loaders: any;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config> extends FlowplayerUMDBase {
|
|
137
|
+
(selector: string, config?: ConfigWithPlugins): Player;
|
|
138
|
+
(element: HTMLElement, config?: ConfigWithPlugins): Player;
|
|
139
|
+
}
|
|
140
|
+
|
|
82
141
|
declare interface FPEvent<T> extends CustomEvent<T> {
|
|
83
142
|
/**
|
|
84
143
|
* @deprecated
|
|
@@ -90,11 +149,6 @@ declare interface FPEvent<T> extends CustomEvent<T> {
|
|
|
90
149
|
|
|
91
150
|
declare type JSONPlayer = any;
|
|
92
151
|
|
|
93
|
-
declare class Keyboard implements Plugin_2 {
|
|
94
|
-
init(_config: Config, _root: PlayerRoot, _: Player): void;
|
|
95
|
-
}
|
|
96
|
-
export default Keyboard;
|
|
97
|
-
|
|
98
152
|
declare type KeyValue = Record<string, any>;
|
|
99
153
|
|
|
100
154
|
declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Plugin_2<PluginOwnConfig> {
|
|
@@ -103,6 +157,12 @@ declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Pl
|
|
|
103
157
|
wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
|
|
104
158
|
}
|
|
105
159
|
|
|
160
|
+
declare type MapToConfigs<Arr extends PluginCtor[]> = {
|
|
161
|
+
[PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
|
|
165
|
+
|
|
106
166
|
declare interface Player extends HTMLVideoElement {
|
|
107
167
|
renderPlugin: (pluginContainer: HTMLElement) => void;
|
|
108
168
|
toggleDisable: (flag: boolean) => void;
|
|
@@ -167,6 +227,16 @@ declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
|
167
227
|
|
|
168
228
|
declare type PluginConfig<T> = Config & T;
|
|
169
229
|
|
|
230
|
+
declare interface PluginCtor<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
231
|
+
new (umd: FlowplayerUMD, player: Player): AnyPlugin<PluginOwnConfig>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare enum QualityOpts {
|
|
235
|
+
LOW = 1,
|
|
236
|
+
MEDIUM = 2,
|
|
237
|
+
HIGH = 4
|
|
238
|
+
}
|
|
239
|
+
|
|
170
240
|
declare type SourceObj = {
|
|
171
241
|
src?: SourceStr;
|
|
172
242
|
type?: string;
|
package/plugins/keyboard.js
CHANGED
|
@@ -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.keyboard=t())}(this,(function(){"use strict";function e(e,t,n){const r=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;r.length;){if(null==e)return n;const t=r.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}var t={TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",SPACE:" ",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",F:"f",H:"h",J:"j",K:"k",L:"l",M:"m"};function n(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector("details[open].fp-menu-container");n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(n(),this.active_menu=void 0)}));let r=void 0;function o(e){e.setState("is-kb-active",!0),clearTimeout(r),r=setTimeout((function(){e.setState("is-kb-active",!1)}),2500)}function i(e,t){e.enqueueSeek(t)&&o(e)}const u="flowplayer-ad-ui";let a=void 0;const l=[t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT,t.ARROW_DOWN],s=[t.SPACE,t.F,t.ESCAPE,t.M,t.ARROW_UP,t.ARROW_DOWN,t.ARROW_RIGHT,t.ARROW_LEFT,t.H,t.J,t.K,t.L];function c(e,t){e.volume=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.volume+t,1,0),o(e)}function f(e){e.preventDefault(),e.stopPropagation()}function d(r){var o,a;const d=r.key,R=p(),
|
|
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.keyboard=t())}(this,(function(){"use strict";function e(e,t,n){const r=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;r.length;){if(null==e)return n;const t=r.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}var t={TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",SPACE:" ",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",F:"f",H:"h",J:"j",K:"k",L:"l",M:"m"};function n(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector("details[open].fp-menu-container");n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(n(),this.active_menu=void 0)}));let r=void 0;function o(e){e.setState("is-kb-active",!0),clearTimeout(r),r=setTimeout((function(){e.setState("is-kb-active",!1)}),2500)}function i(e,t){e.enqueueSeek(t)&&o(e)}const u="flowplayer-ad-ui";let a=void 0;const l=[t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT,t.ARROW_DOWN],s=[t.SPACE,t.F,t.ESCAPE,t.M,t.ARROW_UP,t.ARROW_DOWN,t.ARROW_RIGHT,t.ARROW_LEFT,t.H,t.J,t.K,t.L];function c(e,t){e.volume=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.volume+t,1,0),o(e)}function f(e){e.preventDefault(),e.stopPropagation()}function d(r){var o,a;const d=r.key,R=p(),A=document.activeElement;if(!A)return;if(d===t.TAB){if(!R)return;if(R.setState("is-hovered",!0),R.setState("is-accessibility",!0),!function(e){var t,n;return!(!e.hasState("ad-paused")&&!e.hasState("ad-playing")||!(null===(n=null===(t=null==e?void 0:e.ads)||void 0===t?void 0:t.adapter)||void 0===n?void 0:n.isLinearAd()))}(R)||y(A,u))return;const e=R.root.querySelector(u);if(!e)return;if(R.hasState("ad-playing"))return null===(o=e.querySelector(".fp-small-pause"))||void 0===o?void 0:o.focus();if(R.hasState("ad-paused"))return null===(a=e.querySelector(".fp-small-play"))||void 0===a?void 0:a.focus()}if((d===t.SPACE||d===t.ENTER)&&A.hasAttribute("tabindex")&&(y(A,".flowplayer")||y(A,"flowplayer-playlist-controls")))return null==A||A.dispatchEvent(new CustomEvent("click",{cancelable:!0,bubbles:!0})),f(r);if((d===t.ARROW_DOWN||d===t.ARROW_UP||d===t.ESCAPE)&&(y(A,".fp-menu-container")||y(A,"flowplayer-playlist-controls"))){if(d===t.ARROW_DOWN&&A.nextSibling)return A.nextSibling.focus();if(d===t.ARROW_UP&&A.previousSibling)return A.previousSibling.focus();if(d===t.ESCAPE){const e=new CustomEvent("keyboard:close:menus",{cancelable:!0});if(null==R||R.dispatchEvent(e),e.defaultPrevented)return;return n()}}if(!R)return;let m=e(R,"opts.keyboard.seek_step",5);if(m<1&&(m=Math.round(m*R.duration)),~l.indexOf(d)&&A.hasAttribute("aria-valuenow")){const e=~[t.ARROW_UP,t.ARROW_RIGHT].indexOf(d);if(A.matches(".fp-volume"))return c(R,e?.15:-.15),f(r);if(A.matches(".fp-timeline"))return i(R,e?m:-1*m),f(r)}if(!1===function(e,t){return!(t.altKey||t.shiftKey||t.metaKey||t.ctrlKey)&&(!!(e&&e.hasState("is-in-viewport")&&e.started)&&(!!e.root&&void 0))}(R,r))return;const v=!R.hasState("no-timeline");switch(~s.indexOf(d)&&r.preventDefault(),d){case t.SPACE:return R.togglePlay();case t.F:return R.toggleFullScreen();case t.ESCAPE:return R.hasState("is-fullscreen")?R.toggleFullScreen(!1):(null==A||A.blur(),R.setState("is-hovered",!1),R.setState("is-accessibility",!1));case t.M:return R.toggleMute();case t.ARROW_UP:case t.K:return c(R,.15);case t.ARROW_DOWN:case t.J:return c(R,-.15);case t.ARROW_RIGHT:case t.L:return v&&i(R,m);case t.ARROW_LEFT:case t.H:return v&&i(R,-1*m)}}function R(e){setTimeout((function(){e.defaultPrevented||d(e)}),0)}function p(){return A().find(e=>function(e){let t=document.activeElement;for(;t;){if(t===e)return!0;t=t.parentElement}return!1}(e.root))||A().find(e=>document.activeElement===document.body&&e.root.hasFocus)}function A(){return Array.from(document.querySelectorAll(".fp-engine"))}function y(e,t){return!!function(e,t){return e.closest(t)}(e,t)}document.addEventListener("keydown",(function(e){if(e.key===t.TAB)return R(e);if(a=p(),a)return function(e,n){const r=document.activeElement;if(e.key===t.F&&n.root.classList.contains("no-fullscreen"))return;if([t.SPACE,t.ARROW_DOWN,t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT].includes(e.key)||r&&y(r,".fp-menu-container")&&e.key===t.ENTER)return e.preventDefault(),d(e);R(e)}(e,a);const n=document.activeElement;[t.SPACE,t.ENTER,t.ARROW_DOWN,t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT].includes(e.key)&&n&&y(n,"flowplayer-playlist-controls")&&(e.preventDefault(),d(e))})),document.addEventListener("click",(function(e){const t=e.composedPath();A().forEach(e=>{e.root.hasFocus=t.includes(e.root)})}));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 n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,class Keyboard{init(e,t,n){}})}));
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import type { MediaKeyFunc } from 'hls.js';
|
|
2
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 enum AutoplayOpts {
|
|
8
|
+
OFF = 0,
|
|
9
|
+
ON = 1,
|
|
10
|
+
AUDIO_REQUIRED = 2
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
declare type BitOpts = number;
|
|
4
14
|
|
|
15
|
+
declare type Component = {
|
|
16
|
+
onrender?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
17
|
+
onremove?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
declare interface Components {
|
|
21
|
+
render(key: string, args: any[]): void;
|
|
22
|
+
remove(key: string, args: any[]): void;
|
|
23
|
+
put(key: string, args: Component): void;
|
|
24
|
+
}
|
|
25
|
+
|
|
5
26
|
declare interface Config {
|
|
6
27
|
src?: UnsafeSource;
|
|
7
28
|
preload?: "none" | "metadata" | "auto";
|
|
@@ -52,6 +73,11 @@ declare interface Config {
|
|
|
52
73
|
seconds_to_dvr?: number;
|
|
53
74
|
}
|
|
54
75
|
|
|
76
|
+
declare type CustomConfig<T> = Config & T;
|
|
77
|
+
|
|
78
|
+
declare const _default: PluginCtor<KeyValue>;
|
|
79
|
+
export default _default;
|
|
80
|
+
|
|
55
81
|
declare type DeviceId = string;
|
|
56
82
|
|
|
57
83
|
declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
|
|
@@ -79,6 +105,39 @@ declare type DRMVendorImplementation = {
|
|
|
79
105
|
|
|
80
106
|
declare type FlowplayerCustomElementRegistry = Map<string, string>;
|
|
81
107
|
|
|
108
|
+
declare interface FlowplayerUMD extends FlowplayerUMDBase {
|
|
109
|
+
(selector: string, config?: Config): Player;
|
|
110
|
+
(element: HTMLElement, config?: Config): Player;
|
|
111
|
+
<T>(selector: string, config?: CustomConfig<T>): Player;
|
|
112
|
+
<T>(element: HTMLElement, config?: CustomConfig<T>): Player;
|
|
113
|
+
<PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<CustomConfig<MergeConfigs<PluginCtors>>>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare interface FlowplayerUMDBase {
|
|
117
|
+
instances: Player[];
|
|
118
|
+
extensions: PluginCtor[];
|
|
119
|
+
events: Record<string, string>;
|
|
120
|
+
ads?: {
|
|
121
|
+
events: Record<string, string>;
|
|
122
|
+
};
|
|
123
|
+
states: Record<string, string>;
|
|
124
|
+
quality: typeof QualityOpts;
|
|
125
|
+
commit: string;
|
|
126
|
+
version: string;
|
|
127
|
+
customElements: FlowplayerCustomElementRegistry;
|
|
128
|
+
defaultElements: Record<string, string>;
|
|
129
|
+
components: Components;
|
|
130
|
+
support: any;
|
|
131
|
+
autoplay: typeof AutoplayOpts;
|
|
132
|
+
jwt: any;
|
|
133
|
+
loaders: any;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config> extends FlowplayerUMDBase {
|
|
137
|
+
(selector: string, config?: ConfigWithPlugins): Player;
|
|
138
|
+
(element: HTMLElement, config?: ConfigWithPlugins): Player;
|
|
139
|
+
}
|
|
140
|
+
|
|
82
141
|
declare interface FPEvent<T> extends CustomEvent<T> {
|
|
83
142
|
/**
|
|
84
143
|
* @deprecated
|
|
@@ -98,10 +157,11 @@ declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Pl
|
|
|
98
157
|
wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
|
|
99
158
|
}
|
|
100
159
|
|
|
101
|
-
declare
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
160
|
+
declare type MapToConfigs<Arr extends PluginCtor[]> = {
|
|
161
|
+
[PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
|
|
105
165
|
|
|
106
166
|
declare interface Player extends HTMLVideoElement {
|
|
107
167
|
renderPlugin: (pluginContainer: HTMLElement) => void;
|
|
@@ -167,6 +227,16 @@ declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
|
167
227
|
|
|
168
228
|
declare type PluginConfig<T> = Config & T;
|
|
169
229
|
|
|
230
|
+
declare interface PluginCtor<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
231
|
+
new (umd: FlowplayerUMD, player: Player): AnyPlugin<PluginOwnConfig>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare enum QualityOpts {
|
|
235
|
+
LOW = 1,
|
|
236
|
+
MEDIUM = 2,
|
|
237
|
+
HIGH = 4
|
|
238
|
+
}
|
|
239
|
+
|
|
170
240
|
declare type SourceObj = {
|
|
171
241
|
src?: SourceStr;
|
|
172
242
|
type?: string;
|
package/plugins/media-session.js
CHANGED
|
@@ -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.media_session=t())}(this,(function(){"use strict";let e=void 0;function t(t,n){t.enqueueSeek(n)&&function(t){t.setState("is-kb-active",!0),clearTimeout(e),e=setTimeout((function(){t.setState("is-kb-active",!1)}),2500)}(t)}const n="pause",i="playing",o="seeked";var a="playlist:next";let s=void 0;function l(e){e.data&&r(e.data)}function r(e){var t,n,i;const o=null!==(t=e.media_session)&&void 0!==t?t:{};if(null!==(n=o.title)&&void 0!==n||(o.title=e.title),null==o.artwork){const t=null!==(i=e.poster)&&void 0!==i?i:"";o.artwork=[{src:t,sizes:"512x512"},{src:t,sizes:"256x256"}]}navigator.mediaSession.metadata=new MediaMetadata(o)}function c(){const e=navigator.mediaSession;if(null==e.setPositionState)return;const t=s;t&&(e.setPositionState({duration:Math.round(t.duration||0),playbackRate:t.hasState("is-playing")?t.playbackRate:.001,position:Math.round(t.currentTime)}),e.playbackState=t.hasState("is-playing")?"playing":"paused")}function u(e){const n=s,i=navigator.mediaSession;if(n){if(i.setActionHandler("play",(function(){n.togglePlay()})),i.setActionHandler("pause",(function(){n.togglePlay()})),"playlist"in n){const e=n.playlist;i.setActionHandler("nexttrack",(function(){e&&e.next()})),i.setActionHandler("previoustrack",(function(){e&&e.prev()}))}!function(e,n){var i,o;if(null!==(i=n.seekable)&&void 0!==i&&!i||e.hasState("no-timeline"))return;const a=navigator.mediaSession,s=null!==(o=n.seek_step)&&void 0!==o?o:5;e.disabled||a.setActionHandler("seekforward",(function(){t(e,s)}));a.setActionHandler("seekbackward",(function(){t(e,-s)}));try{a.setActionHandler("seekto",(function(t){"number"==typeof t.seekTime&&(t.seekTime>e.currentTime&&e.disabled?c():t&&t.seekTime<e.duration&&(e.currentTime=t.seekTime))}))}catch(e){}}(n,e)}}class MediaSession{init(e,t,d){null!=navigator.mediaSession&&d.on(["loadstart",i,"fullscreenenter"],(function(){let t=s;d!==t&&(t&&(["ratechange",o,i,n].forEach(e=>{t&&t.off(e,c)}),t.off(a,l),t=void 0),s=d,r(e),u(e),c(),d.on(["ratechange",o,i,n],c),d.on(a,l))}))}}
|
|
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.media_session=t())}(this,(function(){"use strict";let e=void 0;function t(t,n){t.enqueueSeek(n)&&function(t){t.setState("is-kb-active",!0),clearTimeout(e),e=setTimeout((function(){t.setState("is-kb-active",!1)}),2500)}(t)}const n="pause",i="playing",o="seeked";var a="playlist:next";let s=void 0;function l(e){e.data&&r(e.data)}function r(e){var t,n,i;const o=null!==(t=e.media_session)&&void 0!==t?t:{};if(null!==(n=o.title)&&void 0!==n||(o.title=e.title),null==o.artwork){const t=null!==(i=e.poster)&&void 0!==i?i:"";o.artwork=[{src:t,sizes:"512x512"},{src:t,sizes:"256x256"}]}navigator.mediaSession.metadata=new MediaMetadata(o)}function c(){const e=navigator.mediaSession;if(null==e.setPositionState)return;const t=s;t&&(e.setPositionState({duration:Math.round(t.duration||0),playbackRate:t.hasState("is-playing")?t.playbackRate:.001,position:Math.round(t.currentTime)}),e.playbackState=t.hasState("is-playing")?"playing":"paused")}function u(e){const n=s,i=navigator.mediaSession;if(n){if(i.setActionHandler("play",(function(){n.togglePlay()})),i.setActionHandler("pause",(function(){n.togglePlay()})),"playlist"in n){const e=n.playlist;i.setActionHandler("nexttrack",(function(){e&&e.next()})),i.setActionHandler("previoustrack",(function(){e&&e.prev()}))}!function(e,n){var i,o;if(null!==(i=n.seekable)&&void 0!==i&&!i||e.hasState("no-timeline"))return;const a=navigator.mediaSession,s=null!==(o=n.seek_step)&&void 0!==o?o:5;e.disabled||a.setActionHandler("seekforward",(function(){t(e,s)}));a.setActionHandler("seekbackward",(function(){t(e,-s)}));try{a.setActionHandler("seekto",(function(t){"number"==typeof t.seekTime&&(t.seekTime>e.currentTime&&e.disabled?c():t&&t.seekTime<e.duration&&(e.currentTime=t.seekTime))}))}catch(e){}}(n,e)}}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 n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,class MediaSession{init(e,t,d){null!=navigator.mediaSession&&d.on(["loadstart",i,"fullscreenenter"],(function(){let t=s;d!==t&&(t&&(["ratechange",o,i,n].forEach(e=>{t&&t.off(e,c)}),t.off(a,l),t=void 0),s=d,r(e),u(e),c(),d.on(["ratechange",o,i,n],c),d.on(a,l))}))}})}));
|
package/plugins/message.d.ts
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import type { MediaKeyFunc } from 'hls.js';
|
|
2
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 enum AutoplayOpts {
|
|
8
|
+
OFF = 0,
|
|
9
|
+
ON = 1,
|
|
10
|
+
AUDIO_REQUIRED = 2
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
declare type BitOpts = number;
|
|
4
14
|
|
|
15
|
+
declare type Component = {
|
|
16
|
+
onrender?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
17
|
+
onremove?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
declare interface Components {
|
|
21
|
+
render(key: string, args: any[]): void;
|
|
22
|
+
remove(key: string, args: any[]): void;
|
|
23
|
+
put(key: string, args: Component): void;
|
|
24
|
+
}
|
|
25
|
+
|
|
5
26
|
declare interface Config {
|
|
6
27
|
src?: UnsafeSource;
|
|
7
28
|
preload?: "none" | "metadata" | "auto";
|
|
@@ -52,6 +73,11 @@ declare interface Config {
|
|
|
52
73
|
seconds_to_dvr?: number;
|
|
53
74
|
}
|
|
54
75
|
|
|
76
|
+
declare type CustomConfig<T> = Config & T;
|
|
77
|
+
|
|
78
|
+
declare const _default: PluginCtor<KeyValue>;
|
|
79
|
+
export default _default;
|
|
80
|
+
|
|
55
81
|
declare type DeviceId = string;
|
|
56
82
|
|
|
57
83
|
declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
|
|
@@ -79,6 +105,39 @@ declare type DRMVendorImplementation = {
|
|
|
79
105
|
|
|
80
106
|
declare type FlowplayerCustomElementRegistry = Map<string, string>;
|
|
81
107
|
|
|
108
|
+
declare interface FlowplayerUMD extends FlowplayerUMDBase {
|
|
109
|
+
(selector: string, config?: Config): Player;
|
|
110
|
+
(element: HTMLElement, config?: Config): Player;
|
|
111
|
+
<T>(selector: string, config?: CustomConfig<T>): Player;
|
|
112
|
+
<T>(element: HTMLElement, config?: CustomConfig<T>): Player;
|
|
113
|
+
<PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<CustomConfig<MergeConfigs<PluginCtors>>>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare interface FlowplayerUMDBase {
|
|
117
|
+
instances: Player[];
|
|
118
|
+
extensions: PluginCtor[];
|
|
119
|
+
events: Record<string, string>;
|
|
120
|
+
ads?: {
|
|
121
|
+
events: Record<string, string>;
|
|
122
|
+
};
|
|
123
|
+
states: Record<string, string>;
|
|
124
|
+
quality: typeof QualityOpts;
|
|
125
|
+
commit: string;
|
|
126
|
+
version: string;
|
|
127
|
+
customElements: FlowplayerCustomElementRegistry;
|
|
128
|
+
defaultElements: Record<string, string>;
|
|
129
|
+
components: Components;
|
|
130
|
+
support: any;
|
|
131
|
+
autoplay: typeof AutoplayOpts;
|
|
132
|
+
jwt: any;
|
|
133
|
+
loaders: any;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config> extends FlowplayerUMDBase {
|
|
137
|
+
(selector: string, config?: ConfigWithPlugins): Player;
|
|
138
|
+
(element: HTMLElement, config?: ConfigWithPlugins): Player;
|
|
139
|
+
}
|
|
140
|
+
|
|
82
141
|
declare interface FPEvent<T> extends CustomEvent<T> {
|
|
83
142
|
/**
|
|
84
143
|
* @deprecated
|
|
@@ -98,14 +157,11 @@ declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Pl
|
|
|
98
157
|
wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
|
|
99
158
|
}
|
|
100
159
|
|
|
101
|
-
declare
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
init(config: Config, root: PlayerRoot, player: Player): void;
|
|
107
|
-
}
|
|
108
|
-
export default Message;
|
|
160
|
+
declare type MapToConfigs<Arr extends PluginCtor[]> = {
|
|
161
|
+
[PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
|
|
109
165
|
|
|
110
166
|
declare interface Player extends HTMLVideoElement {
|
|
111
167
|
renderPlugin: (pluginContainer: HTMLElement) => void;
|
|
@@ -171,6 +227,16 @@ declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
|
171
227
|
|
|
172
228
|
declare type PluginConfig<T> = Config & T;
|
|
173
229
|
|
|
230
|
+
declare interface PluginCtor<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
231
|
+
new (umd: FlowplayerUMD, player: Player): AnyPlugin<PluginOwnConfig>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare enum QualityOpts {
|
|
235
|
+
LOW = 1,
|
|
236
|
+
MEDIUM = 2,
|
|
237
|
+
HIGH = 4
|
|
238
|
+
}
|
|
239
|
+
|
|
174
240
|
declare type SourceObj = {
|
|
175
241
|
src?: SourceStr;
|
|
176
242
|
type?: string;
|
package/plugins/message.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.message=s())}(this,(function(){"use strict";const e=/<trans(.*)trans>/;class Message{init(s,t,n){let o="";n.on("message:show",(function(s){var i,a,d;const f=null===(i=s.data)||void 0===i?void 0:i.sticky,l=null===(a=s.data)||void 0===a?void 0:a.timeout;let r=(null===(d=s.data)||void 0===d?void 0:d.message)||"";if(r==o)return;if(o=r||"",e.test(r)){const s=e.exec(r)||["",""];r=n.i18n(s[1].trim())}const u=document.createElement("div");u.classList.add("fp-message");const c=document.createElement("p");c.innerText=r,u.append(c),t.append(u),setTimeout((function(){u.classList.add("fp-shown")}),100),f||setTimeout((function(){n.emit("message:dismiss",u)}),l)})),n.on("message:dismiss",(function(e){o="";const s=e.data;s&&(s.classList.remove("fp-shown"),setTimeout((function(){s.remove()}),1e3))})),n.message={events:Message.events}}}return Message.events={SHOW_MESSAGE:"message:show",DISMISS_MESSAGE:"message:dismiss"},function(e,s){if("object"==typeof exports&&"undefined"!=typeof module)return s;if(null===document.currentScript)return s;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;"function"==typeof t?t(s):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(s)||t.extensions.push(s))}(window,Message)
|
|
1
|
+
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.message=s())}(this,(function(){"use strict";const e=/<trans(.*)trans>/;class Message{init(s,t,n){let o="";n.on("message:show",(function(s){var i,a,d;const f=null===(i=s.data)||void 0===i?void 0:i.sticky,l=null===(a=s.data)||void 0===a?void 0:a.timeout;let r=(null===(d=s.data)||void 0===d?void 0:d.message)||"";if(r==o)return;if(o=r||"",e.test(r)){const s=e.exec(r)||["",""];r=n.i18n(s[1].trim())}const u=document.createElement("div");u.classList.add("fp-message");const c=document.createElement("p");c.innerText=r,u.append(c),t.append(u),setTimeout((function(){u.classList.add("fp-shown")}),100),f||setTimeout((function(){n.emit("message:dismiss",u)}),l)})),n.on("message:dismiss",(function(e){o="";const s=e.data;s&&(s.classList.remove("fp-shown"),setTimeout((function(){s.remove()}),1e3))})),n.message={events:Message.events}}}return Message.events={SHOW_MESSAGE:"message:show",DISMISS_MESSAGE:"message:dismiss"},function(e,s){if("object"==typeof exports&&"undefined"!=typeof module)return s;if(null===document.currentScript)return s;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;return"function"==typeof t?(t(s),s):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(s)||t.extensions.push(s),s)}(window,Message)}));
|