@flowplayer/player 3.11.2-rc.2 → 3.11.2-rc.3

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.
@@ -2,14 +2,6 @@ import type { MediaKeyFunc } from 'hls.js';
2
2
 
3
3
  declare type AnyPlugin<PluginOwnConfig extends KeyValue> = Plugin_2<PluginOwnConfig> | Loader<PluginOwnConfig>;
4
4
 
5
- declare namespace apps {
6
- export {
7
- STABLE,
8
- CANARY,
9
- LOCAL
10
- }
11
- }
12
-
13
5
  declare type ArrayToIntersection<T extends Array<unknown>> = T extends [infer Current, ...infer Remaining] ? Current & ArrayToIntersection<Remaining> : unknown;
14
6
 
15
7
  declare enum AutoplayOpts {
@@ -18,36 +10,21 @@ declare enum AutoplayOpts {
18
10
  AUDIO_REQUIRED = 2
19
11
  }
20
12
 
21
- declare type BitOpts = number;
22
-
23
- declare const CANARY = "6F71FA7C";
24
-
25
- declare const CAST_AVAILABLE = "chromecast:available";
26
-
27
- declare const CAST_FIELD_UPDATE = "chromecast:field:update";
13
+ declare function avail(): boolean;
28
14
 
29
- declare const CAST_IDLE = "chromecast:idle";
30
-
31
- declare const CAST_MEDIA_LOAD_REQUEST = "chromecast:media";
32
-
33
- declare const CAST_SESSION_CHANGED = "chromecast:session:changed";
34
-
35
- declare const CAST_START_CASTING = "chromecast:start";
36
-
37
- declare const CAST_STATE_CHANGED = "chromecast:state:changed";
15
+ declare type BitOpts = number;
38
16
 
39
- declare const CAST_UNAVAILABLE = "chromecast:unavailable";
17
+ declare function broadcast_status(instances: Player[]): void;
40
18
 
41
- declare namespace CastEvents {
19
+ declare namespace CastAssets {
42
20
  export {
43
- CAST_AVAILABLE,
44
- CAST_UNAVAILABLE,
45
- CAST_START_CASTING,
46
- CAST_IDLE,
47
- CAST_STATE_CHANGED,
48
- CAST_SESSION_CHANGED,
49
- CAST_FIELD_UPDATE,
50
- CAST_MEDIA_LOAD_REQUEST
21
+ load,
22
+ loaded,
23
+ avail,
24
+ broadcast_status,
25
+ onfirstload,
26
+ ChromecastConfigObject,
27
+ ChromecastConfig
51
28
  }
52
29
  }
53
30
 
@@ -60,21 +37,6 @@ declare interface ChromecastConfigObject {
60
37
  app?: string;
61
38
  }
62
39
 
63
- declare class ChromecastPlugin implements Plugin_2 {
64
- static apps: typeof apps;
65
- static events: typeof CastEvents;
66
- flowplayer: FlowplayerUMD;
67
- constructor(flowplayer: FlowplayerUMD);
68
- init(config: ChromecastConfig, root: PlayerRoot, video: ChromePlayer): void;
69
- reset_state(video: ChromePlayer): void;
70
- }
71
-
72
- declare type ChromePlayer = PlayerWith<{
73
- chromecast: ChromecastPlugin;
74
- sender?: Sender;
75
- currentSessionTime: number;
76
- }>;
77
-
78
40
  declare type Component = {
79
41
  onrender?: (config: Config, root: PlayerRoot, player: Player) => void;
80
42
  onremove?: (config: Config, root: PlayerRoot, player: Player) => void;
@@ -150,7 +112,9 @@ declare type ConfigWith<T> = Configs.Config & T;
150
112
 
151
113
  declare type CustomConfig<T> = Config & T;
152
114
 
153
- declare const _default: typeof ChromecastPlugin;
115
+ declare const _default: PluginCtor< {
116
+ chromecast?: CastAssets.ChromecastConfigObject | undefined;
117
+ }>;
154
118
  export default _default;
155
119
 
156
120
  declare type DeviceId = string;
@@ -226,20 +190,24 @@ declare type JSONPlayer = any;
226
190
 
227
191
  declare type KeyValue = Record<string, any>;
228
192
 
193
+ declare function load(config: ChromecastConfig, video: Player, instances: Player[]): void;
194
+
195
+ declare function loaded(): boolean;
196
+
229
197
  declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Plugin_2<PluginOwnConfig> {
230
198
  onload<T = KeyValue>(config: PluginConfig<T>, root: PlayerRoot, video: Player, src?: SourceObj): void;
231
199
  wants<S = SourceObj, T = KeyValue>(srcString: SourceStr, srcObj: S, config: PluginConfig<T>): boolean;
232
200
  wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
233
201
  }
234
202
 
235
- declare const LOCAL = "5258CA32";
236
-
237
203
  declare type MapToConfigs<Arr extends PluginCtor[]> = {
238
204
  [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
239
205
  };
240
206
 
241
207
  declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
242
208
 
209
+ declare function onfirstload(config: ChromecastConfig, video: Player, instances: Player[]): void;
210
+
243
211
  declare interface Player extends HTMLVideoElement {
244
212
  renderPlugin: (pluginContainer: HTMLElement) => void;
245
213
  toggleDisable: (flag: boolean) => void;
@@ -292,26 +260,8 @@ declare type PlayerRoot = HTMLElement & {
292
260
  prevWidth?: number;
293
261
  };
294
262
 
295
- declare namespace Players {
296
- export {
297
- VideoTrack,
298
- PlayerState,
299
- FPEvent,
300
- DeviceId,
301
- JSONPlayer,
302
- PlayerRoot,
303
- Player
304
- }
305
- }
306
-
307
263
  declare type PlayerState = string;
308
264
 
309
- declare type PlayerWith<T> = Players.Player & T;
310
-
311
- declare type PlayerWithSender = PlayerWith<{
312
- sender?: Sender;
313
- }>;
314
-
315
265
  declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
316
266
  /**
317
267
  * a plugin must always implement the init method so a player instance knows how to initialize it
@@ -332,16 +282,6 @@ declare enum QualityOpts {
332
282
  HIGH = 4
333
283
  }
334
284
 
335
- declare class Sender {
336
- video?: Player;
337
- constructor(video: PlayerWithSender);
338
- static of(video: PlayerWithSender): Sender;
339
- static maybe(video: PlayerWithSender, cb: (sender: Sender, video: PlayerWithSender) => void): void;
340
- static getEstimatedTime(): number | undefined;
341
- static load(video: PlayerWithSender, instances: Player[]): void;
342
- static destroy(sender: Sender): void;
343
- }
344
-
345
285
  declare type SourceObj = {
346
286
  src?: SourceStr;
347
287
  type?: string;
@@ -352,8 +292,6 @@ declare type SourceStr = string;
352
292
 
353
293
  declare type SourceWith<T> = SourceObj & T;
354
294
 
355
- declare const STABLE = "940D4BE4";
356
-
357
295
  declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
358
296
 
359
297
  declare interface VideoTrack {
@@ -73,37 +73,11 @@ declare interface Config {
73
73
  seconds_to_dvr?: number;
74
74
  }
75
75
 
76
- declare namespace Configs {
77
- export {
78
- BitOpts,
79
- FlowplayerCustomElementRegistry,
80
- Config,
81
- CustomConfig,
82
- PluginConfig
83
- }
84
- }
85
-
86
- declare type ConfigWith<T> = Configs.Config & T;
87
-
88
- declare type ConsentConfig = ConfigWith<{
89
- consent?: number;
90
- }>;
91
-
92
- declare class ConsentPlugin implements Plugin_2 {
93
- static tracking: typeof TrackingConfig;
94
- static storage: typeof StorageConfig;
95
- player: PlayerWithHealthAPI;
96
- current_value: number;
97
- constructor(_umd: FlowplayerUMD, player: Player);
98
- init(config: ConsentConfig, _container: PlayerRoot, player: Player): void;
99
- adapt(config: ConsentConfig): void;
100
- setStorage(flag: StorageConfig): void;
101
- setTracking(flag: TrackingConfig): void;
102
- }
103
-
104
76
  declare type CustomConfig<T> = Config & T;
105
77
 
106
- declare const _default: typeof ConsentPlugin;
78
+ declare const _default: PluginCtor< {
79
+ consent?: number | undefined;
80
+ }>;
107
81
  export default _default;
108
82
 
109
83
  declare type DeviceId = string;
@@ -245,14 +219,6 @@ declare type PlayerRoot = HTMLElement & {
245
219
 
246
220
  declare type PlayerState = string;
247
221
 
248
- declare type PlayerWithHealthAPI = Player & {
249
- health?: {
250
- media_session_id: string;
251
- session_id: string;
252
- toggle: (flag: boolean) => void;
253
- };
254
- };
255
-
256
222
  declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
257
223
  /**
258
224
  * a plugin must always implement the init method so a player instance knows how to initialize it
@@ -283,16 +249,6 @@ declare type SourceStr = string;
283
249
 
284
250
  declare type SourceWith<T> = SourceObj & T;
285
251
 
286
- declare enum StorageConfig {
287
- ALL = 8,
288
- NONE = 16
289
- }
290
-
291
- declare enum TrackingConfig {
292
- ALL = 1,
293
- NONE = 2
294
- }
295
-
296
252
  declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
297
253
 
298
254
  declare interface VideoTrack {
@@ -94,11 +94,6 @@ export declare type CueAttrs = {
94
94
 
95
95
  export declare type CuepointList = Array<CueAttrs>;
96
96
 
97
- declare class Cuepoints implements Plugin_2<CuepointsConfig> {
98
- constructor(umd: FlowplayerUMD);
99
- init(opts: CuepointsConfig, root: PlayerRoot, video: Player): void;
100
- }
101
-
102
97
  export declare type CuepointsConfig = ConfigWith<CuepointsConfigNamespaced>;
103
98
 
104
99
  declare type CuepointsConfigNamespaced = {
@@ -108,7 +103,7 @@ declare type CuepointsConfigNamespaced = {
108
103
 
109
104
  declare type CustomConfig<T> = Config & T;
110
105
 
111
- declare const _default: typeof Cuepoints;
106
+ declare const _default: PluginCtor<CuepointsConfigNamespaced>;
112
107
  export default _default;
113
108
 
114
109
  declare type DeviceId = string;
package/plugins/dash.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { MediaKeyFunc } from 'hls.js';
2
2
  import { MediaPlayer } from 'dashjs';
3
3
  import type { MediaPlayerClass } from 'dashjs';
4
+ import { MediaSettings } from 'dashjs';
5
+ import { ProtectionDataSet } from 'dashjs';
4
6
 
5
7
  declare type AnyPlugin<PluginOwnConfig extends KeyValue> = Plugin_2<PluginOwnConfig> | Loader<PluginOwnConfig>;
6
8
 
@@ -93,19 +95,17 @@ declare type CustomConfig<T> = Config & T;
93
95
 
94
96
  /* Excluded from this release type: DashClass */
95
97
 
96
- export declare type DashConfig = ConfigWith<{
98
+ declare type DashConfig = ConfigWith<{
97
99
  dash?: DashSettings;
98
100
  }>;
99
101
 
100
102
  /* Excluded from this release type: DashPlayer */
101
103
 
102
- export declare type DashSettings = MediaSettings & {
104
+ declare type DashSettings = MediaSettings & {
103
105
  drm?: ProtectionDataSet;
104
106
  };
105
107
 
106
- declare const _default: PluginCtor<ConfigWith<{
107
- dash?: DashSettings | undefined;
108
- }>>;
108
+ declare const _default: PluginCtor<KeyValue>;
109
109
  export default _default;
110
110
 
111
111
  declare type DeviceId = string;
@@ -191,16 +191,6 @@ declare type MapToConfigs<Arr extends PluginCtor[]> = {
191
191
  [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
192
192
  };
193
193
 
194
- declare type MediaKeyMessageType_2 = "individualization-request" | "license-release" | "license-renewal" | "license-request";
195
-
196
- export declare type MediaSettings = {
197
- lang?: string;
198
- viewpoint?: any;
199
- audioChannelConfiguration?: any[];
200
- accessibility?: any;
201
- role?: string;
202
- };
203
-
204
194
  declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
205
195
 
206
196
  declare interface Player extends HTMLVideoElement {
@@ -285,35 +275,6 @@ declare interface PluginCtor<PluginOwnConfig extends KeyValue = KeyValue> {
285
275
  new (umd: FlowplayerUMD, player: Player): AnyPlugin<PluginOwnConfig>;
286
276
  }
287
277
 
288
- export declare interface ProtectionData {
289
- /**
290
- * A license server URL to use with this key system.
291
- * When specified as a string, a single URL will be used regardless of message type.
292
- * When specified as an object, the object will have property names for each message
293
- * type with the corresponding property value being the URL to use for
294
- * messages of that type
295
- */
296
- serverURL?: string | {
297
- [P in MediaKeyMessageType_2]: string;
298
- };
299
- /** headers to add to the http request */
300
- httpRequestHeaders?: object;
301
- /**
302
- * Defines a set of clear keys that are available to the key system.
303
- * Object properties are base64-encoded keyIDs (with no padding).
304
- * Corresponding property values are keys, base64-encoded (no padding).
305
- */
306
- clearkeys?: {
307
- [key: string]: string;
308
- };
309
- /** Priority level of the key system to be selected (0 is the highest prority, -1 for undefined priority) */
310
- priority?: number;
311
- }
312
-
313
- export declare interface ProtectionDataSet {
314
- [keySystemName: string]: ProtectionData;
315
- }
316
-
317
278
  declare enum QualityOpts {
318
279
  LOW = 1,
319
280
  MEDIUM = 2,
package/plugins/drm.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { HlsConfig } from 'hls.js';
2
2
  import type { MediaKeyFunc } from 'hls.js';
3
+ import { MediaSettings } from 'dashjs';
4
+ import { ProtectionDataSet } from 'dashjs';
3
5
 
4
6
  declare type BitOpts = number;
5
7
 
@@ -141,16 +143,6 @@ declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Pl
141
143
  wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
142
144
  }
143
145
 
144
- declare type MediaKeyMessageType_2 = "individualization-request" | "license-release" | "license-renewal" | "license-request";
145
-
146
- declare type MediaSettings = {
147
- lang?: string;
148
- viewpoint?: any;
149
- audioChannelConfiguration?: any[];
150
- accessibility?: any;
151
- role?: string;
152
- };
153
-
154
146
  declare interface Player extends HTMLVideoElement {
155
147
  renderPlugin: (pluginContainer: HTMLElement) => void;
156
148
  toggleDisable: (flag: boolean) => void;
@@ -215,35 +207,6 @@ declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
215
207
 
216
208
  declare type PluginConfig<T> = Config & T;
217
209
 
218
- declare interface ProtectionData {
219
- /**
220
- * A license server URL to use with this key system.
221
- * When specified as a string, a single URL will be used regardless of message type.
222
- * When specified as an object, the object will have property names for each message
223
- * type with the corresponding property value being the URL to use for
224
- * messages of that type
225
- */
226
- serverURL?: string | {
227
- [P in MediaKeyMessageType_2]: string;
228
- };
229
- /** headers to add to the http request */
230
- httpRequestHeaders?: object;
231
- /**
232
- * Defines a set of clear keys that are available to the key system.
233
- * Object properties are base64-encoded keyIDs (with no padding).
234
- * Corresponding property values are keys, base64-encoded (no padding).
235
- */
236
- clearkeys?: {
237
- [key: string]: string;
238
- };
239
- /** Priority level of the key system to be selected (0 is the highest prority, -1 for undefined priority) */
240
- priority?: number;
241
- }
242
-
243
- declare interface ProtectionDataSet {
244
- [keySystemName: string]: ProtectionData;
245
- }
246
-
247
210
  declare type SourceObj = {
248
211
  src?: SourceStr;
249
212
  type?: string;
@@ -73,26 +73,15 @@ declare interface Config {
73
73
  seconds_to_dvr?: number;
74
74
  }
75
75
 
76
- declare namespace Configs {
77
- export {
78
- BitOpts,
79
- FlowplayerCustomElementRegistry,
80
- Config,
81
- CustomConfig,
82
- PluginConfig
83
- }
84
- }
85
-
86
- declare type ConfigWith<T> = Configs.Config & T;
87
-
88
- declare type ConfigWithPlaylistAndEndscreen = ConfigWith<{
89
- endscreen?: EndscreenConfig;
90
- playlist?: PlaylistConfig;
91
- }>;
92
-
93
76
  declare type CustomConfig<T> = Config & T;
94
77
 
95
- declare const _default: typeof Endscreen;
78
+ declare const _default: PluginCtor< {
79
+ endscreen?: Partial<{
80
+ interstitial: boolean;
81
+ delay: number;
82
+ }> | undefined;
83
+ playlist?: PlaylistConfig | undefined;
84
+ }>;
96
85
  export default _default;
97
86
 
98
87
  declare type DeviceId = string;
@@ -120,29 +109,6 @@ declare type DRMVendorImplementation = {
120
109
  }, cb: (license_data: Uint8Array) => void) => void;
121
110
  };
122
111
 
123
- declare class Endscreen implements Plugin_2 {
124
- static events: {
125
- RECOMMENDATIONS_RENDER: string;
126
- RECOMMENDATIONS_READY: string;
127
- RECOMMENDATIONS_HIDE: string;
128
- };
129
- recommendations?: EndscreenRecommendations;
130
- logger: Logger;
131
- constructor(umd: FlowplayerUMD, _player: Player);
132
- init(config: ConfigWithPlaylistAndEndscreen, container: PlayerRoot, player: PlaylistPlayer): void;
133
- private _setSrc;
134
- private hide_recommendations;
135
- }
136
-
137
- declare type EndscreenConfig = Partial<{
138
- interstitial: boolean;
139
- delay: number;
140
- }>;
141
-
142
- declare type EndscreenRecommendations = {
143
- playlist: Array<PlaylistItem>;
144
- };
145
-
146
112
  declare type FlowplayerCustomElementRegistry = Map<string, string>;
147
113
 
148
114
  declare interface FlowplayerUMD extends FlowplayerUMDBase {
@@ -197,11 +163,6 @@ declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Pl
197
163
  wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
198
164
  }
199
165
 
200
- declare interface Logger {
201
- (...args: any[]): void;
202
- log(...args: any[]): void;
203
- }
204
-
205
166
  declare type MapToConfigs<Arr extends PluginCtor[]> = {
206
167
  [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
207
168
  };
@@ -292,13 +253,6 @@ declare type PlaylistConfig = {
292
253
  theme?: string;
293
254
  };
294
255
 
295
- declare type PlaylistItem = {
296
- poster?: string;
297
- title?: string;
298
- description?: string;
299
- src: string[];
300
- };
301
-
302
256
  /* Excluded from this release type: PlaylistPlayer */
303
257
 
304
258
  declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
@@ -75,7 +75,10 @@ declare interface Config {
75
75
 
76
76
  declare type CustomConfig<T> = Config & T;
77
77
 
78
- declare const _default: typeof GemiusPlugin;
78
+ declare const _default: PluginCtor< {
79
+ gemius: GemiusObject;
80
+ ima?: any;
81
+ }>;
79
82
  export default _default;
80
83
 
81
84
  declare type DeviceId = string;
@@ -147,12 +150,12 @@ declare interface FPEvent<T> extends CustomEvent<T> {
147
150
  data?: T;
148
151
  }
149
152
 
150
- declare type GemiusConfig = Config & {
153
+ export declare type GemiusConfig = Config & {
151
154
  gemius: GemiusObject;
152
155
  ima?: any;
153
156
  };
154
157
 
155
- declare type GemiusObject = {
158
+ export declare type GemiusObject = {
156
159
  playerID: string;
157
160
  gemiusID: string;
158
161
  programID?: string;
@@ -161,38 +164,11 @@ declare type GemiusObject = {
161
164
  volume?: number;
162
165
  currentDomain?: string;
163
166
  programName: string;
164
- programDuration: string;
167
+ programDuration: number;
165
168
  programType: string;
166
169
  };
167
170
  };
168
171
 
169
- declare class GemiusPlugin implements Plugin_2 {
170
- started: boolean;
171
- starting: boolean;
172
- paused: boolean;
173
- seeking: boolean;
174
- buffering: boolean;
175
- currentTime: number;
176
- currentAd?: {
177
- duration: number;
178
- id: string;
179
- currentTime: number;
180
- };
181
- gemius?: GemiusObject;
182
- gemiusPlayer?: GemiusPlayer;
183
- flowplayer: FlowplayerUMD;
184
- constructor(flowplayer: FlowplayerUMD);
185
- init(config: GemiusConfig, root: PlayerRoot, video: PlayerWith<{
186
- ads?: any;
187
- }>): void;
188
- resetParams(): void;
189
- sendPlay(video: Player): void;
190
- sendPlayWithRequiremets(video: Player): void;
191
- getInitEventType(config: GemiusConfig): "loadstart" | "src";
192
- initGemius(config: GemiusConfig, video: Player): void;
193
- handle_window_unload(video: Player): void;
194
- }
195
-
196
172
  declare type JSONPlayer = any;
197
173
 
198
174
  declare type KeyValue = Record<string, any>;
@@ -261,22 +237,8 @@ declare type PlayerRoot = HTMLElement & {
261
237
  prevWidth?: number;
262
238
  };
263
239
 
264
- declare namespace Players {
265
- export {
266
- VideoTrack,
267
- PlayerState,
268
- FPEvent,
269
- DeviceId,
270
- JSONPlayer,
271
- PlayerRoot,
272
- Player
273
- }
274
- }
275
-
276
240
  declare type PlayerState = string;
277
241
 
278
- declare type PlayerWith<T> = Players.Player & T;
279
-
280
242
  declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
281
243
  /**
282
244
  * a plugin must always implement the init method so a player instance knows how to initialize it
package/plugins/health.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.health=t())}(this,(function(){"use strict";const e="rebuffer";var t=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:e,DISPLAY:"display"});const n="load",i="fullscreenenter",o="fullscreenexit",s="loadedmetadata",r="loadeddata",a="progress",d="loadstart",c="pause",l="playing",u="waiting",_="canplay",h="ended",p="seeked",f="seeking";function y(e){try{return!!new URL(e)}catch(e){return!1}}function m(e,t){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),i=(i,...o)=>{try{const s=(null==t?void 0:t.debug)||n;s&&e.match(s)&&console.log(`flowplayer/${e} -- ${i}`,...o)}catch(e){console.warn(e)}};return i.log=i,i}const v=navigator;function E(e){var t,n;const i=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return i?1e-6*i:(null===(n=v.connection)||void 0===n?void 0:n.downlink)||-1}function g(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}const w="https://ljsp.lwcdn.com".concat("/web/public/countdown/time.json"),R=window,I=R._flowplayerTimekeeper||(R._flowplayerTimekeeper={});var O;!function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(O||(O={}));const D=e=>{switch(e){case!0:return O.ON;case!1:return O.OFF;default:return e}};function N(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return!e.startsWith("data:")&&e}catch(e){return!1}}const T=[],A="https://ihi.flowplayer.com/v1/health/events";function b(e){if(e.suspended)return;const t=T.slice(0);T.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),g(function(){try{return"undefined"==typeof window?A:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:A}catch(e){return A}}(),t))}async function S(e,t,n){const i=await U();T.push(Object.assign(t,i)),e.logger.log(":enqueue",t.event,t),T.length<10&&!n||b(e)}const L=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},U=async()=>{const e=Date.now();try{return{adjusted_time:e-await async function(){const e=I.cachedServerOffset;if(e)return e;const t=I.pendingRequest||(I.pendingRequest=fetch(w)),n=await t,i=parseInt(n.headers.get("age")||"0"),o=await n.json(),s=Date.now()-o.millisUtc-1e3*i;return I.cachedServerOffset=s,I.cachedServerOffset}(),client_time:e}}catch(t){return{client_time:e}}},k=(e,t)=>Object.assign(e,{detail:t}),C=(e,{event:t,media_session_id:n,session_id:i,play_range_id:o})=>({event:t,media_session_id:n,session_id:i,play_range_id:o,device_id:e.deviceId(),version:"3.11.2-rc.2",commit:"3484e6cece54b0eed1e83a39d31dea73d30b8ab6",ima_sdk_version:L(),preload:e.opt("preload"),autoplay:D(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:E(e),page_url:N(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),M=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});function x(e,t,n,i){const o=C(t,e.eventInfo(n)),{before:s,after:r}=i;S(e,((e,t,n)=>Object.assign(e,{state:{before:t,after:n}}))(o,M(s),M(r)))}const F=[1e7]+""+-1e3+-4e3+-8e3+-1e11,B=()=>"undefined"==typeof crypto?"":F.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));var P;function H(e){switch(e){case P.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case P.MEDIA_ERR_NETWORK:return"a network error occurred";case P.MEDIA_ERR_DECODE:return"unable to decode media content";case P.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case P.NO_INTERNET:return"no internet connection detected";case P.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(P||(P={}));const j=(e,t)=>{let n=null;return(...i)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...i),e)}},W=B();class Health{constructor(e,t){this.session_id=W,this.suspended=!1,this.logger=m("health",t.opts),this.media_session_id=B(),this.play_range_id=B(),this.analyticsLoop=setInterval(()=>b(this),2e3),t.on("reap",()=>clearInterval(this.analyticsLoop)),t.on(l,()=>{this.play_range_id=B()});const n=this;if(t.health={get media_session_id(){return n.media_session_id},set media_session_id(e){n.media_session_id=e},get session_id(){return n.session_id},set session_id(e){n.session_id=e},toggle(e){e?n.resume():n.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>b(this),2e3)}init(t,m,v){!function(t){t.on(u,(function(n){t.seeking||t.networkState===t.NETWORK_LOADING&&t.readyState!==t.HAVE_NOTHING&&t.emit(e)}))}(v),v.on("display",e=>{S(this,C(v,this.eventInfo(e.type)),!0)}),v.on("health:record",({detail:e})=>{const t=C(v,this.eventInfo(e.event));Object.assign(t,e.detail||{}),S(this,t)}),[_,d,n,s,r,a,u,e].forEach(e=>{v.on(e,e=>{S(this,C(v,this.eventInfo(e.type)))})}),[l,c,f,p,h,i,o].forEach(e=>{v.on(e,e=>{S(this,C(v,this.eventInfo(e.type)))})}),v.on("volumechange",j(800,e=>{const t=C(v,this.eventInfo(e.type));S(this,k(t,{volume:parseFloat(v.volume.toFixed(2)),muted:v.muted}))})),v.on("resize",j(800,e=>{const t=C(v,this.eventInfo(e.type));S(this,k(t,{height:m.clientHeight,width:m.clientWidth}))})),v.on("hls/failover",e=>{const t=C(v,this.eventInfo(e.type)),n=e.detail,{reason:i,from:o}=n;S(this,k(t,{reason:i,from:o}))}),v.on("qualitychange",({type:e,detail:t})=>{switch(t.kind){case"hls":return x(this,v,e,t)}});let E=Date.now()+5e3;v.on("timeupdate",e=>{if(Date.now()<E)return;E=Date.now()+5e3;const t=C(v,this.eventInfo(e.type));var n;S(this,k(t,{duration:(n=v.duration,Number.isFinite(n)?n:n===1/0?-1:void 0)}))}),v.addEventListener("error",e=>{const t=C(v,this.eventInfo(e.type)),n=e.error||v.error;if(!n)return S(this,t,!0);const i=n.code,o={error_message:n.message||H(i),error_code:i,error_stack:n.stack||""};return S(this,k(t,o),!0)}),v.on("src",e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof n)return;if(!y(v.original_src))return;if(!y(n))return;if(n==v.original_src)return;this.media_session_id=B();S(this,C(v,this.eventInfo(e.type))),b(this)}),v.on("visibilitychange",e=>{S(this,C(v,this.eventInfo(e.type))),b(this)})}}return Health.events=t,Health._UNLOAD_SUBSCRIBED=!1,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;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,Health),Health}));
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.health=t())}(this,(function(){"use strict";const e="rebuffer";var t=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:e,DISPLAY:"display"});const n="load",i="fullscreenenter",o="fullscreenexit",s="loadedmetadata",r="loadeddata",a="progress",d="loadstart",c="pause",l="playing",u="waiting",_="canplay",h="ended",f="seeked",p="seeking";function y(e){try{return!!new URL(e)}catch(e){return!1}}function m(e,t){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),i=(i,...o)=>{try{const s=(null==t?void 0:t.debug)||n;s&&e.match(s)&&console.log(`flowplayer/${e} -- ${i}`,...o)}catch(e){console.warn(e)}};return i.log=i,i}const v=navigator;function E(e){var t,n;const i=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return i?1e-6*i:(null===(n=v.connection)||void 0===n?void 0:n.downlink)||-1}function g(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}const w="https://ljsp.lwcdn.com".concat("/web/public/countdown/time.json"),R=window,I=R._flowplayerTimekeeper||(R._flowplayerTimekeeper={});var O;!function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(O||(O={}));const D=e=>{switch(e){case!0:return O.ON;case!1:return O.OFF;default:return e}};function N(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return!e.startsWith("data:")&&e}catch(e){return!1}}const T=[],A="https://ihi.flowplayer.com/v1/health/events";function b(e){if(e.suspended)return;const t=T.slice(0);T.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),g(function(){try{return"undefined"==typeof window?A:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:A}catch(e){return A}}(),t))}async function S(e,t,n){const i=await U();T.push(Object.assign(t,i)),e.logger.log(":enqueue",t.event,t),T.length<10&&!n||b(e)}const L=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},U=async()=>{const e=Date.now();try{return{adjusted_time:e-await async function(){const e=I.cachedServerOffset;if(e)return e;const t=I.pendingRequest||(I.pendingRequest=fetch(w)),n=await t,i=parseInt(n.headers.get("age")||"0"),o=await n.json(),s=Date.now()-o.millisUtc-1e3*i;return I.cachedServerOffset=s,I.cachedServerOffset}(),client_time:e}}catch(t){return{client_time:e}}},k=(e,t)=>Object.assign(e,{detail:t}),C=(e,{event:t,media_session_id:n,session_id:i,play_range_id:o})=>({event:t,media_session_id:n,session_id:i,play_range_id:o,device_id:e.deviceId(),version:"3.11.2-rc.3",commit:"a1662958ecf447b4e6dc05c8cacbaa30180db257",ima_sdk_version:L(),preload:e.opt("preload"),autoplay:D(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:E(e),page_url:N(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),M=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});function x(e,t,n,i){const o=C(t,e.eventInfo(n)),{before:s,after:r}=i;S(e,((e,t,n)=>Object.assign(e,{state:{before:t,after:n}}))(o,M(s),M(r)))}const F=[1e7]+""+-1e3+-4e3+-8e3+-1e11,B=()=>"undefined"==typeof crypto?"":F.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));var P;function H(e){switch(e){case P.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case P.MEDIA_ERR_NETWORK:return"a network error occurred";case P.MEDIA_ERR_DECODE:return"unable to decode media content";case P.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case P.NO_INTERNET:return"no internet connection detected";case P.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(P||(P={}));const j=(e,t)=>{let n=null;return(...i)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...i),e)}},W=B();class Health{constructor(e,t){this.session_id=W,this.suspended=!1,this.logger=m("health",t.opts),this.media_session_id=B(),this.play_range_id=B(),this.analyticsLoop=setInterval(()=>b(this),2e3),t.on("reap",()=>clearInterval(this.analyticsLoop)),t.on(l,()=>{this.play_range_id=B()});const n=this;if(t.health={get media_session_id(){return n.media_session_id},set media_session_id(e){n.media_session_id=e},get session_id(){return n.session_id},set session_id(e){n.session_id=e},toggle(e){e?n.resume():n.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>b(this),2e3)}init(t,m,v){!function(t){t.on(u,(function(n){t.seeking||t.networkState===t.NETWORK_LOADING&&t.readyState!==t.HAVE_NOTHING&&t.emit(e)}))}(v),v.on("display",e=>{S(this,C(v,this.eventInfo(e.type)),!0)}),v.on("health:record",({detail:e})=>{const t=C(v,this.eventInfo(e.event));Object.assign(t,e.detail||{}),S(this,t)}),[_,d,n,s,r,a,u,e].forEach(e=>{v.on(e,e=>{S(this,C(v,this.eventInfo(e.type)))})}),[l,c,p,f,h,i,o].forEach(e=>{v.on(e,e=>{S(this,C(v,this.eventInfo(e.type)))})}),v.on("volumechange",j(800,e=>{const t=C(v,this.eventInfo(e.type));S(this,k(t,{volume:parseFloat(v.volume.toFixed(2)),muted:v.muted}))})),v.on("resize",j(800,e=>{const t=C(v,this.eventInfo(e.type));S(this,k(t,{height:m.clientHeight,width:m.clientWidth}))})),v.on("hls/failover",e=>{const t=C(v,this.eventInfo(e.type)),n=e.detail,{reason:i,from:o}=n;S(this,k(t,{reason:i,from:o}))}),v.on("qualitychange",({type:e,detail:t})=>{switch(t.kind){case"hls":return x(this,v,e,t)}});let E=Date.now()+5e3;v.on("timeupdate",e=>{if(Date.now()<E)return;E=Date.now()+5e3;const t=C(v,this.eventInfo(e.type));var n;S(this,k(t,{duration:(n=v.duration,Number.isFinite(n)?n:n===1/0?-1:void 0)}))}),v.addEventListener("error",e=>{const t=C(v,this.eventInfo(e.type)),n=e.error||v.error;if(!n)return S(this,t,!0);const i=n.code,o={error_message:n.message||H(i),error_code:i,error_stack:n.stack||""};return S(this,k(t,o),!0)}),v.on("src",e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof n)return;if(!y(v.original_src))return;if(!y(n))return;if(n==v.original_src)return;this.media_session_id=B();S(this,C(v,this.eventInfo(e.type))),b(this)}),v.on("visibilitychange",e=>{S(this,C(v,this.eventInfo(e.type))),b(this)})}}return Health.events=t,Health._UNLOAD_SUBSCRIBED=!1,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;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,Health),Health}));