@flowplayer/player 3.11.1 → 3.11.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/core.js +1 -1
  2. package/default.js +1 -1
  3. package/embed.js +2 -2
  4. package/index.d.ts +14 -71
  5. package/package.json +39 -1
  6. package/plugins/ads.d.ts +719 -0
  7. package/plugins/ads.js +1 -1
  8. package/plugins/airplay.d.ts +321 -0
  9. package/plugins/analytics.d.ts +242 -0
  10. package/plugins/analytics.js +1 -1
  11. package/plugins/asel.d.ts +304 -0
  12. package/plugins/audio.d.ts +281 -0
  13. package/plugins/chapters.d.ts +335 -0
  14. package/plugins/chromecast.d.ts +366 -0
  15. package/plugins/consent.d.ts +305 -0
  16. package/plugins/context-menu.d.ts +212 -0
  17. package/plugins/cuepoints.d.ts +13 -84
  18. package/plugins/dash.d.ts +235 -0
  19. package/plugins/drm.d.ts +248 -0
  20. package/plugins/endscreen.d.ts +351 -0
  21. package/plugins/fas.d.ts +308 -0
  22. package/plugins/float-on-scroll.d.ts +301 -0
  23. package/plugins/ga4.d.ts +398 -0
  24. package/plugins/gemius.d.ts +319 -0
  25. package/plugins/google-analytics.d.ts +400 -0
  26. package/plugins/health.d.ts +307 -0
  27. package/plugins/health.js +1 -1
  28. package/plugins/hls.d.ts +229 -0
  29. package/plugins/id3.d.ts +198 -0
  30. package/plugins/iframe.d.ts +278 -0
  31. package/plugins/keyboard.d.ts +189 -0
  32. package/plugins/media-session.d.ts +189 -0
  33. package/plugins/message.d.ts +193 -0
  34. package/plugins/ovp.d.ts +343 -0
  35. package/plugins/playlist.d.ts +326 -0
  36. package/plugins/preview.d.ts +243 -0
  37. package/plugins/qsel.d.ts +284 -0
  38. package/plugins/qul.d.ts +220 -0
  39. package/plugins/rts.d.ts +273 -0
  40. package/plugins/share.d.ts +295 -0
  41. package/plugins/speed.d.ts +268 -0
  42. package/plugins/ssai.d.ts +346 -0
  43. package/plugins/ssai.js +1 -1
  44. package/plugins/subtitles.d.ts +294 -0
  45. package/plugins/thumbnails.d.ts +307 -0
  46. package/plugins/tizen.d.ts +374 -0
  47. package/plugins/vtsel.d.ts +282 -0
  48. package/plugins/webos.d.ts +374 -0
  49. package/util/loader.d.ts +14 -95
