@flowplayer/player 3.15.1-rc → 3.16.0-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/events.d.ts +22 -2
- package/core/events.js +50 -50
- package/core.js +1 -1
- package/default.js +1 -1
- package/embed.js +2 -2
- package/flowplayer.css +1 -1
- package/index.d.ts +78 -35
- package/package.json +1 -1
- package/plugins/ads.d.ts +76 -33
- package/plugins/ads.js +1 -1
- package/plugins/airplay.d.ts +76 -33
- package/plugins/analytics.d.ts +76 -33
- package/plugins/analytics.js +1 -1
- package/plugins/asel.d.ts +221 -36
- package/plugins/asel.js +1 -1
- package/plugins/audio.d.ts +76 -33
- package/plugins/chapters.d.ts +76 -33
- package/plugins/chromecast.d.ts +76 -33
- package/plugins/chromecast.js +1 -1
- package/plugins/comscore.d.ts +76 -33
- package/plugins/consent.d.ts +76 -33
- package/plugins/context-menu.d.ts +76 -33
- package/plugins/cuepoints.d.ts +76 -33
- package/plugins/dash.d.ts +76 -33
- package/plugins/dash.js +1 -1
- package/plugins/drm.d.ts +76 -33
- package/plugins/endscreen.d.ts +76 -33
- package/plugins/fas.d.ts +76 -33
- package/plugins/float-on-scroll.d.ts +76 -33
- package/plugins/ga4.d.ts +76 -33
- package/plugins/gemius.d.ts +76 -33
- package/plugins/google-analytics.d.ts +76 -33
- package/plugins/health.d.ts +76 -33
- package/plugins/health.js +1 -1
- package/plugins/hls.d.ts +76 -33
- package/plugins/hls.js +1 -1
- package/plugins/id3.d.ts +76 -33
- package/plugins/iframe.d.ts +76 -33
- package/plugins/keyboard.d.ts +76 -33
- package/plugins/media-session.d.ts +76 -33
- package/plugins/message.d.ts +76 -33
- package/plugins/ovp.d.ts +76 -33
- package/plugins/playlist.d.ts +107 -33
- package/plugins/playlist.js +1 -1
- package/plugins/preview.d.ts +76 -33
- package/plugins/qsel.d.ts +76 -33
- package/plugins/qul.d.ts +76 -33
- package/plugins/rts.d.ts +76 -33
- package/plugins/share.d.ts +76 -33
- package/plugins/speed.d.ts +76 -33
- package/plugins/ssai.d.ts +76 -33
- package/plugins/ssai.js +1 -1
- package/plugins/subtitles.d.ts +76 -33
- package/plugins/thumbnails.d.ts +76 -33
- package/plugins/tizen.d.ts +76 -33
- package/plugins/vtsel.d.ts +76 -33
- package/plugins/webos.d.ts +76 -33
- package/util/loader.d.ts +76 -33
package/plugins/analytics.d.ts
CHANGED
|
@@ -350,6 +350,7 @@ declare type ErrorEventDetail = {
|
|
|
350
350
|
declare namespace events {
|
|
351
351
|
export {
|
|
352
352
|
MOUNT,
|
|
353
|
+
RETRY,
|
|
353
354
|
ERROR,
|
|
354
355
|
CONTEXT_MENU,
|
|
355
356
|
CLICK,
|
|
@@ -401,7 +402,8 @@ declare namespace events {
|
|
|
401
402
|
LANDSCAPE,
|
|
402
403
|
PORTRAIT,
|
|
403
404
|
DVR,
|
|
404
|
-
|
|
405
|
+
LIVE,
|
|
406
|
+
RECOVER
|
|
405
407
|
}
|
|
406
408
|
}
|
|
407
409
|
|
|
@@ -600,8 +602,6 @@ declare const /**
|
|
|
600
602
|
*/
|
|
601
603
|
LANDSCAPE = "landscape";
|
|
602
604
|
|
|
603
|
-
declare const LIVE = "is-live";
|
|
604
|
-
|
|
605
605
|
/**
|
|
606
606
|
* @public
|
|
607
607
|
* when src is a livestream
|
|
@@ -613,7 +613,9 @@ declare const /**
|
|
|
613
613
|
* @public
|
|
614
614
|
* when src is a livestream
|
|
615
615
|
*/
|
|
616
|
-
|
|
616
|
+
LIVE = "live";
|
|
617
|
+
|
|
618
|
+
declare const LIVE_2 = "is-live";
|
|
617
619
|
|
|
618
620
|
declare const LIVE_SEEKED = "is-live-seeked";
|
|
619
621
|
|
|
@@ -913,33 +915,27 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
|
|
|
913
915
|
|
|
914
916
|
declare type PlayerCustomEventName = keyof PlayerCustomEventsDetailMap;
|
|
915
917
|
|
|
916
|
-
declare type PlayerCustomEventsDetailMap = {
|
|
917
|
-
[
|
|
918
|
-
[
|
|
919
|
-
[CONTEXT_MENU]: ContextMenuEventDetail;
|
|
920
|
-
/* Excluded from this release type: beforeplay */
|
|
921
|
-
/* Excluded from this release type: beforepause */
|
|
922
|
-
/* Excluded from this release type: state */
|
|
918
|
+
declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap & {
|
|
919
|
+
[REAP]: ReapEventDetail;
|
|
920
|
+
[SOURCE]: SourceEventDetail;
|
|
923
921
|
[CUEPOINT_START]: CuePointStartEventDetail;
|
|
924
922
|
[CUEPOINT_END]: CuePointEndEventDetail;
|
|
925
|
-
[
|
|
926
|
-
[
|
|
927
|
-
[
|
|
928
|
-
|
|
929
|
-
[
|
|
930
|
-
/* Excluded from this release type: config */
|
|
931
|
-
[QUALITIES]: QualitiesEventDetail;
|
|
932
|
-
/* Excluded from this release type: "error:fatal" */
|
|
933
|
-
[RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
|
|
923
|
+
[MOUNT]: MountEventDetail;
|
|
924
|
+
[LIVE]: LiveEventDetail;
|
|
925
|
+
[DVR]: DvrEventDetail;
|
|
926
|
+
[RETRY]: RetryEventDetail;
|
|
927
|
+
[RECOVER]: RecoverEventDetail;
|
|
934
928
|
/* Excluded from this release type: audioonlysource */
|
|
935
929
|
/* Excluded from this release type: renderplugin */
|
|
936
|
-
[DVR]: DvrEventDetail;
|
|
937
|
-
[LIVE_2]: LiveEventDetail;
|
|
938
930
|
/* Excluded from this release type: "seek:queued" */
|
|
939
931
|
/* Excluded from this release type: "seek:cancel" */
|
|
940
932
|
/* Excluded from this release type: "plugin:registered" */
|
|
941
933
|
/* Excluded from this release type: intersectionchange */
|
|
942
|
-
/* Excluded from this release type:
|
|
934
|
+
/* Excluded from this release type: beforeplay */
|
|
935
|
+
/* Excluded from this release type: beforepause */
|
|
936
|
+
/* Excluded from this release type: state */
|
|
937
|
+
/* Excluded from this release type: config */
|
|
938
|
+
/* Excluded from this release type: "error:fatal" */
|
|
943
939
|
};
|
|
944
940
|
|
|
945
941
|
declare type PlayerCustomEventsOverloads = {
|
|
@@ -978,11 +974,18 @@ declare type PlayerCustomEventsOverloads = {
|
|
|
978
974
|
* Sent right before the player src attribute is set. This allows you to change the video URL before playback.
|
|
979
975
|
*/
|
|
980
976
|
on(event: typeof SOURCE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof SOURCE]>) => void): Player;
|
|
981
|
-
|
|
977
|
+
/**
|
|
978
|
+
* Emitted when an Error recovery is attempted
|
|
979
|
+
*/
|
|
980
|
+
on(event: typeof RECOVER, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RECOVER]>) => void): Player;
|
|
982
981
|
/**
|
|
983
982
|
* Sent when a flowplayer instance is about to be removed from the DOM, and any unsafe references are about to be reaped, which allows Single Page Applications to perform the necessary resource cleanups. This is important when working with front-end frameworks like React. This event should never be emitted directly, only listened to.
|
|
984
983
|
*/
|
|
985
984
|
on(event: typeof REAP, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof REAP]>) => void): Player;
|
|
985
|
+
/**
|
|
986
|
+
* Emitted when a player will retry to reload
|
|
987
|
+
*/
|
|
988
|
+
on(event: typeof RETRY, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RETRY]>) => void): Player;
|
|
986
989
|
/* Excluded from this release type: on */
|
|
987
990
|
/**
|
|
988
991
|
* Emitted when the set of underlying qualities has changed.
|
|
@@ -1002,8 +1005,7 @@ declare type PlayerCustomEventsOverloads = {
|
|
|
1002
1005
|
/**
|
|
1003
1006
|
* when src is a livestream
|
|
1004
1007
|
*/
|
|
1005
|
-
on(event: typeof
|
|
1006
|
-
/* Excluded from this release type: on */
|
|
1008
|
+
on(event: typeof LIVE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof LIVE]>) => void): Player;
|
|
1007
1009
|
/* Excluded from this release type: on */
|
|
1008
1010
|
/* Excluded from this release type: on */
|
|
1009
1011
|
/* Excluded from this release type: on */
|
|
@@ -1032,11 +1034,26 @@ declare type PlayerCustomEventsOverloads = {
|
|
|
1032
1034
|
*/
|
|
1033
1035
|
off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
|
|
1034
1036
|
/* Excluded from this release type: poll */
|
|
1035
|
-
emit<T extends PlayerCustomEventName>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
|
|
1036
1037
|
/* Excluded from this release type: emit */
|
|
1037
|
-
|
|
1038
|
+
/* Excluded from this release type: emit */
|
|
1039
|
+
emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
|
|
1040
|
+
/* Excluded from this release type: emit */
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
declare type PlayerEmittableCustomEventsDetailMap = {
|
|
1044
|
+
[ERROR]: ErrorEventDetail;
|
|
1045
|
+
[CONTEXT_MENU]: ContextMenuEventDetail;
|
|
1046
|
+
[VIEW_ENTER]: ViewEnterEventDetail;
|
|
1047
|
+
[VIEW_LEAVE]: ViewLeaveEventDetail;
|
|
1048
|
+
[QUALITIES]: QualitiesEventDetail;
|
|
1049
|
+
[RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
|
|
1038
1050
|
};
|
|
1039
1051
|
|
|
1052
|
+
declare type PlayerEmittableEventNames = keyof PlayerEmittableCustomEventsDetailMap;
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* @public
|
|
1056
|
+
*/
|
|
1040
1057
|
declare type PlayerEventOverloads = PlayerNativeEventsOverloads & PlayerCustomEventsOverloads;
|
|
1041
1058
|
|
|
1042
1059
|
declare type PlayerNativeEventName = keyof PlayerNativeEventsDetailMap;
|
|
@@ -1230,9 +1247,23 @@ declare type RecommendationsReadyEventDetail = {
|
|
|
1230
1247
|
playlist: RecommendationItem[];
|
|
1231
1248
|
};
|
|
1232
1249
|
|
|
1233
|
-
|
|
1250
|
+
/**
|
|
1251
|
+
* @public
|
|
1252
|
+
* emitted when an Error recovery is attempted
|
|
1253
|
+
*/
|
|
1254
|
+
declare const /**
|
|
1255
|
+
@public
|
|
1256
|
+
* when a new player is inserted into the HTML
|
|
1257
|
+
*/ /**
|
|
1258
|
+
* @public
|
|
1259
|
+
* emitted when an Error recovery is attempted
|
|
1260
|
+
*/
|
|
1261
|
+
RECOVER = "recover";
|
|
1234
1262
|
|
|
1235
|
-
|
|
1263
|
+
/**
|
|
1264
|
+
* @public
|
|
1265
|
+
*/
|
|
1266
|
+
declare type RecoverEventDetail = null;
|
|
1236
1267
|
|
|
1237
1268
|
/* Excluded from this release type: REMOTE_SESSION_ENDED */
|
|
1238
1269
|
|
|
@@ -1256,9 +1287,21 @@ declare const /**
|
|
|
1256
1287
|
*/
|
|
1257
1288
|
RESIZE = "resize";
|
|
1258
1289
|
|
|
1259
|
-
|
|
1290
|
+
/**
|
|
1291
|
+
* @public
|
|
1292
|
+
*/
|
|
1293
|
+
declare const /**
|
|
1294
|
+
@public
|
|
1295
|
+
* when a new player is inserted into the HTML
|
|
1296
|
+
*/ /**
|
|
1297
|
+
* @public
|
|
1298
|
+
*/
|
|
1299
|
+
RETRY = "retry";
|
|
1260
1300
|
|
|
1261
|
-
|
|
1301
|
+
/**
|
|
1302
|
+
* @public
|
|
1303
|
+
*/
|
|
1304
|
+
declare type RetryEventDetail = null;
|
|
1262
1305
|
|
|
1263
1306
|
declare const RTL = "is-rtl";
|
|
1264
1307
|
|
|
@@ -1393,7 +1436,7 @@ declare namespace states {
|
|
|
1393
1436
|
RTL,
|
|
1394
1437
|
TV,
|
|
1395
1438
|
ENDED,
|
|
1396
|
-
LIVE,
|
|
1439
|
+
LIVE_2 as LIVE,
|
|
1397
1440
|
ERRORED,
|
|
1398
1441
|
WAITING,
|
|
1399
1442
|
AUTOPLAY,
|
package/plugins/analytics.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.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"string"==typeof e&&e.slice(0,200)}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))))}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)}("undefined"!=typeof window?window:void 0!==E?E:{},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.15.1-rc"},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)}))}})}));
|
|
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"string"==typeof e&&e.slice(0,200)}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))))}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)}("undefined"!=typeof window?window:void 0!==E?E:{},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.16.0-rc"},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)}))}})}));
|
package/plugins/asel.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
3
|
import type { BitrateInfo } from 'dashjs';
|
|
4
|
+
import type Hls from 'hls.js';
|
|
4
5
|
import type { LevelAttributes } from 'hls.js';
|
|
5
6
|
import type { MediaKeyFunc } from 'hls.js';
|
|
6
7
|
|
|
@@ -13,11 +14,101 @@ infer Current,
|
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @public
|
|
17
|
+
* Adds a selection menu for multiple audio tracks in HLS or DASH streams.
|
|
18
|
+
* See {@link https://docs.flowplayer.com/plugins/asel#api |Official documentation}
|
|
16
19
|
*/
|
|
17
|
-
declare const Asel: PluginCtor<
|
|
20
|
+
declare const Asel: PluginCtor<AselConfig, AselPlayer> & AselAPI;
|
|
18
21
|
export default Asel;
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare type AselAPI = {
|
|
27
|
+
events: AselEvents;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare type AselConfig = ConfigWith<{
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for Asel plugin.
|
|
36
|
+
* The configuration option can either be `false` which disables audio selection or a configuration object
|
|
37
|
+
*/
|
|
38
|
+
asel?: boolean | {
|
|
39
|
+
/**
|
|
40
|
+
* A string containing the desired default language. Has to match an existing language attribute in the HLS manifest
|
|
41
|
+
*/
|
|
42
|
+
default_lang: string;
|
|
43
|
+
/**
|
|
44
|
+
* A sorting function to control the order of the items in the menu. See {@link https://docs.flowplayer.com/plugins/asel#sorting| more about sorting}
|
|
45
|
+
* @param a - A track to compare
|
|
46
|
+
* @param b - A track to compare
|
|
47
|
+
* @returns Number specifying a sorting order, as in Array.sort()
|
|
48
|
+
*/
|
|
49
|
+
sort: (a: AudioTrack, b: AudioTrack) => number;
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
export declare type AselEvents = typeof events_2;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export declare type AselPlayer = PlayerWith<{
|
|
62
|
+
/**
|
|
63
|
+
* Exposing Asel plugin Player API
|
|
64
|
+
*/
|
|
65
|
+
asel?: AselProperties;
|
|
66
|
+
/**
|
|
67
|
+
* When a track is being selected
|
|
68
|
+
* @param event - Event id
|
|
69
|
+
* @param handler - Event handler containing selected track details
|
|
70
|
+
*/
|
|
71
|
+
on(event: AselEvents["SET"], handler: (event: FPEvent<SetEventDetail>) => void): Player;
|
|
72
|
+
/**
|
|
73
|
+
* When audio track is switched
|
|
74
|
+
* @param event - Event id
|
|
75
|
+
* @param handler - Event handler containing a new track index
|
|
76
|
+
*/
|
|
77
|
+
on(event: AselEvents["SWITCH"], handler: (event: FPEvent<SwitchEventDetail>) => void): Player;
|
|
78
|
+
/**
|
|
79
|
+
* When tracks are parsed from the manifest and available
|
|
80
|
+
* @param event - Event id
|
|
81
|
+
* @param handler - Event handler containing array of tracks
|
|
82
|
+
*/
|
|
83
|
+
on(event: AselEvents["TRACKS"], handler: (event: FPEvent<TracksEventDetail>) => void): Player;
|
|
84
|
+
/* Excluded from this release type: emit */
|
|
85
|
+
/* Excluded from this release type: emit */
|
|
86
|
+
/* Excluded from this release type: emit */
|
|
87
|
+
/* Excluded from this release type: hls */
|
|
88
|
+
/* Excluded from this release type: audioTracks */
|
|
89
|
+
}>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
export declare interface AselProperties {
|
|
95
|
+
/* Excluded from this release type: events */
|
|
96
|
+
/**
|
|
97
|
+
* A list of audio tracks for the stream.
|
|
98
|
+
*/
|
|
99
|
+
tracks: Array<AudioTrack>;
|
|
100
|
+
/**
|
|
101
|
+
* Function for changing the current track
|
|
102
|
+
* @param trackIndex - Refers to the index in the tracks array
|
|
103
|
+
*/
|
|
104
|
+
set(trackIndex: number): void;
|
|
105
|
+
/* Excluded from this release type: set */
|
|
106
|
+
/**
|
|
107
|
+
* A function that allows accessing tracks by their index
|
|
108
|
+
*/
|
|
109
|
+
get(trackIndex: number): AudioTrack;
|
|
110
|
+
/* Excluded from this release type: active_track */
|
|
111
|
+
}
|
|
21
112
|
|
|
22
113
|
/**
|
|
23
114
|
* Each loader must
|
|
@@ -30,7 +121,20 @@ declare type _AttachedEventCheck = {
|
|
|
30
121
|
|
|
31
122
|
/* Excluded from this release type: AudioOnlySourceEventDetail */
|
|
32
123
|
|
|
33
|
-
|
|
124
|
+
/**
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
export declare type AudioTrack = {
|
|
128
|
+
id: string;
|
|
129
|
+
autoselect: boolean;
|
|
130
|
+
default: boolean;
|
|
131
|
+
lang: string;
|
|
132
|
+
name: string;
|
|
133
|
+
/* Excluded from this release type: kind */
|
|
134
|
+
/* Excluded from this release type: label */
|
|
135
|
+
/* Excluded from this release type: attr */
|
|
136
|
+
/* Excluded from this release type: enabled */
|
|
137
|
+
};
|
|
34
138
|
|
|
35
139
|
declare const AUTOPLAY = "is-autoplay";
|
|
36
140
|
|
|
@@ -355,6 +459,7 @@ declare type ErrorEventDetail = {
|
|
|
355
459
|
declare namespace events {
|
|
356
460
|
export {
|
|
357
461
|
MOUNT,
|
|
462
|
+
RETRY,
|
|
358
463
|
ERROR,
|
|
359
464
|
CONTEXT_MENU,
|
|
360
465
|
CLICK,
|
|
@@ -406,7 +511,16 @@ declare namespace events {
|
|
|
406
511
|
LANDSCAPE,
|
|
407
512
|
PORTRAIT,
|
|
408
513
|
DVR,
|
|
409
|
-
|
|
514
|
+
LIVE,
|
|
515
|
+
RECOVER
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
declare namespace events_2 {
|
|
520
|
+
export {
|
|
521
|
+
SET,
|
|
522
|
+
SWITCH,
|
|
523
|
+
TRACKS
|
|
410
524
|
}
|
|
411
525
|
}
|
|
412
526
|
|
|
@@ -605,8 +719,6 @@ declare const /**
|
|
|
605
719
|
*/
|
|
606
720
|
LANDSCAPE = "landscape";
|
|
607
721
|
|
|
608
|
-
declare const LIVE = "is-live";
|
|
609
|
-
|
|
610
722
|
/**
|
|
611
723
|
* @public
|
|
612
724
|
* when src is a livestream
|
|
@@ -618,7 +730,9 @@ declare const /**
|
|
|
618
730
|
* @public
|
|
619
731
|
* when src is a livestream
|
|
620
732
|
*/
|
|
621
|
-
|
|
733
|
+
LIVE = "live";
|
|
734
|
+
|
|
735
|
+
declare const LIVE_2 = "is-live";
|
|
622
736
|
|
|
623
737
|
declare const LIVE_SEEKED = "is-live-seeked";
|
|
624
738
|
|
|
@@ -918,33 +1032,27 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
|
|
|
918
1032
|
|
|
919
1033
|
declare type PlayerCustomEventName = keyof PlayerCustomEventsDetailMap;
|
|
920
1034
|
|
|
921
|
-
declare type PlayerCustomEventsDetailMap = {
|
|
922
|
-
[
|
|
923
|
-
[
|
|
924
|
-
[CONTEXT_MENU]: ContextMenuEventDetail;
|
|
925
|
-
/* Excluded from this release type: beforeplay */
|
|
926
|
-
/* Excluded from this release type: beforepause */
|
|
927
|
-
/* Excluded from this release type: state */
|
|
1035
|
+
declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap & {
|
|
1036
|
+
[REAP]: ReapEventDetail;
|
|
1037
|
+
[SOURCE]: SourceEventDetail;
|
|
928
1038
|
[CUEPOINT_START]: CuePointStartEventDetail;
|
|
929
1039
|
[CUEPOINT_END]: CuePointEndEventDetail;
|
|
930
|
-
[
|
|
931
|
-
[
|
|
932
|
-
[
|
|
933
|
-
|
|
934
|
-
[
|
|
935
|
-
/* Excluded from this release type: config */
|
|
936
|
-
[QUALITIES]: QualitiesEventDetail;
|
|
937
|
-
/* Excluded from this release type: "error:fatal" */
|
|
938
|
-
[RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
|
|
1040
|
+
[MOUNT]: MountEventDetail;
|
|
1041
|
+
[LIVE]: LiveEventDetail;
|
|
1042
|
+
[DVR]: DvrEventDetail;
|
|
1043
|
+
[RETRY]: RetryEventDetail;
|
|
1044
|
+
[RECOVER]: RecoverEventDetail;
|
|
939
1045
|
/* Excluded from this release type: audioonlysource */
|
|
940
1046
|
/* Excluded from this release type: renderplugin */
|
|
941
|
-
[DVR]: DvrEventDetail;
|
|
942
|
-
[LIVE_2]: LiveEventDetail;
|
|
943
1047
|
/* Excluded from this release type: "seek:queued" */
|
|
944
1048
|
/* Excluded from this release type: "seek:cancel" */
|
|
945
1049
|
/* Excluded from this release type: "plugin:registered" */
|
|
946
1050
|
/* Excluded from this release type: intersectionchange */
|
|
947
|
-
/* Excluded from this release type:
|
|
1051
|
+
/* Excluded from this release type: beforeplay */
|
|
1052
|
+
/* Excluded from this release type: beforepause */
|
|
1053
|
+
/* Excluded from this release type: state */
|
|
1054
|
+
/* Excluded from this release type: config */
|
|
1055
|
+
/* Excluded from this release type: "error:fatal" */
|
|
948
1056
|
};
|
|
949
1057
|
|
|
950
1058
|
declare type PlayerCustomEventsOverloads = {
|
|
@@ -983,11 +1091,18 @@ declare type PlayerCustomEventsOverloads = {
|
|
|
983
1091
|
* Sent right before the player src attribute is set. This allows you to change the video URL before playback.
|
|
984
1092
|
*/
|
|
985
1093
|
on(event: typeof SOURCE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof SOURCE]>) => void): Player;
|
|
986
|
-
|
|
1094
|
+
/**
|
|
1095
|
+
* Emitted when an Error recovery is attempted
|
|
1096
|
+
*/
|
|
1097
|
+
on(event: typeof RECOVER, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RECOVER]>) => void): Player;
|
|
987
1098
|
/**
|
|
988
1099
|
* Sent when a flowplayer instance is about to be removed from the DOM, and any unsafe references are about to be reaped, which allows Single Page Applications to perform the necessary resource cleanups. This is important when working with front-end frameworks like React. This event should never be emitted directly, only listened to.
|
|
989
1100
|
*/
|
|
990
1101
|
on(event: typeof REAP, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof REAP]>) => void): Player;
|
|
1102
|
+
/**
|
|
1103
|
+
* Emitted when a player will retry to reload
|
|
1104
|
+
*/
|
|
1105
|
+
on(event: typeof RETRY, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RETRY]>) => void): Player;
|
|
991
1106
|
/* Excluded from this release type: on */
|
|
992
1107
|
/**
|
|
993
1108
|
* Emitted when the set of underlying qualities has changed.
|
|
@@ -1007,8 +1122,7 @@ declare type PlayerCustomEventsOverloads = {
|
|
|
1007
1122
|
/**
|
|
1008
1123
|
* when src is a livestream
|
|
1009
1124
|
*/
|
|
1010
|
-
on(event: typeof
|
|
1011
|
-
/* Excluded from this release type: on */
|
|
1125
|
+
on(event: typeof LIVE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof LIVE]>) => void): Player;
|
|
1012
1126
|
/* Excluded from this release type: on */
|
|
1013
1127
|
/* Excluded from this release type: on */
|
|
1014
1128
|
/* Excluded from this release type: on */
|
|
@@ -1037,11 +1151,26 @@ declare type PlayerCustomEventsOverloads = {
|
|
|
1037
1151
|
*/
|
|
1038
1152
|
off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
|
|
1039
1153
|
/* Excluded from this release type: poll */
|
|
1040
|
-
emit<T extends PlayerCustomEventName>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
|
|
1041
1154
|
/* Excluded from this release type: emit */
|
|
1042
|
-
|
|
1155
|
+
/* Excluded from this release type: emit */
|
|
1156
|
+
emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
|
|
1157
|
+
/* Excluded from this release type: emit */
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1160
|
+
declare type PlayerEmittableCustomEventsDetailMap = {
|
|
1161
|
+
[ERROR]: ErrorEventDetail;
|
|
1162
|
+
[CONTEXT_MENU]: ContextMenuEventDetail;
|
|
1163
|
+
[VIEW_ENTER]: ViewEnterEventDetail;
|
|
1164
|
+
[VIEW_LEAVE]: ViewLeaveEventDetail;
|
|
1165
|
+
[QUALITIES]: QualitiesEventDetail;
|
|
1166
|
+
[RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
|
|
1043
1167
|
};
|
|
1044
1168
|
|
|
1169
|
+
declare type PlayerEmittableEventNames = keyof PlayerEmittableCustomEventsDetailMap;
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
* @public
|
|
1173
|
+
*/
|
|
1045
1174
|
declare type PlayerEventOverloads = PlayerNativeEventsOverloads & PlayerCustomEventsOverloads;
|
|
1046
1175
|
|
|
1047
1176
|
declare type PlayerNativeEventName = keyof PlayerNativeEventsDetailMap;
|
|
@@ -1235,9 +1364,23 @@ declare type RecommendationsReadyEventDetail = {
|
|
|
1235
1364
|
playlist: RecommendationItem[];
|
|
1236
1365
|
};
|
|
1237
1366
|
|
|
1238
|
-
|
|
1367
|
+
/**
|
|
1368
|
+
* @public
|
|
1369
|
+
* emitted when an Error recovery is attempted
|
|
1370
|
+
*/
|
|
1371
|
+
declare const /**
|
|
1372
|
+
@public
|
|
1373
|
+
* when a new player is inserted into the HTML
|
|
1374
|
+
*/ /**
|
|
1375
|
+
* @public
|
|
1376
|
+
* emitted when an Error recovery is attempted
|
|
1377
|
+
*/
|
|
1378
|
+
RECOVER = "recover";
|
|
1239
1379
|
|
|
1240
|
-
|
|
1380
|
+
/**
|
|
1381
|
+
* @public
|
|
1382
|
+
*/
|
|
1383
|
+
declare type RecoverEventDetail = null;
|
|
1241
1384
|
|
|
1242
1385
|
/* Excluded from this release type: REMOTE_SESSION_ENDED */
|
|
1243
1386
|
|
|
@@ -1261,9 +1404,21 @@ declare const /**
|
|
|
1261
1404
|
*/
|
|
1262
1405
|
RESIZE = "resize";
|
|
1263
1406
|
|
|
1264
|
-
|
|
1407
|
+
/**
|
|
1408
|
+
* @public
|
|
1409
|
+
*/
|
|
1410
|
+
declare const /**
|
|
1411
|
+
@public
|
|
1412
|
+
* when a new player is inserted into the HTML
|
|
1413
|
+
*/ /**
|
|
1414
|
+
* @public
|
|
1415
|
+
*/
|
|
1416
|
+
RETRY = "retry";
|
|
1265
1417
|
|
|
1266
|
-
|
|
1418
|
+
/**
|
|
1419
|
+
* @public
|
|
1420
|
+
*/
|
|
1421
|
+
declare type RetryEventDetail = null;
|
|
1267
1422
|
|
|
1268
1423
|
declare const RTL = "is-rtl";
|
|
1269
1424
|
|
|
@@ -1314,6 +1469,11 @@ SEEKING_2 = "seeking";
|
|
|
1314
1469
|
|
|
1315
1470
|
/* Excluded from this release type: SeekQueuedEventDetail */
|
|
1316
1471
|
|
|
1472
|
+
/**
|
|
1473
|
+
* Emitted to change the audio track in the underlying system
|
|
1474
|
+
*/
|
|
1475
|
+
declare const SET = "audio:set";
|
|
1476
|
+
|
|
1317
1477
|
/**
|
|
1318
1478
|
* @public
|
|
1319
1479
|
* allows plugins to listen for forced quality changes
|
|
@@ -1333,6 +1493,11 @@ declare const /**
|
|
|
1333
1493
|
*/
|
|
1334
1494
|
SET_QUALITY = "quality:set";
|
|
1335
1495
|
|
|
1496
|
+
/**
|
|
1497
|
+
* @public
|
|
1498
|
+
*/
|
|
1499
|
+
export declare type SetEventDetail = AudioTrack;
|
|
1500
|
+
|
|
1336
1501
|
declare const SMALL = "is-small";
|
|
1337
1502
|
|
|
1338
1503
|
/**
|
|
@@ -1398,7 +1563,7 @@ declare namespace states {
|
|
|
1398
1563
|
RTL,
|
|
1399
1564
|
TV,
|
|
1400
1565
|
ENDED,
|
|
1401
|
-
LIVE,
|
|
1566
|
+
LIVE_2 as LIVE,
|
|
1402
1567
|
ERRORED,
|
|
1403
1568
|
WAITING,
|
|
1404
1569
|
AUTOPLAY,
|
|
@@ -1422,6 +1587,16 @@ declare namespace states {
|
|
|
1422
1587
|
}
|
|
1423
1588
|
}
|
|
1424
1589
|
|
|
1590
|
+
/**
|
|
1591
|
+
* Emitted whenever an internal system actually changes an audio track
|
|
1592
|
+
*/
|
|
1593
|
+
declare const SWITCH = "audio:update";
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* @public
|
|
1597
|
+
*/
|
|
1598
|
+
export declare type SwitchEventDetail = number;
|
|
1599
|
+
|
|
1425
1600
|
/**
|
|
1426
1601
|
* @public
|
|
1427
1602
|
*/
|
|
@@ -1485,6 +1660,16 @@ TOUCH_START = "touchstart";
|
|
|
1485
1660
|
|
|
1486
1661
|
declare const TOUCHED = "is-touched";
|
|
1487
1662
|
|
|
1663
|
+
/**
|
|
1664
|
+
* Emitted when the list of audio tracks is updated
|
|
1665
|
+
*/
|
|
1666
|
+
declare const TRACKS = "audio:tracks";
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* @public
|
|
1670
|
+
*/
|
|
1671
|
+
export declare type TracksEventDetail = AudioTrack[];
|
|
1672
|
+
|
|
1488
1673
|
declare const TV = "is-tv";
|
|
1489
1674
|
|
|
1490
1675
|
/**
|