@@ -0,0 +1,242 @@
1
+ import type { MediaKeyFunc } from 'hls.js';
2
+
3
+ declare class Analytics implements Plugin_2 {
4
+ init(config: ConfigWith<{
5
+ player_id?: string;
6
+ customer_user_id?: string;
7
+ source?: string;
8
+ }>, _: PlayerRoot, video: PlayerWith<{
9
+ analytics: AnalyticsInstance;
10
+ }>): void;
11
+ }
12
+ export default Analytics;
13
+
14
+ declare interface AnalyticsInstance {
15
+ ticker?: LivestreamTicker | VODTicker;
16
+ last_media_id: string;
17
+ ended: boolean;
18
+ }
19
+
20
+ declare type BitOpts = number;
21
+
22
+ declare interface Config {
23
+ src?: UnsafeSource;
24
+ preload?: "none" | "metadata" | "auto";
25
+ controls?: boolean;
26
+ lang?: string;
27
+ start_time?: number;
28
+ autopause?: boolean;
29
+ rewind?: boolean;
30
+ loop?: boolean;
31
+ seamless?: boolean;
32
+ retry?: boolean;
33
+ autoplay?: BitOpts;
34
+ start_quality?: BitOpts;
35
+ live?: boolean;
36
+ poster?: string;
37
+ disabled?: boolean;
38
+ muted?: boolean;
39
+ /**
40
+ * is src handled by one of plugins loaders
41
+ */
42
+ is_native?: boolean;
43
+ /**
44
+ * bitflags for UI options
45
+ */
46
+ ui?: BitOpts;
47
+ /**
48
+ * your user access token
49
+ */
50
+ token?: string;
51
+ /**
52
+ * manually configured duration for pre-rendering usually
53
+ */
54
+ duration?: number;
55
+ /**
56
+ * can the content be seeked to any position
57
+ */
58
+ seekable?: boolean;
59
+ multiplay?: boolean;
60
+ ratio?: number | string;
61
+ logo?: string;
62
+ logo_href?: string;
63
+ logo_alt_text?: string;
64
+ title?: string;
65
+ description?: string;
66
+ /**
67
+ * the number of seconds to have in the buffer before dvr is activated
68
+ */
69
+ seconds_to_dvr?: number;
70
+ }
71
+
72
+ declare namespace Configs {
73
+ export {
74
+ BitOpts,
75
+ FlowplayerCustomElementRegistry,
76
+ Config,
77
+ CustomConfig,
78
+ PluginConfig
79
+ }
80
+ }
81
+
82
+ declare type ConfigWith<T> = Configs.Config & T;
83
+
84
+ declare type CustomConfig<T> = Config & T;
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 type FlowplayerCustomElementRegistry = Map<string, string>;
112
+
113
+ declare interface FPEvent<T> extends CustomEvent<T> {
114
+ /**
115
+ * @deprecated
116
+ the data attribute has been migrated to details to match the CustomEvent spec
117
+ more info: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
118
+ */
119
+ data?: T;
120
+ }
121
+
122
+ declare type JSONPlayer = any;
123
+
124
+ declare type KeyValue = Record<string, any>;
125
+
126
+ declare type LivestreamTicker = {
127
+ ticks: number;
128
+ last_tracked_ts: number;
129
+ kind: "live";
130
+ };
131
+
132
+ declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Plugin_2<PluginOwnConfig> {
133
+ onload<T = KeyValue>(config: PluginConfig<T>, root: PlayerRoot, video: Player, src?: SourceObj): void;
134
+ wants<S = SourceObj, T = KeyValue>(srcString: SourceStr, srcObj: S, config: PluginConfig<T>): boolean;
135
+ wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
136
+ }
137
+
138
+ declare interface Player extends HTMLVideoElement {
139
+ renderPlugin: (pluginContainer: HTMLElement) => void;
140
+ toggleDisable: (flag: boolean) => void;
141
+ original_src: string;
142
+ root: PlayerRoot;
143
+ playerState: Record<string, boolean>;
144
+ reaper: Map<string, any> | 0;
145
+ hasState(state: PlayerState): boolean;
146
+ transitionState(to: PlayerState, from: PlayerState, timer?: number): void;
147
+ togglePlay(on?: boolean): Promise<void>;
148
+ toggleFullScreen(on?: boolean, state_only?: boolean): void;
149
+ toggleMute(on?: boolean): void;
150
+ destroy(): void;
151
+ render(): void;
152
+ render(component: string, args: any[]): void;
153
+ createComponents(...args: string[]): HTMLElement[];
154
+ setOpts(config: Config): void;
155
+ setSrc(sources: UnsafeSource): Player;
156
+ on<T>(event: string | string[], handler: (e: FPEvent<T>) => void): Player;
157
+ once<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
158
+ off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
159
+ poll<T>(event: string, data?: T): FPEvent<T>;
160
+ emit<T>(event: string, data?: T): Player;
161
+ setAttrs(attrs: Config): Player;
162
+ opt<T>(key: string, fallback?: T): T;
163
+ enqueueSeek(offset: number): any;
164
+ setState(state: string, flag: boolean): Player;
165
+ toJSON(): JSONPlayer;
166
+ i18n(k: string, fallback?: string): string;
167
+ deviceId(): DeviceId;
168
+ live_state: {
169
+ dvr?: boolean;
170
+ dvr_window?: number;
171
+ };
172
+ opts: Config;
173
+ plugins: Array<Plugin_2 | Loader>;
174
+ dvr_offset?: number;
175
+ message?: {
176
+ events: Record<string, string>;
177
+ };
178
+ disabled: boolean;
179
+ started?: boolean;
180
+ token: string;
181
+ tracks?: VideoTrack[];
182
+ _customElements: FlowplayerCustomElementRegistry;
183
+ _storage: Storage;
184
+ }
185
+
186
+ declare type PlayerRoot = HTMLElement & {
187
+ prevWidth?: number;
188
+ };
189
+
190
+ declare namespace Players {
191
+ export {
192
+ VideoTrack,
193
+ PlayerState,
194
+ FPEvent,
195
+ DeviceId,
196
+ JSONPlayer,
197
+ PlayerRoot,
198
+ Player
199
+ }
200
+ }
201
+
202
+ declare type PlayerState = string;
203
+
204
+ declare type PlayerWith<T> = Players.Player & T;
205
+
206
+ declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
207
+ /**
208
+ * a plugin must always implement the init method so a player instance knows how to initialize it
209
+ */
210
+ init<T>(config: PluginConfig<T>, container: PlayerRoot, player: Player): void;
211
+ init(config: PluginConfig<PluginOwnConfig>, container: PlayerRoot, player: Player): void;
212
+ }
213
+
214
+ declare type PluginConfig<T> = Config & T;
215
+
216
+ declare type SourceObj = {
217
+ src?: SourceStr;
218
+ type?: string;
219
+ drm?: DRMSourceConfiguration;
220
+ };
221
+
222
+ declare type SourceStr = string;
223
+
224
+ declare type SourceWith<T> = SourceObj & T;
225
+
226
+ declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
227
+
228
+ declare interface VideoTrack {
229
+ name: string;
230
+ data: any;
231
+ default: boolean;
232
+ selected: boolean;
233
+ }
234
+
235
+ declare type VODTicker = {
236
+ last_idx: number;
237
+ segment_duration: number;
238
+ breakpoints: number[];
239
+ kind: "vod";
240
+ };
241
+
242
+ export { }
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.analytics=t())}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){var t={exports:{}};return e(t,t.exports),t.exports}var n,r=t((function(t,n){var r=e&&e.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};n.__esModule=!0,n.remove=n.downcase=n.pluck=n.merge=void 0,n.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return r(r({},e),t)}),{})},n.pluck=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Object.keys(e).filter((function(e){return~t.indexOf(e)})).reduce((function(t,r){var i;return n.merge(t,((i={})[r]=e[r],i))}),{})},n.downcase=function(e){return(e||"").toString().toLowerCase()},n.remove=function(e,t){var n=e.lastIndexOf(t);return~n&&e.splice(n,1),e}})),i=t((function(t,n){var i=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};n.__esModule=!0;var u=a(r),s=function(){function e(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return e.of=function(){return new e},e.is_empty=function(e){return 0==e.pending.length},e.is_high_water=function(t){return t.open.length==e.MAX_OPEN_REQUESTS},e.maybe_spawn_req=function(t){if(e.is_empty(t))return t;if(e.is_high_water(t))return t;try{var n=e.lpop(t);n&&e.request(t,n)}catch(e){}},e.increment_failures=function(t){return t.stats.failures++,t.stats.failures>e.MAX_FAILURE_COUNT&&(t.stats.ttl=Date.now()+e.REQUEST_TTL_MS),t},e.handle_error=function(t,n){e.rm(t,n),e.increment_failures(t)},e.request=function(t,n){var r=n[0],i=n[1],o=n[2];if(!(Date.now()<t.stats.ttl)){var a=new XMLHttpRequest;t.open.push(a),a.timeout=e.REQUEST_TIMEOUT_MS,a.ontimeout=function(){e.handle_error(t,a)},a.onerror=function(n){e.handle_error(t,a)},a.onreadystatechange=function(){a.readyState==XMLHttpRequest.DONE&&e.rm(t,a),Math.floor(a.status/100)},a.onload=function(){e.rm(t,a),t.stats.failures&&t.stats.failures--},a.open(i,r),a.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{a.send(JSON.stringify(o))}catch(e){}}},e.rpush=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return n.forEach((function(n){t.pending.length>=e.MAX_PENDING||(t.pending.push(n),e.maybe_spawn_req(t))})),t},e.lpop=function(e){return e.pending.shift()},e.rm=function(e,t){return u.remove(e.open,t),e},e.MAX_OPEN_REQUESTS=3,e.MAX_PENDING=5,e.REQUEST_TIMEOUT_MS=4e3,e.REQUEST_TTL_MS=5e3,e.MAX_FAILURE_COUNT=3,e}();n.default=s})),o=t((function(t,n){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0;var o=r(i);n.default=o.default.of()})),a=t((function(e,t){t.__esModule=!0,t.prepare_url=t.URL_PARAM=void 0,t.URL_PARAM=/:([a-zA-Z_]+)/g,t.prepare_url=function(e,n){return e.url.replace(t.URL_PARAM,(function(t){if((t=t.slice(1,t.length))in n)return n[t].toString();e.log.error(new Error("\n preparing url["+e.url+"] failed\n \n parameter["+t+"] not detected in params:\n \n "+JSON.stringify(n,null,2)+"\n "))}))}})),u=t((function(e,t){t.__esModule=!0,t.Log=void 0;var n=function(){function e(e){this.emitter=e}return e.prepare=function(e,t){var n=document.createEvent("Event");return n.initEvent(e,!1,!0),n.ns=e,n.data=t,n},e.of=function(t){return new e(t)},e.prototype.info=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.INFO,t))},e.prototype.error=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.ERROR,t))},e.prototype.warn=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.WARN,t))},e.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},e}();t.Log=n})),s=t((function(e,t){var n;t.__esModule=!0,t.Verb=void 0,(n=t.Verb||(t.Verb={})).POST="POST",n.PUT="PUT",n.GET="GET"})),d=t((function(t,n){var d=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),c=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),f=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&d(t,e,n);return c(t,e),t},l=e&&e.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,u=o.length;a<u;a++,i++)r[i]=o[a];return r},p=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0;var _=p(o),v=p(i),m=f(a),h=f(r),y=function(){function e(t,n){var r=this;void 0===n&&(n={});var i=this;if(this.emitter=t,this.url=n.url,this.log=u.Log.of(this.emitter),this.verb=n.verb,this.metadata=h.merge({},n.metadata||{}),this.rq=n.rq||_.default,this.events=n.events||[],this.required_keys=n.required_keys||[],this.optional_keys=n.optional_keys||[],this.listeners=[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),e.assert_emitter_api(this.emitter),void 0===e.verb[this.verb])throw new Error("invalid HTTP verb["+this.verb+"] passed");if("string"!=typeof this.url)throw new Error("invalid API url["+this.url+"] passed");e.TRACKERS.push(this),i.events.forEach((function(t){e.create_listener(r,t,(function(n){void 0===n&&(n={});var o=h.merge(i.metadata,{event_type:t},n.data||n),a=m.prepare_url(i,o),u=e.pluck_valid_keys(i,o),s=e.ensure_required_keys(i,u);if(s.length)return i.log.error("Tracker.validate_metadata() failed for \n Event["+t+"]\n missing keys: "+s+"\n payload:\n "+JSON.stringify(u,null,2));v.default.rpush(r.rq,[a,r.verb,u])}))}))}return e.of=function(t,n){return new e(t,n)},e.ensure_required_keys=function(e,t){return e.required_keys.filter((function(e){return!(e in t)}))},e.pluck_valid_keys=function(e,t){return h.pluck.apply(h,l([t],e.valid_keys))},e.merge_metadata=function(t,n){return void 0===n&&(n={}),t.metadata=e.pluck_valid_keys(t,h.merge(t.metadata,n)),t},e.assert_emitter_api=function(e){if("function"!=typeof(e||{}).addEventListener)throw new Error("Tracker() received an emitter that does not implement the addEventListener method");if("function"!=typeof(e||{}).removeEventListener)throw new Error("Tracker() received an emitter that does not implement the removeEventListener method")},e.create_listener=function(e,t,n){e.listeners.push([t,n]),e.emitter.addEventListener(t,n)},e.prototype.destroy=function(){var t=this;this.listeners.forEach((function(e){var n=e[0],r=e[1];return t.emitter.removeEventListener(n,r)})),delete this.rq,delete this.emitter,h.remove(e.TRACKERS,this)},e.prototype.put=function(t){return void 0===t&&(t={}),e.merge_metadata(this,t),this},e.TRACKERS=[],e.QUEUE=_.default,e.verb=s.Verb,e}();n.default=y})),c=t((function(t,n){var r=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},u=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0,n.API=n.Tracker=void 0;var s=u(d);n.Tracker=s.default;var c=o(a);n.API=c}));!function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(n||(n={}));const f=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function l(e,t){return!!~f.indexOf(e)||e.indexOf(t)===e.length-t.length}l.check_whitelist=function(e){return!!~f.indexOf(e)};function p(e){this.message=e}p.prototype=new Error,p.prototype.name="InvalidCharacterError";var _="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new p("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,i=0,o=0,a="";r=t.charAt(o++);~r&&(n=i%4?64*n+r:r,i++%4)?a+=String.fromCharCode(255&n>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};var v=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(_(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return _(t)}};function m(e){this.message=e}m.prototype=new Error,m.prototype.name="InvalidTokenError";var h=function(e,t){if("string"!=typeof e)throw new m("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(v(e.split(".")[n]))}catch(e){throw new m("Invalid token specified: "+e.message)}};h.InvalidTokenError=m;const y="production";function g(e,t){const n={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let r={c:"{}",exp:0};t=t||{};try{r=h(e),n.valid_jwt=!0}catch(e){}return n.raw=e,n.data=JSON.parse(r.c),n.exp=r.exp,t.require_valid_token&&g.validate(n),n}function w(e){return{grant:e,is_granted:t=>(e&t)===t}}function k(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}g.validate=function(e){if("string"==typeof e&&(e=g(e)),!e||!e.raw){if(l.check_whitelist(window.location.hostname)||"dev"===y.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,n=l.bind(null,t);if("dev"!==y.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(n))throw new Error("Domain not allowed");if("dev"!==y.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},g.id=function(e){if(e)return"string"==typeof e&&(e=g(e)),e.data.id},w.of=w,w.from_token=function(e){const t=g(e,{require_valid_token:!0});return w.of(t.data.acl)},w.permissions=n;var E="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};var b="ping",O="display",A="view";const T=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],S=["created","position"],M=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];function P(e,t){return e.duration/1===e.duration&&Object.assign(t,function(e){const t=e/100;return{segment_duration:t,breakpoints:Array(...Array(100)).map((function(e,n){return Math.floor(n*t*1e3)/1e3}))}}(e.duration))}function R(e,t,n){if(!t.segment_duration&&!P(e,t))return;const r=function(e,t,n){const r=t.last_idx,i=n?99:x(e,t);return t.last_idx=i,i<=r?[]:t.breakpoints.slice(r,99==i?100:i).map((function(e){return t.breakpoints.indexOf(e)}))}(e,t,n);0!=r.length&&e.emit(b,{position:r})}function x(e,t){return Math.min(Math.floor(e.currentTime/t.segment_duration),99)}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 I="vod",L="live",j=[O,b,A];function q(e,t,n){switch(null==t?void 0:t.kind){case"live":return function(e,t){const n=Date.now();n-t.last_tracked_ts<6e4||(t.last_tracked_ts=n,++t.ticks,e.emit(b,{position:60*t.ticks}))}(e,t);case"vod":return R(e,t,"boolean"==typeof n&&n)}}function U(e){const t=e.ads;return void 0!==t&&(void 0!==t.schedule&&("function"==typeof t.hasPreroll&&(t.currentRequests?t.currentRequests:!!t.adPlaying||!(!t.hasPreroll()||0!=t.nextIndex))))}class Analytics{init(e,t,n){if(!w.from_token(e.token||"").is_granted(w.permissions.ANALYTICS))return;if(n.hasState("consent-no-tracking"))return;if(n.analytics)return;const r=n.analytics={ticker:void 0,last_media_id:"",ended:!1},i={locked:!1,ttl:6e3,task:()=>{q(n,r.ticker)}};const o={session_id:n.deviceId(),autoplay:n.autoplay,muted:n.muted,player_id:e.player_id,customer_user_id:e.customer_user_id,player_version:"3.11.1"},a=c.Tracker.of(n,{verb:c.Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:j,required_keys:T,optional_keys:M.concat(S).slice(0),metadata:o});n.on("reap",(function(){a&&a.destroy()})),n.on("config",(function(t){if(!a)return;const i=k(t,"data.metadata",{});if(!i.media_id)return;const o=k(a,"metadata.media_id");if(o&&i.media_id==o)return;const u=k(e,"analytics",{});a.put(i),a.put(u);const s=k(e,"metadata.live_start_time",e.live)?L:I;a.put({video_type:s,source:e.source||N()||""}),r.ticker=e.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},r.ended=!1,n.emit(O)}));let u=0;n.on("playing",(function(){if(!a)return;if(u||function(e,t){return e.metadata.media_id&&e.metadata.media_id==t.last_media_id}(a,r))return;a.put({muted:n.muted});const e=U(n);if(e)return u=Promise.resolve(e).then((function(){r.last_media_id=a.metadata.media_id,n.emit(A),u=0})).catch((function(){u=0}));r.last_media_id=a.metadata.media_id,n.emit(A)})),n.on("timeupdate",(function(){var t;a&&(u||U(n)||r.ended||(!e.live&&n.currentTime+.25>=n.duration&&q(n,r.ticker,!0),(t=i).locked||(t.locked=setTimeout((function(){return t.task(),function(e){return e.locked=!1,e}(t)}),t.ttl))))})),n.on("seeked",(function(){a&&r.ticker&&"vod"==r.ticker.kind&&function(e,t){P(e,t),t.last_idx=x(e,t)}(n,r.ticker)})),n.on("ended",(function(){a&&function(e,t){t.ended||(t.ended=!0,q(e,t.ticker))}(n,r)}))}}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;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}("undefined"!=typeof window?window:void 0!==E?E:{},Analytics),Analytics}));
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.analytics=t())}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){var t={exports:{}};return e(t,t.exports),t.exports}var n,r=t((function(t,n){var r=e&&e.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};n.__esModule=!0,n.remove=n.downcase=n.pluck=n.merge=void 0,n.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return r(r({},e),t)}),{})},n.pluck=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Object.keys(e).filter((function(e){return~t.indexOf(e)})).reduce((function(t,r){var i;return n.merge(t,((i={})[r]=e[r],i))}),{})},n.downcase=function(e){return(e||"").toString().toLowerCase()},n.remove=function(e,t){var n=e.lastIndexOf(t);return~n&&e.splice(n,1),e}})),i=t((function(t,n){var i=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};n.__esModule=!0;var u=a(r),s=function(){function e(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return e.of=function(){return new e},e.is_empty=function(e){return 0==e.pending.length},e.is_high_water=function(t){return t.open.length==e.MAX_OPEN_REQUESTS},e.maybe_spawn_req=function(t){if(e.is_empty(t))return t;if(e.is_high_water(t))return t;try{var n=e.lpop(t);n&&e.request(t,n)}catch(e){}},e.increment_failures=function(t){return t.stats.failures++,t.stats.failures>e.MAX_FAILURE_COUNT&&(t.stats.ttl=Date.now()+e.REQUEST_TTL_MS),t},e.handle_error=function(t,n){e.rm(t,n),e.increment_failures(t)},e.request=function(t,n){var r=n[0],i=n[1],o=n[2];if(!(Date.now()<t.stats.ttl)){var a=new XMLHttpRequest;t.open.push(a),a.timeout=e.REQUEST_TIMEOUT_MS,a.ontimeout=function(){e.handle_error(t,a)},a.onerror=function(n){e.handle_error(t,a)},a.onreadystatechange=function(){a.readyState==XMLHttpRequest.DONE&&e.rm(t,a),Math.floor(a.status/100)},a.onload=function(){e.rm(t,a),t.stats.failures&&t.stats.failures--},a.open(i,r),a.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{a.send(JSON.stringify(o))}catch(e){}}},e.rpush=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return n.forEach((function(n){t.pending.length>=e.MAX_PENDING||(t.pending.push(n),e.maybe_spawn_req(t))})),t},e.lpop=function(e){return e.pending.shift()},e.rm=function(e,t){return u.remove(e.open,t),e},e.MAX_OPEN_REQUESTS=3,e.MAX_PENDING=5,e.REQUEST_TIMEOUT_MS=4e3,e.REQUEST_TTL_MS=5e3,e.MAX_FAILURE_COUNT=3,e}();n.default=s})),o=t((function(t,n){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0;var o=r(i);n.default=o.default.of()})),a=t((function(e,t){t.__esModule=!0,t.prepare_url=t.URL_PARAM=void 0,t.URL_PARAM=/:([a-zA-Z_]+)/g,t.prepare_url=function(e,n){return e.url.replace(t.URL_PARAM,(function(t){if((t=t.slice(1,t.length))in n)return n[t].toString();e.log.error(new Error("\n preparing url["+e.url+"] failed\n \n parameter["+t+"] not detected in params:\n \n "+JSON.stringify(n,null,2)+"\n "))}))}})),u=t((function(e,t){t.__esModule=!0,t.Log=void 0;var n=function(){function e(e){this.emitter=e}return e.prepare=function(e,t){var n=document.createEvent("Event");return n.initEvent(e,!1,!0),n.ns=e,n.data=t,n},e.of=function(t){return new e(t)},e.prototype.info=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.INFO,t))},e.prototype.error=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.ERROR,t))},e.prototype.warn=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.WARN,t))},e.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},e}();t.Log=n})),s=t((function(e,t){var n;t.__esModule=!0,t.Verb=void 0,(n=t.Verb||(t.Verb={})).POST="POST",n.PUT="PUT",n.GET="GET"})),d=t((function(t,n){var d=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),c=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),f=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&d(t,e,n);return c(t,e),t},l=e&&e.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,u=o.length;a<u;a++,i++)r[i]=o[a];return r},p=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0;var _=p(o),v=p(i),m=f(a),h=f(r),y=function(){function e(t,n){var r=this;void 0===n&&(n={});var i=this;if(this.emitter=t,this.url=n.url,this.log=u.Log.of(this.emitter),this.verb=n.verb,this.metadata=h.merge({},n.metadata||{}),this.rq=n.rq||_.default,this.events=n.events||[],this.required_keys=n.required_keys||[],this.optional_keys=n.optional_keys||[],this.listeners=[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),e.assert_emitter_api(this.emitter),void 0===e.verb[this.verb])throw new Error("invalid HTTP verb["+this.verb+"] passed");if("string"!=typeof this.url)throw new Error("invalid API url["+this.url+"] passed");e.TRACKERS.push(this),i.events.forEach((function(t){e.create_listener(r,t,(function(n){void 0===n&&(n={});var o=h.merge(i.metadata,{event_type:t},n.data||n),a=m.prepare_url(i,o),u=e.pluck_valid_keys(i,o),s=e.ensure_required_keys(i,u);if(s.length)return i.log.error("Tracker.validate_metadata() failed for \n Event["+t+"]\n missing keys: "+s+"\n payload:\n "+JSON.stringify(u,null,2));v.default.rpush(r.rq,[a,r.verb,u])}))}))}return e.of=function(t,n){return new e(t,n)},e.ensure_required_keys=function(e,t){return e.required_keys.filter((function(e){return!(e in t)}))},e.pluck_valid_keys=function(e,t){return h.pluck.apply(h,l([t],e.valid_keys))},e.merge_metadata=function(t,n){return void 0===n&&(n={}),t.metadata=e.pluck_valid_keys(t,h.merge(t.metadata,n)),t},e.assert_emitter_api=function(e){if("function"!=typeof(e||{}).addEventListener)throw new Error("Tracker() received an emitter that does not implement the addEventListener method");if("function"!=typeof(e||{}).removeEventListener)throw new Error("Tracker() received an emitter that does not implement the removeEventListener method")},e.create_listener=function(e,t,n){e.listeners.push([t,n]),e.emitter.addEventListener(t,n)},e.prototype.destroy=function(){var t=this;this.listeners.forEach((function(e){var n=e[0],r=e[1];return t.emitter.removeEventListener(n,r)})),delete this.rq,delete this.emitter,h.remove(e.TRACKERS,this)},e.prototype.put=function(t){return void 0===t&&(t={}),e.merge_metadata(this,t),this},e.TRACKERS=[],e.QUEUE=_.default,e.verb=s.Verb,e}();n.default=y})),c=t((function(t,n){var r=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},u=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0,n.API=n.Tracker=void 0;var s=u(d);n.Tracker=s.default;var c=o(a);n.API=c}));!function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(n||(n={}));const f=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function l(e,t){return!!~f.indexOf(e)||e.indexOf(t)===e.length-t.length}l.check_whitelist=function(e){return!!~f.indexOf(e)};function p(e){this.message=e}p.prototype=new Error,p.prototype.name="InvalidCharacterError";var _="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new p("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,i=0,o=0,a="";r=t.charAt(o++);~r&&(n=i%4?64*n+r:r,i++%4)?a+=String.fromCharCode(255&n>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};var v=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(_(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return _(t)}};function m(e){this.message=e}m.prototype=new Error,m.prototype.name="InvalidTokenError";var h=function(e,t){if("string"!=typeof e)throw new m("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(v(e.split(".")[n]))}catch(e){throw new m("Invalid token specified: "+e.message)}};h.InvalidTokenError=m;const y="production";function g(e,t){const n={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let r={c:"{}",exp:0};t=t||{};try{r=h(e),n.valid_jwt=!0}catch(e){}return n.raw=e,n.data=JSON.parse(r.c),n.exp=r.exp,t.require_valid_token&&g.validate(n),n}function w(e){return{grant:e,is_granted:t=>(e&t)===t}}function k(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}g.validate=function(e){if("string"==typeof e&&(e=g(e)),!e||!e.raw){if(l.check_whitelist(window.location.hostname)||"dev"===y.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,n=l.bind(null,t);if("dev"!==y.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(n))throw new Error("Domain not allowed");if("dev"!==y.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},g.id=function(e){if(e)return"string"==typeof e&&(e=g(e)),e.data.id},w.of=w,w.from_token=function(e){const t=g(e,{require_valid_token:!0});return w.of(t.data.acl)},w.permissions=n;var E="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};var b="ping",O="display",A="view";const T=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],S=["created","position"],M=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];function P(e,t){return e.duration/1===e.duration&&Object.assign(t,function(e){const t=e/100;return{segment_duration:t,breakpoints:Array(...Array(100)).map((function(e,n){return Math.floor(n*t*1e3)/1e3}))}}(e.duration))}function R(e,t,n){if(!t.segment_duration&&!P(e,t))return;const r=function(e,t,n){const r=t.last_idx,i=n?99:x(e,t);return t.last_idx=i,i<=r?[]:t.breakpoints.slice(r,99==i?100:i).map((function(e){return t.breakpoints.indexOf(e)}))}(e,t,n);0!=r.length&&e.emit(b,{position:r})}function x(e,t){return Math.min(Math.floor(e.currentTime/t.segment_duration),99)}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 I="vod",L="live",j=[O,b,A];function q(e,t,n){switch(null==t?void 0:t.kind){case"live":return function(e,t){const n=Date.now();n-t.last_tracked_ts<6e4||(t.last_tracked_ts=n,++t.ticks,e.emit(b,{position:60*t.ticks}))}(e,t);case"vod":return R(e,t,"boolean"==typeof n&&n)}}function U(e){const t=e.ads;return void 0!==t&&(void 0!==t.schedule&&("function"==typeof t.hasPreroll&&(t.currentRequests?t.currentRequests:!!t.adPlaying||!(!t.hasPreroll()||0!=t.nextIndex))))}class Analytics{init(e,t,n){if(!w.from_token(e.token||"").is_granted(w.permissions.ANALYTICS))return;if(n.hasState("consent-no-tracking"))return;if(n.analytics)return;const r=n.analytics={ticker:void 0,last_media_id:"",ended:!1},i={locked:!1,ttl:6e3,task:()=>{q(n,r.ticker)}};const o={session_id:n.deviceId(),autoplay:n.autoplay,muted:n.muted,player_id:e.player_id,customer_user_id:e.customer_user_id,player_version:"3.11.2-rc.1"},a=c.Tracker.of(n,{verb:c.Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:j,required_keys:T,optional_keys:M.concat(S).slice(0),metadata:o});n.on("reap",(function(){a&&a.destroy()})),n.on("config",(function(t){if(!a)return;const i=k(t,"data.metadata",{});if(!i.media_id)return;const o=k(a,"metadata.media_id");if(o&&i.media_id==o)return;const u=k(e,"analytics",{});a.put(i),a.put(u);const s=k(e,"metadata.live_start_time",e.live)?L:I;a.put({video_type:s,source:e.source||N()||""}),r.ticker=e.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},r.ended=!1,n.emit(O)}));let u=0;n.on("playing",(function(){if(!a)return;if(u||function(e,t){return e.metadata.media_id&&e.metadata.media_id==t.last_media_id}(a,r))return;a.put({muted:n.muted});const e=U(n);if(e)return u=Promise.resolve(e).then((function(){r.last_media_id=a.metadata.media_id,n.emit(A),u=0})).catch((function(){u=0}));r.last_media_id=a.metadata.media_id,n.emit(A)})),n.on("timeupdate",(function(){var t;a&&(u||U(n)||r.ended||(!e.live&&n.currentTime+.25>=n.duration&&q(n,r.ticker,!0),(t=i).locked||(t.locked=setTimeout((function(){return t.task(),function(e){return e.locked=!1,e}(t)}),t.ttl))))})),n.on("seeked",(function(){a&&r.ticker&&"vod"==r.ticker.kind&&function(e,t){P(e,t),t.last_idx=x(e,t)}(n,r.ticker)})),n.on("ended",(function(){a&&function(e,t){t.ended||(t.ended=!0,q(e,t.ticker))}(n,r)}))}}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;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}("undefined"!=typeof window?window:void 0!==E?E:{},Analytics),Analytics}));
@@ -0,0 +1,304 @@
1
+ import hlsjs from 'hls.js';
2
+ import { LevelAttributes } from 'hls.js';
3
+ import type { MediaKeyFunc } from 'hls.js';
4
+
5
+ declare type AnyPlugin<PluginOwnConfig extends KeyValue> = Plugin_2<PluginOwnConfig> | Loader<PluginOwnConfig>;
6
+
7
+ declare type ArrayToIntersection<T extends Array<unknown>> = T extends [infer Current, ...infer Remaining] ? Current & ArrayToIntersection<Remaining> : unknown;
8
+
9
+ declare class Asel implements Plugin_2 {
10
+ static events: {
11
+ TRACKS: string;
12
+ SWITCH: string;
13
+ };
14
+ constructor(umd: FlowplayerUMD);
15
+ init(config: ConfigWith<{
16
+ asel?: boolean;
17
+ }>, root: PlayerRoot, player: PlayerWith<{
18
+ hls?: hlsjs;
19
+ asel: AselProperties;
20
+ audioTracks?: any;
21
+ }>): void;
22
+ }
23
+ export default Asel;
24
+
25
+ /* Excluded from this release type: AselProperties */
26
+
27
+ /* Excluded from this release type: AudioTrack */
28
+
29
+ declare enum AutoplayOpts {
30
+ OFF = 0,
31
+ ON = 1,
32
+ AUDIO_REQUIRED = 2
33
+ }
34
+
35
+ declare type BitOpts = number;
36
+
37
+ declare type Component = {
38
+ onrender?: (config: Config, root: PlayerRoot, player: Player) => void;
39
+ onremove?: (config: Config, root: PlayerRoot, player: Player) => void;
40
+ };
41
+
42
+ declare interface Components {
43
+ render(key: string, args: any[]): void;
44
+ remove(key: string, args: any[]): void;
45
+ put(key: string, args: Component): void;
46
+ }
47
+
48
+ declare interface Config {
49
+ src?: UnsafeSource;
50
+ preload?: "none" | "metadata" | "auto";
51
+ controls?: boolean;
52
+ lang?: string;
53
+ start_time?: number;
54
+ autopause?: boolean;
55
+ rewind?: boolean;
56
+ loop?: boolean;
57
+ seamless?: boolean;
58
+ retry?: boolean;
59
+ autoplay?: BitOpts;
60
+ start_quality?: BitOpts;
61
+ live?: boolean;
62
+ poster?: string;
63
+ disabled?: boolean;
64
+ muted?: boolean;
65
+ /**
66
+ * is src handled by one of plugins loaders
67
+ */
68
+ is_native?: boolean;
69
+ /**
70
+ * bitflags for UI options
71
+ */
72
+ ui?: BitOpts;
73
+ /**
74
+ * your user access token
75
+ */
76
+ token?: string;
77
+ /**
78
+ * manually configured duration for pre-rendering usually
79
+ */
80
+ duration?: number;
81
+ /**
82
+ * can the content be seeked to any position
83
+ */
84
+ seekable?: boolean;
85
+ multiplay?: boolean;
86
+ ratio?: number | string;
87
+ logo?: string;
88
+ logo_href?: string;
89
+ logo_alt_text?: string;
90
+ title?: string;
91
+ description?: string;
92
+ /**
93
+ * the number of seconds to have in the buffer before dvr is activated
94
+ */
95
+ seconds_to_dvr?: number;
96
+ }
97
+
98
+ declare namespace Configs {
99
+ export {
100
+ BitOpts,
101
+ FlowplayerCustomElementRegistry,
102
+ Config,
103
+ CustomConfig,
104
+ PluginConfig
105
+ }
106
+ }
107
+
108
+ declare type ConfigWith<T> = Configs.Config & T;
109
+
110
+ declare type CustomConfig<T> = Config & T;
111
+
112
+ declare type DeviceId = string;
113
+
114
+ declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
115
+
116
+ declare type DRMConfiguration = {
117
+ license_server: string;
118
+ http_headers?: Record<string, string>;
119
+ certificate?: string;
120
+ vendor?: string | DRMVendorImplementation;
121
+ request_media_key_system_access_function?: MediaKeyFunc;
122
+ query_params?: Record<string, string>;
123
+ };
124
+
125
+ declare type DRMSourceConfiguration = {
126
+ [keysystem in DRM_KEYSYSTEM]?: DRMConfiguration;
127
+ };
128
+
129
+ declare type DRMVendorImplementation = {
130
+ fairplay_fetch_certificate: (url: string, cb: (certificate_data: Uint8Array) => void) => void;
131
+ fairplay_request_license: (url: string, params: {
132
+ message: any;
133
+ assetId: string;
134
+ }, cb: (license_data: Uint8Array) => void) => void;
135
+ };
136
+
137
+ declare type FlowplayerCustomElementRegistry = Map<string, string>;
138
+
139
+ declare interface FlowplayerUMD extends FlowplayerUMDBase {
140
+ (selector: string, config?: Config): Player;
141
+ (element: HTMLElement, config?: Config): Player;
142
+ <T>(selector: string, config?: CustomConfig<T>): Player;
143
+ <T>(element: HTMLElement, config?: CustomConfig<T>): Player;
144
+ <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<CustomConfig<MergeConfigs<PluginCtors>>>;
145
+ }
146
+
147
+ declare interface FlowplayerUMDBase {
148
+ instances: Player[];
149
+ extensions: PluginCtor[];
150
+ events: Record<string, string>;
151
+ ads?: {
152
+ events: Record<string, string>;
153
+ };
154
+ states: Record<string, string>;
155
+ quality: typeof QualityOpts;
156
+ commit: string;
157
+ version: string;
158
+ customElements: FlowplayerCustomElementRegistry;
159
+ defaultElements: Record<string, string>;
160
+ components: Components;
161
+ support: any;
162
+ autoplay: typeof AutoplayOpts;
163
+ jwt: any;
164
+ loaders: any;
165
+ }
166
+
167
+ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config> extends FlowplayerUMDBase {
168
+ (selector: string, config?: ConfigWithPlugins): Player;
169
+ (element: HTMLElement, config?: ConfigWithPlugins): Player;
170
+ }
171
+
172
+ declare interface FPEvent<T> extends CustomEvent<T> {
173
+ /**
174
+ * @deprecated
175
+ the data attribute has been migrated to details to match the CustomEvent spec
176
+ more info: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
177
+ */
178
+ data?: T;
179
+ }
180
+
181
+ declare type JSONPlayer = any;
182
+
183
+ declare type KeyValue = Record<string, any>;
184
+
185
+ declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Plugin_2<PluginOwnConfig> {
186
+ onload<T = KeyValue>(config: PluginConfig<T>, root: PlayerRoot, video: Player, src?: SourceObj): void;
187
+ wants<S = SourceObj, T = KeyValue>(srcString: SourceStr, srcObj: S, config: PluginConfig<T>): boolean;
188
+ wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
189
+ }
190
+
191
+ declare type MapToConfigs<Arr extends PluginCtor[]> = {
192
+ [PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
193
+ };
194
+
195
+ declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
196
+
197
+ declare interface Player extends HTMLVideoElement {
198
+ renderPlugin: (pluginContainer: HTMLElement) => void;
199
+ toggleDisable: (flag: boolean) => void;
200
+ original_src: string;
201
+ root: PlayerRoot;
202
+ playerState: Record<string, boolean>;
203
+ reaper: Map<string, any> | 0;
204
+ hasState(state: PlayerState): boolean;
205
+ transitionState(to: PlayerState, from: PlayerState, timer?: number): void;
206
+ togglePlay(on?: boolean): Promise<void>;
207
+ toggleFullScreen(on?: boolean, state_only?: boolean): void;
208
+ toggleMute(on?: boolean): void;
209
+ destroy(): void;
210
+ render(): void;
211
+ render(component: string, args: any[]): void;
212
+ createComponents(...args: string[]): HTMLElement[];
213
+ setOpts(config: Config): void;
214
+ setSrc(sources: UnsafeSource): Player;
215
+ on<T>(event: string | string[], handler: (e: FPEvent<T>) => void): Player;
216
+ once<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
217
+ off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
218
+ poll<T>(event: string, data?: T): FPEvent<T>;
219
+ emit<T>(event: string, data?: T): Player;
220
+ setAttrs(attrs: Config): Player;
221
+ opt<T>(key: string, fallback?: T): T;
222
+ enqueueSeek(offset: number): any;
223
+ setState(state: string, flag: boolean): Player;
224
+ toJSON(): JSONPlayer;
225
+ i18n(k: string, fallback?: string): string;
226
+ deviceId(): DeviceId;
227
+ live_state: {
228
+ dvr?: boolean;
229
+ dvr_window?: number;
230
+ };
231
+ opts: Config;
232
+ plugins: Array<Plugin_2 | Loader>;
233
+ dvr_offset?: number;
234
+ message?: {
235
+ events: Record<string, string>;
236
+ };
237
+ disabled: boolean;
238
+ started?: boolean;
239
+ token: string;
240
+ tracks?: VideoTrack[];
241
+ _customElements: FlowplayerCustomElementRegistry;
242
+ _storage: Storage;
243
+ }
244
+
245
+ declare type PlayerRoot = HTMLElement & {
246
+ prevWidth?: number;
247
+ };
248
+
249
+ declare namespace Players {
250
+ export {
251
+ VideoTrack,
252
+ PlayerState,
253
+ FPEvent,
254
+ DeviceId,
255
+ JSONPlayer,
256
+ PlayerRoot,
257
+ Player
258
+ }
259
+ }
260
+
261
+ declare type PlayerState = string;
262
+
263
+ declare type PlayerWith<T> = Players.Player & T;
264
+
265
+ declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
266
+ /**
267
+ * a plugin must always implement the init method so a player instance knows how to initialize it
268
+ */
269
+ init<T>(config: PluginConfig<T>, container: PlayerRoot, player: Player): void;
270
+ init(config: PluginConfig<PluginOwnConfig>, container: PlayerRoot, player: Player): void;
271
+ }
272
+
273
+ declare type PluginConfig<T> = Config & T;
274
+
275
+ declare interface PluginCtor<PluginOwnConfig extends KeyValue = KeyValue> {
276
+ new (umd: FlowplayerUMD, player: Player): AnyPlugin<PluginOwnConfig>;
277
+ }
278
+
279
+ declare enum QualityOpts {
280
+ LOW = 1,
281
+ MEDIUM = 2,
282
+ HIGH = 4
283
+ }
284
+
285
+ declare type SourceObj = {
286
+ src?: SourceStr;
287
+ type?: string;
288
+ drm?: DRMSourceConfiguration;
289
+ };
290
+
291
+ declare type SourceStr = string;
292
+
293
+ declare type SourceWith<T> = SourceObj & T;
294
+
295
+ declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
296
+
297
+ declare interface VideoTrack {
298
+ name: string;
299
+ data: any;
300
+ default: boolean;
301
+ selected: boolean;
302
+ }
303
+
304
+ export { }