@flowplayer/player 3.29.0 → 3.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.js +1 -1
- package/default.js +1 -1
- package/embed.js +2 -2
- package/index.d.ts +4 -4
- package/package.json +2 -2
- package/plugins/ads.d.ts +4 -4
- package/plugins/ads.js +2 -2
- package/plugins/airplay.d.ts +4 -4
- package/plugins/airplay.js +1 -1
- package/plugins/analytics.d.ts +4 -4
- package/plugins/analytics.js +1 -1
- package/plugins/asel.d.ts +4 -4
- package/plugins/asel.js +1 -1
- package/plugins/audio.d.ts +4 -4
- package/plugins/audio.js +1 -1
- package/plugins/chapters.d.ts +4 -4
- package/plugins/chapters.js +1 -1
- package/plugins/chromecast.d.ts +4 -4
- package/plugins/chromecast.js +1 -1
- package/plugins/comscore.d.ts +4 -4
- package/plugins/comscore.js +1 -1
- package/plugins/consent.d.ts +4 -4
- package/plugins/consent.js +1 -1
- package/plugins/context-menu.d.ts +4 -4
- package/plugins/context-menu.js +1 -1
- package/plugins/cuepoints.d.ts +4 -4
- package/plugins/cuepoints.js +1 -1
- package/plugins/dash.d.ts +4 -4
- package/plugins/dash.js +2 -5
- package/plugins/drm.d.ts +4 -4
- package/plugins/drm.js +1 -1
- package/plugins/endscreen.d.ts +4 -4
- package/plugins/endscreen.js +1 -1
- package/plugins/fas.d.ts +4 -4
- package/plugins/fas.js +1 -1
- package/plugins/float-on-scroll.d.ts +4 -4
- package/plugins/float-on-scroll.js +1 -1
- package/plugins/ga4.d.ts +4 -4
- package/plugins/ga4.js +1 -1
- package/plugins/gemius.d.ts +4 -4
- package/plugins/gemius.js +1 -1
- package/plugins/google-analytics.d.ts +4 -4
- package/plugins/google-analytics.js +1 -1
- package/plugins/hls.d.ts +4 -4
- package/plugins/hls.js +1 -1
- package/plugins/id3.d.ts +4 -4
- package/plugins/id3.js +1 -1
- package/plugins/iframe.d.ts +4 -4
- package/plugins/iframe.js +1 -1
- package/plugins/keyboard.d.ts +4 -4
- package/plugins/keyboard.js +1 -1
- package/plugins/media-session.d.ts +4 -4
- package/plugins/media-session.js +1 -1
- package/plugins/message.d.ts +4 -4
- package/plugins/message.js +1 -1
- package/plugins/ovp.d.ts +10 -4
- package/plugins/ovp.js +1 -1
- package/plugins/playlist.d.ts +4 -4
- package/plugins/playlist.js +1 -1
- package/plugins/preview.d.ts +4 -4
- package/plugins/preview.js +1 -1
- package/plugins/qsel.d.ts +4 -4
- package/plugins/qsel.js +1 -1
- package/plugins/qul.d.ts +4 -4
- package/plugins/qul.js +1 -1
- package/plugins/rts.d.ts +4 -4
- package/plugins/rts.js +7 -7
- package/plugins/share.d.ts +4 -4
- package/plugins/share.js +1 -1
- package/plugins/speed.d.ts +4 -4
- package/plugins/speed.js +1 -1
- package/plugins/ssai.d.ts +4 -4
- package/plugins/ssai.js +2 -2
- package/plugins/subtitles.d.ts +4 -4
- package/plugins/subtitles.js +1 -1
- package/plugins/thumbnails.d.ts +4 -4
- package/plugins/thumbnails.js +1 -1
- package/plugins/tizen.d.ts +4 -4
- package/plugins/tizen.js +1 -1
- package/plugins/vtsel.d.ts +4 -4
- package/plugins/vtsel.js +1 -1
- package/plugins/webos.d.ts +4 -4
- package/plugins/webos.js +1 -1
- package/util/loader.d.ts +4 -4
package/plugins/id3.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BitrateInfo } from 'dashjs';
|
|
2
1
|
import type { Get } from 'type-fest';
|
|
3
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Representation } from 'dashjs';
|
|
4
4
|
import type { TupleToUnion } from 'type-fest';
|
|
5
5
|
|
|
6
6
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1538,7 +1538,7 @@ PROGRESS = "progress";
|
|
|
1538
1538
|
*/
|
|
1539
1539
|
declare type QselOption = (Level & {
|
|
1540
1540
|
level: number;
|
|
1541
|
-
}) |
|
|
1541
|
+
}) | Representation | {
|
|
1542
1542
|
name: string | number;
|
|
1543
1543
|
encodingId: string;
|
|
1544
1544
|
spatialLayerId: number;
|
|
@@ -1586,8 +1586,8 @@ QUALITY_CHANGE = "qualitychange";
|
|
|
1586
1586
|
* @public
|
|
1587
1587
|
*/
|
|
1588
1588
|
declare type QualityChangeEventDetail = {
|
|
1589
|
-
before?: Level |
|
|
1590
|
-
after?: Level |
|
|
1589
|
+
before?: Level | Representation;
|
|
1590
|
+
after?: Level | Representation;
|
|
1591
1591
|
plugin: string;
|
|
1592
1592
|
automatic: boolean;
|
|
1593
1593
|
/* Excluded from this release type: downscale */
|
package/plugins/id3.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.id3=n())}(this,
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.id3=n())}(this,function(){"use strict";var e,n=Object.freeze({__proto__:null,ID3:"ID3"});const t=((e=class ID3{init(e,n,t){t.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label||"com.apple.streaming"==e.inBandMetadataTrackDispatchType?function(e,n){n.mode="hidden",n.addEventListener("cuechange",async()=>{Array.from(n.activeCues||[]).forEach(async n=>{(function(e){return"object"==typeof e.value&&"string"==typeof e.value.key&&!!e.value.data})(n)&&e.emit("ID3",{cue:n})})})}(t,e):void 0})}}).pluginName="id3",e.events=n,e);return function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;if(null===document.currentScript)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;return"function"==typeof t?(t(n),n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n),n)}(window,t)});
|
package/plugins/iframe.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BitrateInfo } from 'dashjs';
|
|
2
1
|
import type { Get } from 'type-fest';
|
|
3
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Representation } from 'dashjs';
|
|
4
4
|
import type { TupleToUnion } from 'type-fest';
|
|
5
5
|
|
|
6
6
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1473,7 +1473,7 @@ PROGRESS = "progress";
|
|
|
1473
1473
|
*/
|
|
1474
1474
|
declare type QselOption = (Level & {
|
|
1475
1475
|
level: number;
|
|
1476
|
-
}) |
|
|
1476
|
+
}) | Representation | {
|
|
1477
1477
|
name: string | number;
|
|
1478
1478
|
encodingId: string;
|
|
1479
1479
|
spatialLayerId: number;
|
|
@@ -1521,8 +1521,8 @@ QUALITY_CHANGE = "qualitychange";
|
|
|
1521
1521
|
* @public
|
|
1522
1522
|
*/
|
|
1523
1523
|
declare type QualityChangeEventDetail = {
|
|
1524
|
-
before?: Level |
|
|
1525
|
-
after?: Level |
|
|
1524
|
+
before?: Level | Representation;
|
|
1525
|
+
after?: Level | Representation;
|
|
1526
1526
|
plugin: string;
|
|
1527
1527
|
automatic: boolean;
|
|
1528
1528
|
/* Excluded from this release type: downscale */
|
package/plugins/iframe.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.iframe=n())}(this,
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.iframe=n())}(this,function(){"use strict";var e;const n=((e=class Iframe{constructor(n,t){e.ATTACHED||(t.setState("is-iframe",!0),e.ATTACHED=!0,window.addEventListener("message",function(t){if(!e.is_flowplayer_message(t.data))return;const i=n.instances||[],o=i[0];if(!o)return;i.length>1&&console.warn("Multiple player instances in iframe. Messaging supported with first instance only.");switch(e.message_body(t.data)){case"pause":return o.togglePlay(!1);case"play":return o.togglePlay(!0)}}))}init(e,n,t){t.on("fullscreenenter",function(){document.fullscreenEnabled||"function"==typeof t.webkitEnterFullscreen&&(t.webkitEnterFullscreen(),t.once("webkitendfullscreen",function(){t.emit("fullscreenexit")}),t.on("ended",function(){t.webkitExitFullscreen()}))})}}).pluginName="iframe",e.FLOWPLAYER_RPC_PROTOCOL="flowplayer://",e.ATTACHED=!1,e.is_flowplayer_message=function(n){return"string"==typeof n&&n.startsWith(e.FLOWPLAYER_RPC_PROTOCOL)},e.message_body=function(n){return n.slice(e.FLOWPLAYER_RPC_PROTOCOL.length)},e);(function(){try{return window.self!==window.top}catch(e){return!0}})()&&function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;if(null===document.currentScript)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;"function"==typeof t?t(n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n))}(window,n);return n});
|
package/plugins/keyboard.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BitrateInfo } from 'dashjs';
|
|
2
1
|
import type { Get } from 'type-fest';
|
|
3
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Representation } from 'dashjs';
|
|
4
4
|
import type { TupleToUnion } from 'type-fest';
|
|
5
5
|
|
|
6
6
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1472,7 +1472,7 @@ PROGRESS = "progress";
|
|
|
1472
1472
|
*/
|
|
1473
1473
|
declare type QselOption = (Level & {
|
|
1474
1474
|
level: number;
|
|
1475
|
-
}) |
|
|
1475
|
+
}) | Representation | {
|
|
1476
1476
|
name: string | number;
|
|
1477
1477
|
encodingId: string;
|
|
1478
1478
|
spatialLayerId: number;
|
|
@@ -1520,8 +1520,8 @@ QUALITY_CHANGE = "qualitychange";
|
|
|
1520
1520
|
* @public
|
|
1521
1521
|
*/
|
|
1522
1522
|
declare type QualityChangeEventDetail = {
|
|
1523
|
-
before?: Level |
|
|
1524
|
-
after?: Level |
|
|
1523
|
+
before?: Level | Representation;
|
|
1524
|
+
after?: Level | Representation;
|
|
1525
1525
|
plugin: string;
|
|
1526
1526
|
automatic: boolean;
|
|
1527
1527
|
/* Excluded from this release type: downscale */
|
package/plugins/keyboard.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.keyboard=t())}(this,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.keyboard=t())}(this,function(){"use strict";function e(e,t,n){const o=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;o.length;){if(null==e)return n;const t=o.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}var t={TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",SPACE:" ",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",F:"f",H:"h",J:"j",K:"k",L:"l",M:"m"};const n="mousemove";function o(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector("details[open].fp-menu-container");n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}document.addEventListener("click",function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(o(),this.active_menu=void 0)});const r="is-kb-active";let i;function u(e){e.setState(r,!0),clearTimeout(i),i=setTimeout(function(){e.setState(r,!1)},2500)}function s(e,t){e.enqueueSeek(t)&&u(e)}const a="flowplayer-playlist-controls";const c="flowplayer-ad-ui";var l;const f=[t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT,t.ARROW_DOWN],d=[t.SPACE,t.F,t.ESCAPE,t.M,t.ARROW_UP,t.ARROW_DOWN,t.ARROW_RIGHT,t.ARROW_LEFT,t.H,t.J,t.K,t.L];function R(e,t){e.volume=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.volume+t,1,0),u(e)}function p(e){e.preventDefault(),e.stopPropagation()}function m(r){const i=r.key,u=A(),l=document.activeElement;if(!l)return;if(i===t.TAB)return function(){var e,t,o;const r=document.activeElement;if(!r)return;const i=null===(e=r.closest(".flowplayer"))||void 0===e?void 0:e.querySelector(".fp-engine");if(v().forEach(e=>{e.root.hasFocus=i===e,e.setState("is-accessibility",i===e)}),!i)return;if(i.root.dispatchEvent(new Event(n)),!function(e){var t,n;return!(!e.hasState("ad-paused")&&!e.hasState("ad-playing")||!(null===(n=null===(t=null==e?void 0:e.ads)||void 0===t?void 0:t.adapter)||void 0===n?void 0:n.isLinearAd()))}(i)||E(r,c))return;const u=i.root.querySelector(c);if(!u)return;if(i.hasState("ad-playing"))return null===(t=u.querySelector(".fp-small-pause"))||void 0===t?void 0:t.focus();if(i.hasState("ad-paused"))return null===(o=u.querySelector(".fp-small-play"))||void 0===o?void 0:o.focus()}();if((i===t.SPACE||i===t.ENTER)&&l.hasAttribute("tabindex")&&(E(l,".flowplayer")||E(l,a)))return null==l||l.dispatchEvent(new CustomEvent("click",{cancelable:!0,bubbles:!0})),p(r);if((i===t.ARROW_DOWN||i===t.ARROW_UP||i===t.ESCAPE)&&(E(l,".fp-menu-container")||E(l,a))){if(i===t.ARROW_DOWN&&l.nextSibling)return l.nextSibling.focus();if(i===t.ARROW_UP&&l.previousSibling)return l.previousSibling.focus();if(i===t.ESCAPE){const e=new CustomEvent("keyboard:close:menus",{cancelable:!0});if(null==u||u.dispatchEvent(e),e.defaultPrevented)return;return o()}}if(!u)return;let m=e(u,"opts.keyboard.seek_step",5);if(m<1&&(m=Math.round(m*u.duration)),~f.indexOf(i)&&l.hasAttribute("aria-valuenow")){const e=~[t.ARROW_UP,t.ARROW_RIGHT].indexOf(i);if(l.matches(".fp-volume"))return R(u,e?.15:-.15),p(r);if(l.matches(".fp-timeline"))return s(u,e?m:-1*m),p(r)}if(!1===function(e,t){return!(t.altKey||t.shiftKey||t.metaKey||t.ctrlKey)&&!!(e&&e.hasState("is-in-viewport")&&e.started)&&!!e.root&&void 0}(u,r))return;const y=!u.hasState("no-timeline");switch(~d.indexOf(i)&&r.preventDefault(),i){case t.SPACE:return u.togglePlay();case t.F:return u.toggleFullScreen();case t.ESCAPE:return u.hasState("is-fullscreen")?u.toggleFullScreen(!1):void 0;case t.M:return u.toggleMute();case t.ARROW_UP:case t.K:return R(u,.15);case t.ARROW_DOWN:case t.J:return R(u,-.15);case t.ARROW_RIGHT:case t.L:return y&&s(u,m);case t.ARROW_LEFT:case t.H:return y&&s(u,-1*m)}}function y(e){setTimeout(function(){e.defaultPrevented||m(e)},0)}function A(){return v().find(e=>function(e){let t=document.activeElement;for(;t;){if(t===e)return!0;t=t.parentElement}return!1}(e.root))||v().find(e=>document.activeElement===document.body&&e.root.hasFocus)}function v(){return Array.from(document.querySelectorAll(".fp-engine"))}function E(e,t){return!!function(e,t){return e.closest(t)}(e,t)}document.addEventListener("keydown",function(e){if(e.key===t.TAB)return y(e);const n=A();if(n)return function(e,n){const o=document.activeElement;if(e.key===t.F&&n.root.classList.contains("no-fullscreen"))return;if([t.SPACE,t.ARROW_DOWN,t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT].includes(e.key)||o&&E(o,".fp-menu-container")&&e.key===t.ENTER)return e.preventDefault(),m(e);y(e)}(e,n);const o=document.activeElement;[t.SPACE,t.ENTER,t.ARROW_DOWN,t.ARROW_UP,t.ARROW_RIGHT,t.ARROW_LEFT].includes(e.key)&&o&&E(o,a)&&(e.preventDefault(),m(e))}),document.addEventListener("mousedown",function(e){const t=e.composedPath();v().forEach(e=>{e.setState("is-accessibility",!1),e.root.hasFocus=t.includes(e.root)})});const h=((l=class Keyboard{init(e,t,o){o.once("beforeplay",()=>{o===A()&&o.hasState("is-accessibility")&&o.once("playing",()=>{if(o!==A()||!o.hasState("is-accessibility"))return;const e=o.root.querySelector(".fp-small-pause");e&&(o.root.dispatchEvent(new Event(n)),e.focus())})})}}).pluginName="keyboard",l);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,h)});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BitrateInfo } from 'dashjs';
|
|
2
1
|
import type { Get } from 'type-fest';
|
|
3
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Representation } from 'dashjs';
|
|
4
4
|
import type { TupleToUnion } from 'type-fest';
|
|
5
5
|
|
|
6
6
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1472,7 +1472,7 @@ PROGRESS = "progress";
|
|
|
1472
1472
|
*/
|
|
1473
1473
|
declare type QselOption = (Level & {
|
|
1474
1474
|
level: number;
|
|
1475
|
-
}) |
|
|
1475
|
+
}) | Representation | {
|
|
1476
1476
|
name: string | number;
|
|
1477
1477
|
encodingId: string;
|
|
1478
1478
|
spatialLayerId: number;
|
|
@@ -1520,8 +1520,8 @@ QUALITY_CHANGE = "qualitychange";
|
|
|
1520
1520
|
* @public
|
|
1521
1521
|
*/
|
|
1522
1522
|
declare type QualityChangeEventDetail = {
|
|
1523
|
-
before?: Level |
|
|
1524
|
-
after?: Level |
|
|
1523
|
+
before?: Level | Representation;
|
|
1524
|
+
after?: Level | Representation;
|
|
1525
1525
|
plugin: string;
|
|
1526
1526
|
automatic: boolean;
|
|
1527
1527
|
/* Excluded from this release type: downscale */
|
package/plugins/media-session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.media_session=t())}(this,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.media_session=t())}(this,function(){"use strict";const e="is-kb-active";let t;function n(n,i){n.enqueueSeek(i)&&function(n){n.setState(e,!0),clearTimeout(t),t=setTimeout(function(){n.setState(e,!1)},2500)}(n)}const i="seekbackward",o="seekforward",a="seekto",s="pause",l="playing",r="seeked",c="playlist:next",u="is-playing",d="no-timeline";var f;let p;function y(e){e.data&&m(e.data)}function m(e){var t,n,i;const o=null!==(t=e.media_session)&&void 0!==t?t:{};if(null!==(n=o.title)&&void 0!==n||(o.title=e.title),null==o.artwork){const t=null!==(i=e.poster)&&void 0!==i?i:"";o.artwork=[{src:t,sizes:"512x512"},{src:t,sizes:"256x256"}]}navigator.mediaSession.metadata=new MediaMetadata(o)}function k(){const e=navigator.mediaSession;if(null==e.setPositionState)return;const t=p;t&&(e.setPositionState({duration:Math.round(t.duration||0),playbackRate:t.hasState(u)?t.playbackRate:.001,position:Math.round(t.currentTime)}),e.playbackState=t.hasState(u)?"playing":"paused")}function g(e){const t=p,s=navigator.mediaSession;if(t){if(s.setActionHandler("play",function(){t.togglePlay()}),s.setActionHandler("pause",function(){t.togglePlay()}),"playlist"in t){const e=t.playlist;s.setActionHandler("nexttrack",function(){e&&e.next()}),s.setActionHandler("previoustrack",function(){e&&e.prev()})}!function(e,t){var s,l;const r=null===(s=t.seekable)||void 0===s||s;if(!r||e.hasState(d))return;const c=navigator.mediaSession,u=null!==(l=t.seek_step)&&void 0!==l?l:5;e.disabled||c.setActionHandler(o,function(){n(e,u)});c.setActionHandler(i,function(){n(e,-u)});try{c.setActionHandler(a,function(t){"number"==typeof t.seekTime&&(t.seekTime>e.currentTime&&e.disabled?k():t&&t.seekTime<e.duration&&(e.currentTime=t.seekTime))})}catch(e){}}(t,e)}}const v=((f=class MediaSession{init(e,t,n){null!=navigator.mediaSession&&n.on(["loadstart",l,"fullscreenenter"],function(){let t=p;n!==t&&(t&&(["ratechange",r,l,s].forEach(e=>{t&&t.off(e,k)}),t.off(c,y),t=void 0),p=n,m(e),g(e),k(),n.on(["ratechange",r,l,s],k),n.on(c,y))})}}).pluginName="media-session",f);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,v)});
|
package/plugins/message.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BitrateInfo } from 'dashjs';
|
|
2
1
|
import type { Get } from 'type-fest';
|
|
3
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Representation } from 'dashjs';
|
|
4
4
|
import type { TupleToUnion } from 'type-fest';
|
|
5
5
|
|
|
6
6
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1526,7 +1526,7 @@ PROGRESS = "progress";
|
|
|
1526
1526
|
*/
|
|
1527
1527
|
declare type QselOption = (Level & {
|
|
1528
1528
|
level: number;
|
|
1529
|
-
}) |
|
|
1529
|
+
}) | Representation | {
|
|
1530
1530
|
name: string | number;
|
|
1531
1531
|
encodingId: string;
|
|
1532
1532
|
spatialLayerId: number;
|
|
@@ -1574,8 +1574,8 @@ QUALITY_CHANGE = "qualitychange";
|
|
|
1574
1574
|
* @public
|
|
1575
1575
|
*/
|
|
1576
1576
|
declare type QualityChangeEventDetail = {
|
|
1577
|
-
before?: Level |
|
|
1578
|
-
after?: Level |
|
|
1577
|
+
before?: Level | Representation;
|
|
1578
|
+
after?: Level | Representation;
|
|
1579
1579
|
plugin: string;
|
|
1580
1580
|
automatic: boolean;
|
|
1581
1581
|
/* Excluded from this release type: downscale */
|
package/plugins/message.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
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.message=t())}(this,function(){"use strict";const e="message:show",t="message:dismiss";var n,s=Object.freeze({__proto__:null,SHOW_MESSAGE:e,DISMISS_MESSAGE:t});const o=/<trans(.*)trans>/,i=((n=class Message{init(s,i,a){let f="";a.on(e,function(e){var n,s,l;const r=null===(n=e.data)||void 0===n?void 0:n.sticky,u=null===(s=e.data)||void 0===s?void 0:s.timeout;let d=(null===(l=e.data)||void 0===l?void 0:l.message)||"";if(d==f)return;if(f=d||"",o.test(d)){const e=o.exec(d)||["",""];d=a.i18n(e[1].trim())}const c=document.createElement("div");c.classList.add("fp-message");const p=document.createElement("p");p.innerText=d,c.append(p),i.append(c),setTimeout(function(){c.classList.add("fp-shown")},100),r||setTimeout(function(){a.emit(t,c)},u)}),a.on(t,function(e){f="";const t=e.data;t&&(t.classList.remove("fp-shown"),setTimeout(function(){t.remove()},1e3))}),a.message={events:n.events}}}).pluginName="message",n.events=s,n);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,i)});
|
package/plugins/ovp.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BitrateInfo } from 'dashjs';
|
|
2
1
|
import type { Get } from 'type-fest';
|
|
3
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Representation } from 'dashjs';
|
|
4
4
|
import type { TupleToUnion } from 'type-fest';
|
|
5
5
|
|
|
6
6
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -918,8 +918,12 @@ LIVE = "live";
|
|
|
918
918
|
|
|
919
919
|
declare const LIVE_2 = "is-live";
|
|
920
920
|
|
|
921
|
+
declare const LIVE_COUNTDOWN_TICK = "ovp:live:countdown:tick";
|
|
922
|
+
|
|
921
923
|
declare const LIVE_SEEKED = "is-live-seeked";
|
|
922
924
|
|
|
925
|
+
/* Excluded from this release type: LiveCountdownEventDetail */
|
|
926
|
+
|
|
923
927
|
/**
|
|
924
928
|
* @public
|
|
925
929
|
*/
|
|
@@ -1115,6 +1119,8 @@ declare type OVPMetadata = {
|
|
|
1115
1119
|
export declare type OVPPlayer = PlayerWith<{
|
|
1116
1120
|
on(event: EndscreenEvents["RECOMMENDATIONS_READY"], handler: (e: RecommendationsReadyEvent) => void): Player;
|
|
1117
1121
|
/* Excluded from this release type: on */
|
|
1122
|
+
/* Excluded from this release type: emit */
|
|
1123
|
+
/* Excluded from this release type: on */
|
|
1118
1124
|
}>;
|
|
1119
1125
|
|
|
1120
1126
|
/**
|
|
@@ -1513,7 +1519,7 @@ PROGRESS = "progress";
|
|
|
1513
1519
|
*/
|
|
1514
1520
|
declare type QselOption = (Level & {
|
|
1515
1521
|
level: number;
|
|
1516
|
-
}) |
|
|
1522
|
+
}) | Representation | {
|
|
1517
1523
|
name: string | number;
|
|
1518
1524
|
encodingId: string;
|
|
1519
1525
|
spatialLayerId: number;
|
|
@@ -1561,8 +1567,8 @@ QUALITY_CHANGE = "qualitychange";
|
|
|
1561
1567
|
* @public
|
|
1562
1568
|
*/
|
|
1563
1569
|
declare type QualityChangeEventDetail = {
|
|
1564
|
-
before?: Level |
|
|
1565
|
-
after?: Level |
|
|
1570
|
+
before?: Level | Representation;
|
|
1571
|
+
after?: Level | Representation;
|
|
1566
1572
|
plugin: string;
|
|
1567
1573
|
automatic: boolean;
|
|
1568
1574
|
/* Excluded from this release type: downscale */
|
package/plugins/ovp.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.ovp=t())}(this,(function(){"use strict";function e(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}const t=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),o=(...e)=>e.reduce((e,n)=>t(n)?(Object.keys(n).forEach(r=>{if(t(e[r])&&t(n[r]))return e[r]=o(e[r],n[r]);e[r]=n[r]}),e):e,{});class Pipe{static of(e){return new Pipe(e)}static maybe(e,t,...o){return null==e?e:t.apply(e,[e,...o])}constructor(e){this.data=e}tap(e,...t){return e.apply(this,[this.data,...t]),new Pipe(this.data)}fmap(e,...t){const o=e.apply(this,[this.data,...t]);return new Pipe(o)}unwrap(){return this.data}}const n=window,r=n._flowplayerTimekeeper||(n._flowplayerTimekeeper={});function a(e){return fetch(e).then(e=>e.json())}function i(...e){let t=[].join.call(e,"/");return"/"!==t[0]&&(t="/"+t),s()+"/web/public/native/config"+t}const s=()=>"https://ljsp.lwcdn.com";function c(e){(async function(){const e=r.cachedServerOffset;if(e)return e;const t=r.pendingRequest||(r.pendingRequest=fetch("https://ljsp.lwcdn.com/web/public/countdown/time.json")),o=await t,n=parseInt(o.headers.get("age")||"0"),a=await o.json(),i=Date.now()-a.millisUtc-1e3*n;return r.cachedServerOffset=i,r.cachedServerOffset})().then(t=>Object.assign(e,{server_time_offset:t}))}function l(e,t){var n,r;t="object"==typeof t?t:{};const a={title:null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.title,description:null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.description},i={ima:{parameters:function({media_id:e,duration:t,title:o,tags:n,category_name:r,ad_keywords:a}){return{ad_keywords:a||"",media_id:e||"",category:r||"",media_name:o||"",media_tags:n||"",media_duration:t||-1}}((null==e?void 0:e.metadata)||{})}},s=t.embed||{};return delete s.src,o(i,a,e,(delete(c=t).src,delete c.metadata,delete c.title,delete c.description,delete c.duration,delete c.poster,c),s);var c}const d=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,p=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,u=/^[A-Za-z0-9]{8}$/,m=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[A-Za-z0-9]{8}$/;function f(e){return"object"==typeof e&&"ovp/base64"==e.type}function y(e,t){return function(e,t){return!(!d.test(e)&&!p.test(e))&&(t.type="video/ovp",!0)}(e,t)||function(e,t){return!(!u.test(e)&&!m.test(e))&&(t&&(t.type="video/ovp"),!0)}(e,t)||f(t)}function v(e){try{return function(e){return null===e?{}:JSON.parse(e)}(decodeURIComponent(atob(e).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(e){return{err:e.message}}}function w(e){const t=e.split(/[^0-9]/).map(e=>parseInt(e,10));return Date.UTC(t[0],t[1]-1,t[2],t[3],t[4],t[5])}function h(e){return e.live}var k=Object.freeze({__proto__:null,OVP_ERROR:"ovp:error",OVP_MEDIA_REQUEST_START:"ovp:request:start",OVP_MEDIA_REQUEST_COMPLETE:"ovp:request:media:complete",OVP_PLAYLIST_REQUEST_COMPLETE:"ovp:request:playlist:complete",LIVE_COUNTDOWN_TICK:"ovp:live:countdown:tick",LIVE_COUNTDOWN_START:"ovp:live:countdown:start",LIVE_COUNTDOWN_COMPLETE:"ovp:live:countdown:complete",OVP_MEDIA_CHANGED:"ovp:media:changed",OVP_REALTIME_MESSAGE:"ovp:message:realtime",OVP_CONFIG_FINALIZED:"ovp:config:finalized"});const b={Unknown:"00-00",MediaUnknown:"01-00",MediaUnavailable:"01-01",MediaUnsupportedVideoFormat:"01-02",MediaUnsupportedAudioFormat:"01-03",MediaBitrateExceeded:"01-04",MediaBufferOverread:"01-05",MediaIntegerOverflow:"01-06",MediaQuotaExceeded:"01-07",MediaInvalidCompositionDuration:"01-08",MediaInvalidCompositionSourceDuration:"01-09",MediaInvalidCompositionSourceStartTime:"01-10",MediaMalformedDepth:"01-11",PlaybackUnknown:"02-00",PlaybackVideoBufferUnderRun:"02-01",PlaybackAudioBufferUnderRun:"02-02",PlaybackVideoBufferingTimeout:"02-03",PlaybackAudioBufferingTimeout:"02-04",PlaybackManifestParseError:"02-05",PlaybackVideoDecodeError:"02-06",PlaybackAudioDecodeError:"02-07",PlaybackDroppedFramesExceeded:"02-08",PlaybackPlayheadExceedsDuration:"02-09",PlaybackUnsupportedDevice:"02-10",PlaybackManifestLoadError:"02-11",PlaybackManifestLoadTimeout:"02-12",PlaybackManifestParsingError:"02-13",PlaybackManifestIncompatibleCodecs:"02-14",PlaybackLevelEmptyError:"02-15",PlaybackLevelLoadError:"02-16",PlaybackLevelLoadTimeout:"02-17",PlaybackLevelSwitchError:"02-18",PlaybackAudioTrackLoadError:"02-19",PlaybackAudioTrackLoadTimeout:"02-20",PlaybackFragLoadError:"02-21",PlaybackFragLoadTimeout:"02-22",PlaybackFragDecryptError:"02-23",PlaybackFragParsingError:"02-24",PlaybackFragGap:"02-25",PlaybackRemuxAllocError:"02-26",PlaybackBufferAddCodecError:"02-27",PlaybackBufferIncompatibleCodecs:"02-28",PlaybackBufferAppendError:"02-29",PlaybackBufferStalledError:"02-30",PlaybackBufferFullError:"02-31",PlaybackBufferSeekOverHole:"02-32",PlaybackBufferNudgeOnStall:"02-33",PlaybackInternalException:"02-34",PlaybackInternalAborted:"02-35",PlaybackManifestLoaderFailure:"02-36",PlaybackSegmentBaseLoaderError:"02-37",PlaybackTimeSyncFailed:"02-38",PlaybackFragmentLoaderFailure:"02-39",PlaybackAppendError:"02-40",PlaybackRemoveError:"02-41",PlaybackDataUpdateFailed:"02-42",PlaybackManifestNoStreams:"02-43",PlaybackUnknownManifestType:"02-44",PlaybackDashInsufficientSegmentInfo:"02-45",PlaybackDashNoRepresentations:"02-46",PlaybackDashNoAdaptationSets:"02-47",PlaybackDashNoInitSegment:"02-48",PlaybackDashUnsupportedContainerFormat:"02-49",PlaybackDashKeySystemMismatch:"02-50",PlaybackMultipleKeyIDs:"02-51",PlaybackDashConflictingKeyIDs:"02-52",PlaybackRestrictedStreams:"02-53",PlaybackHlsMasterAndMediaTags:"02-54",PlaybackRepresentationIdConflict:"02-55",PlaybackHlsUnsupportedKeyFormats:"02-56",PlaybackManifestNoVariants:"02-57",PlaybackHlsUndeclaredVariables:"02-58",PlaybackAes128InvalidKeyLength:"02-59",PlaybackDashConflictingAes128Keys:"02-60",PlaybackDashUnsupportedAes128Encryption:"02-61",PlaybackManifestPatchMismatch:"02-62",PlaybackEmptyMediaPlaylist:"02-63",PlaybackNonContiguousCompositionTrack:"02-64",PlaybackDecoderNotFound:"02-65",PlaybackDecoderTemporarilyUnavailable:"02-66",PlaybackIncompatibleAsset:"02-67",PlaybackNoCompatibleExternalDisplay:"02-69",PlaybackOutOfMemory:"02-70",PlaybackToneMappingFailed:"02-71",PlaybackVideoCompositorFailed:"02-72",NetworkUnknown:"03-00",NetworkNoInternet:"03-01",NetworkRequestTimeout:"03-02",NetworkUnableToResolveHost:"03-03",NetworkResourceNotFound:"03-04",NetworkExpiredUrl:"03-05",NetworkUrlResolutionFailed:"03-06",NetworkDownloadErrorIdManifest:"03-07",NetworkDownloadErrorIdSidx:"03-08",NetworkDownloadErrorIdContent:"03-09",NetworkDownloadErrorIdInitialization:"03-10",NetworkDownloadErrorIdXlink:"03-11",NetworkHttpRequestFailed:"03-12",NetworkMaxRetriesExceeded:"03-13",NetworkSegmentMissing:"03-14",NetworkHttp400BadRequest:"03-400",NetworkHttp401Unauthorized:"03-401",NetworkHttp402PaymentRequired:"03-402",NetworkHttp403Forbidden:"03-403",NetworkHttp404NotFound:"03-404",NetworkHttp405MethodNotAllowed:"03-405",NetworkHttp406NotAcceptable:"03-406",NetworkHttp407ProxyAuthenticationRequired:"03-407",NetworkHttp408RequestTimeout:"03-408",NetworkHttp409Conflict:"03-409",NetworkHttp410Gone:"03-410",NetworkHttp411LengthRequired:"03-411",NetworkHttp412PreconditionFailed:"03-412",NetworkHttp413PayloadTooLarge:"03-413",NetworkHttp414URITooLong:"03-414",NetworkHttp415UnsupportedMediaType:"03-415",NetworkHttp416RangeNotSatisfiable:"03-416",NetworkHttp417ExpectationFailed:"03-417",NetworkHttp418ImATeapot:"03-418",NetworkHttp421MisdirectedRequest:"03-421",NetworkHttp422UnprocessableEntity:"03-422",NetworkHttp423Locked:"03-423",NetworkHttp424FailedDependency:"03-424",NetworkHttp425TooEarly:"03-425",NetworkHttp426UpgradeRequired:"03-426",NetworkHttp428PreconditionRequired:"03-428",NetworkHttp429TooManyRequests:"03-429",NetworkHttp431RequestHeaderFieldsTooLarge:"03-431",NetworkHttp451UnavailableForLegalReasons:"03-451",NetworkHttp500InternalServerError:"03-500",NetworkHttp501NotImplemented:"03-501",NetworkHttp502BadGateway:"03-502",NetworkHttp503ServiceUnavailable:"03-503",NetworkHttp504GatewayTimeout:"03-504",NetworkHttp505HTTPVersionNotSupported:"03-505",NetworkHttp506VariantAlsoNegotiates:"03-506",NetworkHttp507InsufficientStorage:"03-507",NetworkHttp508LoopDetected:"03-508",NetworkHttp510NotExtended:"03-510",NetworkHttp511NetworkAuthenticationRequired:"03-511",ContentProtectionUnknown:"04-00",ContentProtectionConcurrentStreamLimitExceeded:"04-01",ContentProtectionEntitlementRefused:"04-02",ContentProtectionLicenseExpired:"04-03",ContentProtectionBadLicenseRequest:"04-04",ContentProtectionLicenseServerTimeout:"04-05",ContentProtectionInsufficientHDCPSupport:"04-06",ContentProtectionGeoRestricted:"04-07",ContentProtectionParentalControlRestricted:"04-08",ContentProtectionCDNUnauthorized:"04-09",ContentProtectionInvalidAccessToken:"04-10",ContentProtectionKeySystemNoKeys:"04-11",ContentProtectionKeySystemNoAccess:"04-12",ContentProtectionKeySystemNoSession:"04-13",ContentProtectionKeySystemNoConfiguredLicense:"04-14",ContentProtectionKeySystemCertificateRequestFailed:"04-15",ContentProtectionKeySystemCertificateUpdateFailed:"04-16",ContentProtectionKeySystemSessionUpdateFailed:"04-17",ContentProtectionKeySystemStatusOutputRestricted:"04-18",ContentProtectionKeySystemStatusInternalError:"04-19",ContentProtectionKeyLoadError:"04-20",ContentProtectionKeyLoadTimeout:"04-21",ContentProtectionCapabilityMediaKeysError:"04-22",ContentProtectionManifestKeySystemUnknown:"04-23",ContentProtectionKeySystemUnavailable:"04-24",ContentProtectionCDMCreationFailed:"04-25",ContentProtectionCDMAttachFailed:"04-26",ContentProtectionCDMServerCertificateRejected:"04-27",ContentProtectionCDMSessionCreationFailed:"04-28",ContentProtectionCDMLicenseRequestFailed:"04-29",ContentProtectionCDMLicenseResponseRejected:"04-30",ContentProtectionManifestMissingDRMInfo:"04-31",ContentProtectionLicenseServerMissing:"04-32",ContentProtectionOfflineSessionRemoved:"04-33",ContentProtectionInitDataTransformationError:"04-34",ContentProtectionServerCertificateRequestFailed:"04-35",ContentProtectionInsufficientHDCPVersion:"04-36",ContentProtectionHDCPVersionCheckFailed:"04-37",AdsUnknown:"08-00",AdsVastParseError:"08-100",AdsInvalidVastSchema:"08-101",AdsVastVersionNotSupported:"08-102",AdsUnexpectedAdType:"08-200",AdsCreativeLinearityMismatch:"08-201",AdsCreativeDurationMismatch:"08-202",AdsCreativeSizeMismatch:"08-203",AdsWrapperVastError:"08-300",AdsVastResponseRedirectTimeout:"08-301",AdsWrapperLimitReached:"08-302",AdsVastResponseEmpty:"08-303",AdsLinearAdDisplayError:"08-400",AdsMediaFileNotFound:"08-401",AdsMediaFileUnavailable:"08-402",AdsUnsupportedMimeType:"08-403",AdsUnableToDisplayMediaFile:"08-405",AdsMezzanineFileMissing:"08-406",AdsMezzanineFileDownloaded:"08-407",AdsRejectedAd:"08-408",AdsInteractiveCreativeError:"08-409",AdsVerificationNodeExecutionError:"08-410",AdsNonLinearAdDisplayError:"08-500",AdsNonLinearAdSizeMismatch:"08-501",AdsNonLinearAdFetchError:"08-502",AdsNonLinearUnsupportedType:"08-503",AdsCompanionAdDisplayError:"08-600",AdsCompanionAdSizeMismatch:"08-601",AdsRequiredCompanionAdError:"08-602",AdsCompanionAdFetchError:"08-603",AdsUndefinedVastError:"08-900",AdsUnknownVpaidError:"08-901",AdsVastDocumentEmpty:"08-999"},P=Object.fromEntries(Object.entries(b).map(([e,t])=>[t,e]));const g=[1e7]+""+-1e3+-4e3+-8e3+-1e11,E="off";class FlowplayerError extends Error{static getErrorKey(e){return e in P?P[e]:P["00-00"]}constructor(e,t,o={}){super(e),this.message=e,this.flowplayerErrorCode=t,this.config=o,this.id="undefined"==typeof crypto?"":g.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)),this.isFatal=!!o.isFatal,this.errorKey=FlowplayerError.getErrorKey(this.flowplayerErrorCode)||"unknown"}toJSON(){return{message:this.message,flowplayer_error_code:this.flowplayerErrorCode,id:this.id,root_error_id:this.config.rootErrorId,resource:this.config.resource,is_fatal:this.isFatal,is_retry:!!this.config.isRetry}}}function C(e,t){const o=null==t?void 0:t.src;if(f(t))return function(e,t){const o=v(t.src||"");if(function(e){return"string"==typeof e.err}(o))return console.error(o.err);A(e,o)}(e,t);if(!o)return;e.setState("is-source-processing",!0);const n=i(function(e){return~e.indexOf("/")?e:"/media/"+e}(o));fetch(n).then(async t=>t.ok?A(e,await t.json()):function(e,t,o,n){e.setState("is-source-processing",!1);const r=new FlowplayerError(n.message||"error loading ovp source",function(e){const t="03-"+e;return t in P?t:b.NetworkUnknown}(o),{resource:t,isFatal:!0,retryOpts:{retry:E}});e.emit("flowplayer:error",{error:r})}(e,t.url,t.status,await t.json()))}function A(e,t){return e.emit("ovp:media:changed",t),function(e){return Array.isArray(e.playlist)}(t)?function(e,t){e.emit("ovp:request:playlist:complete",function(e,t){"number"!=typeof t.delay&&"number"!=typeof e.delay&&(t.delay=5);const n=Object.assign({},e),r=(null==e?void 0:e.playlist)||{},a=o(t,r),i=((null==a?void 0:a.playlist)||[]).map(e=>{t.ima&&Object.assign(e,{ima:t.ima});const o=l(e,n);return delete o.playlist,o});return delete a.ima,Object.assign(a,{playlist:i})}(e.opts,t))}(e,t):h(t)?function(e,t){var o,n;const r=(null===(o=null==t?void 0:t.metadata)||void 0===o?void 0:o.live_start_time)||(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.starttime);r&&(t.live_start_time=Pipe.of(r).fmap(w).unwrap());e.emit("ovp:live:countdown:start",Pipe.of(t).fmap(l,e.opts).unwrap())}(e,t):function(e,t){e.emit("ovp:request:media:complete",Pipe.of(t).fmap(l,e.opts).unwrap())}(e,t)}const N={};function _(e,t,o){"object"!=typeof N[t]&&(N[t]=o);const n=e.opts,r=(null==n?void 0:n.metadata)||{};r.player_id=t,n.metadata=r,o.title&&delete o.title,o.description&&delete o.description;const a=Object.assign(n,o);e.setOpts(a),o.autoplay&&e.togglePlay(!0)}let M=!1;function S(e,t,o){O()||Pipe.of("recommendation").fmap(i,t,o).fmap(a).fmap(t=>t.then(t=>function(e,t){const o=t.playlist;if(e.opts.recommendations=o,!o.length)return;e.emit("recommendationsready",{playlist:o.map((function(e){var t,o;return{poster:e.poster,src:e.src,title:null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.title,description:null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.description,metadata:e.metadata||{},chapters:e.chapters,thumbnails:e.thumbnails,subtitles:e.subtitles}}))})}(e,t)).catch(D))}function O(){return M}function D(e){M=!0,console.error("Failed to load recommendations: %j",e)}function L(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}function T(e,t){const o=e._customElements.get(t);return o&&e.root.querySelector(o)||void 0}const F="flowplayer-live-countdown";function R(e){const t=Date.now()-(e.server_time_offset||0);return Math.floor(((e.live_start_time||0)-t)/1e3)}function I(e,t){let o=0;function n(){const n=R(t);if(n<0||isNaN(n)||0===e.reaper||void 0===t.live_start_time)return clearInterval(o),function(e,t,o){e.emit("ovp:live:countdown:complete");const n=T(e,F);if(n&&n.remove(),e.root.classList.remove("is-livecountdown"),o)return e.setState("is-source-processing",!1);e.emit("ovp:request:media:complete",t)}(e,t,void 0===t.live_start_time);var r,a,i;r=e,a=e.root,i=n,a.classList.add("is-livecountdown"),r.emit("ovp:live:countdown:tick",{remaining_time:H(i+1)}),r.hasState("is-starting")||r.setState("is-starting",!0)}c(t),n(),o=setInterval(n,250)}function H(e){const t=function(e){"number"!=typeof e&&(e=parseInt(e,10)),e=Math.round(e);const t=Math.floor(e/86400);e-=86400*t;const o=Math.floor(e/3600);e-=3600*o;const n=Math.floor(e/60);return{days:t,hours:o,minutes:n,seconds:e-=60*n}}(e);let o="";return t.days&&(o+=t.days+":"),o+L(t.hours)+":"+L(t.minutes)+":"+L(t.seconds)}class WebsocketBridge{static of(e){return new WebsocketBridge(e)}constructor(e){this.manualDisconnect=!1,this.video=e,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}connect(e){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+e),this.current_media_id=e,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(e){JSON.parse(e.data).forEach(e=>{this.video.emit("ovp:message:realtime",e)})}reconnect(e){this.cleanup(),this.connect(e)}wireup(){this.client&&(this.client.addEventListener("message",this.onMessage),this.client.addEventListener("close",this.onClose))}cleanup(){this.client&&(this.client.removeEventListener("message",this.onMessage),this.client.removeEventListener("close",this.onClose),this.client=void 0)}disconnect(){this.client&&(this.manualDisconnect=!0,this.client.close())}}const U=(e,t)=>new(((e,t)=>{const o=e.get(t);if(!o)throw new Error(`no flowplayer component with the name ${t} exists`);const n=window.customElements.get(t);if(!n)throw new Error(`no default flowplayer component with the name ${t} exists`);const r=window.customElements.get(o);return"function"!=typeof r?n:r})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class FlowplayerLiveCountdown extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-livecountdown");const t=function(...e){const t=document.createElement("div");return 0==e.length||t.classList.add(...e),t}("fp-inner");this.append(t);const o=document.createElement("p");o.innerText=e.i18n("ovp.starting_in"),t.append(o);const n=document.createElement("p");n.classList.add("fp-countdown"),t.append(n),e.on("ovp:live:countdown:tick",t=>{const o=t.detail.remaining_time;e.root.classList.add("is-livecountdown"),n.innerText=o})}}const j=["*.lwcdn.com","*.flowplayer.com","*.wowza.com"];function x(){try{return window.location.hostname!==window.parent.location.hostname?function(e){const t=document.createElement("a");return t.href=e,t}(document.referrer).hostname:document.location.hostname}catch(e){return window.location.hostname}}function V(e){const t=document.createElement("a");t.href=e;const o=t.pathname&&t.pathname.split(".");return o.length>1&&o[o.length-1]}function q(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const K=t=>{var{src:o}=t,n=e(t,["src"]);return[Object.assign({src:o,type:o?q("video/"+V(o)):""},n)]};function B(e){return K({src:e})}function z(t){var{src:o,type:n}=t,r=e(t,["src","type"]);return o&&n?[Object.assign({src:o,type:n},r)]:n&&!o?[Object.assign({type:n},r)]:K(Object.assign({src:o},r))}var W,G;!function(e){e[e.Err=0]="Err",e[e.Ok=1]="Ok"}(W||(W={}));const $=((G=class OVP{constructor(e){((e,t,o)=>{window.customElements.get(t)||window.customElements.define(t,o),e.customElements.get(t)||e.customElements.set(t,t)})(e,F,FlowplayerLiveCountdown)}onload(e,t,o,n){if("string"==typeof(null==n?void 0:n.src))return"string"!=typeof e.player_id||0===n.src.indexOf(e.player_id)||f(n)||(n.src=[e.player_id,n.src].join("/")),C(o,n)}wants(e,t,o){return y(e,t)}init(t,n,r){const s=new WebsocketBridge(r);let c=Object.assign({},t);const l=function(e){if(!c)return e;t.autoplay!==c.autoplay&&(c.autoplay=t.autoplay),delete c.src;const n=o(e,c);return r.emit("ovp:config:finalized",n),n};r.on("src",()=>{(r.currentSrc||r.root.classList.contains("is-livecountdown"))&&(c=!1)}),r.on("ovp:request:start",(function(){r.setState("is-waiting",!0),t.recommendations&&(t.recommendations=!1)})),r.on("ovp:media:changed",(function({data:e}){var t;const o=null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.media_id;(null==e?void 0:e.live)&&o&&(s.disconnect(),s.connect(o))})),r.on("ovp:message:realtime",(function({data:e}){var o;const n=null==e?void 0:e.event,a=null==e?void 0:e.value,i=r.opt("metadata",{live_start_time:""});switch(n){case"METADATA":{const e=Object.assign(i,a),n=Object.assign(t,{metadata:e});n.live&&(null===(o=null==n?void 0:n.metadata)||void 0===o?void 0:o.live_start_time)&&(n.live_start_time=w(n.metadata.live_start_time)),r.setOpts(n);break}}})),r.on("beforeplay",(function(e){const o=t;if(h(o)){if(Q(o))return;e.preventDefault()}})),r.on("ovp:request:media:complete",(function(e){const t=e.data;if(!t)return;var o;if(t.src&&(t.src=(o=t.src,"string"==typeof o?B(o):Array.isArray(o)||"object"!=typeof o?o.reduce((function(e,t){return"string"==typeof t&&(t=B(t)),"object"!=typeof t||Array.isArray(t)||(t=z(t)),e.concat(t)}),[]):z(o)).map(e=>(e.src&&e.src.startsWith("//")&&(e.src="https:"+e.src),e))),0==r.reaper||"object"!=typeof t||R(t)>0)return;const n=l(t);r.setOpts(n),r.setAttrs(n),n.src&&r.setSrc(n.src),r.setState("is-source-processing",!1)})),r.on("config",(function({data:e}){var o,s;if("string"==typeof t.src&&y(t.src,{}))return;if((null==e?void 0:e.domains)&&(null==e?void 0:e.domains.length)&&!((e,t)=>{const o=e.split(".").reverse();return t.concat(j).some(e=>{const t=e.split(".").reverse(),n="*"===t[t.length-1];return n&&t.pop(),(n||t.length===o.length)&&t.every((e,t)=>o[t]===e)})})(x(),e.domains))return function({root:e,video:t,data:o}){t&&t.destroy(),console.error(new Error(o.details||o.reason)),e.innerHTML="",e.classList.remove("flowplayer"),e.classList.add("flowplayer-fatal"),e.style.removeProperty("background-image");const n=document.createElement("h2");n.textContent="Playback Error";const r=document.createElement("p");r.textContent="Are you the site owner?";const a=document.createElement("a");a.classList.add("troubleshoot"),a.target="_blank",a.href="https://docs.flowplayer.com/troubleshooting/player#"+o.reason,a.textContent="Troubleshoot?";const i=document.createElement("img");i.src="https://flowplayer.com/user/pages/images/logo-white.png",e.append(n,r,a,i)}({root:n,video:r,data:{details:`Hostname ${x()} is not allowed to load player ${null===(o=e.metadata)||void 0===o?void 0:o.player_id}.`,reason:"domain"}});if(t.src&&J(t.src))return;const c=null==e?void 0:e.brand_color;return c&&r.root.style.setProperty("--fp-brand-color","#"==c[0]?c:"#"+c),"string"==typeof t.player_id&&(null===(s=null==t?void 0:t.metadata)||void 0===s?void 0:s.player_id)!==t.player_id?function(e,t){if("object"==typeof N[t])return console.debug("using Cache(%s)",t),_(e,t,N[t]);Pipe.of(t).fmap(i).fmap(a).fmap(o=>o.then(o=>_(e,t,o)).catch(console.error))}(r,t.player_id):void 0})),r.on("ovp:request:playlist:complete",(function(t){var o;const n=t.data;if(!n||0==r.reaper)return;const{playlist:a}=n,i=e(n,["playlist"]),s=l(Object.assign(i,{playlist:Object.assign({},i)}));Array.isArray(s.playlist)&&(s.playlist=i),delete s.loop,s.playlist.playlist_title||(s.playlist.playlist_title=null===(o=i.metadata)||void 0===o?void 0:o.playlist_title),r.setOpts(s),r.setAttrs(s);const c={type:"flowplayer/playlist",items:a};r.setSrc(c),r.setState("is-source-processing",!1)})),r.on("ovp:live:countdown:start",(function(e){const o=e.data;if(!o||0==r.reaper)return;const a=l(o);if(r.setOpts(a),r.setAttrs(a),R(o)<=0)return r.emit("ovp:request:media:complete",o);T(r,F)||(n.appendChild(U(r,F)),I(r,t))})),r.on("timeupdate",(function(){var e,o,n;const a=t;h(a)?Q(a)||(r.togglePlay(!1),r.emit("ended")):t.recommendations&&(null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id)&&(Array.isArray(t.recommendations)||r.currentTime/r.duration<.8||O()||(null===(o=null==t?void 0:t.metadata)||void 0===o?void 0:o.media_id)&&(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.player_id)&&S(r,t.metadata.media_id,t.metadata.player_id))})),r.on("reap",(function(){s.disconnect()}))}}).pluginName="ovp",G.events=k,G);function Q(e){var t,o;const n=null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.live_stop_time;if(!n)return!0;return!!(null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.allow_after_stop_time)||w(n)>Date.now()}const J=e=>{var t;if(e&&Array.isArray(e))return"object"==typeof e[0]&&"ovp/base64"===(null===(t=e[0])||void 0===t?void 0:t.type)};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 o=e.flowplayer;return"function"==typeof o?(o(t),t):(Array.isArray(o.extensions)||(o.extensions=[]),~o.extensions.indexOf(t)||o.extensions.push(t),t)}(window,$)}));
|
|
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.ovp=t())}(this,function(){"use strict";function e(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}const t=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),o=(...e)=>e.reduce((e,n)=>t(n)?(Object.keys(n).forEach(r=>{if(t(e[r])&&t(n[r]))return e[r]=o(e[r],n[r]);e[r]=n[r]}),e):e,{}),n="is-starting",r="is-source-processing",a="flowplayer:error";class Pipe{static of(e){return new Pipe(e)}static maybe(e,t,...o){return null==e?e:t.apply(e,[e,...o])}constructor(e){this.data=e}tap(e,...t){return e.apply(this,[this.data,...t]),new Pipe(this.data)}fmap(e,...t){const o=e.apply(this,[this.data,...t]);return new Pipe(o)}unwrap(){return this.data}}const i=window,s=i._flowplayerTimekeeper||(i._flowplayerTimekeeper={});function c(e){return fetch(e).then(e=>e.json())}function l(...e){let t=[].join.call(e,"/");return"/"!==t[0]&&(t="/"+t),d()+"/web/public/native/config"+t}const d=()=>"https://ljsp.lwcdn.com";function u(e){(async function(){const e=s.cachedServerOffset;if(e)return e;const t=s.pendingRequest||(s.pendingRequest=fetch("https://ljsp.lwcdn.com/web/public/countdown/time.json")),o=await t,n=parseInt(o.headers.get("age")||"0"),r=await o.json(),a=Date.now()-r.millisUtc-1e3*n;return s.cachedServerOffset=a,s.cachedServerOffset})().then(t=>Object.assign(e,{server_time_offset:t}))}function p(e,t){var n,r;t="object"==typeof t?t:{};const a={title:null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.title,description:null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.description},i={ima:{parameters:function({media_id:e,duration:t,title:o,tags:n,category_name:r,ad_keywords:a}){return{ad_keywords:a||"",media_id:e||"",category:r||"",media_name:o||"",media_tags:n||"",media_duration:t||-1}}((null==e?void 0:e.metadata)||{})}},s=t.embed||{};return delete s.src,o(i,a,e,(delete(c=t).src,delete c.metadata,delete c.title,delete c.description,delete c.duration,delete c.poster,c),s);var c}const f=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,m=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,y=/^[A-Za-z0-9]{8}$/,v=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[A-Za-z0-9]{8}$/;function w(e){return"object"==typeof e&&"ovp/base64"==e.type}function h(e,t){return function(e,t){return!(!f.test(e)&&!m.test(e)||(t.type="video/ovp",0))}(e,t)||function(e,t){return!(!y.test(e)&&!v.test(e)||(t&&(t.type="video/ovp"),0))}(e,t)||w(t)}function k(e){try{return function(e){return null===e?{}:JSON.parse(e)}(decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join("")))}catch(e){return{err:e.message}}}function b(e){const t=e.split(/[^0-9]/).map(e=>parseInt(e,10));return Date.UTC(t[0],t[1]-1,t[2],t[3],t[4],t[5])}function P(e){return e.live}const g="ovp:request:start",E="ovp:request:media:complete",C="ovp:request:playlist:complete",A="ovp:live:countdown:tick",N="ovp:live:countdown:start",_="ovp:live:countdown:complete",M="ovp:media:changed",S="ovp:message:realtime",O="ovp:config:finalized";var D=Object.freeze({__proto__:null,OVP_ERROR:"ovp:error",OVP_MEDIA_REQUEST_START:g,OVP_MEDIA_REQUEST_COMPLETE:E,OVP_PLAYLIST_REQUEST_COMPLETE:C,LIVE_COUNTDOWN_TICK:A,LIVE_COUNTDOWN_START:N,LIVE_COUNTDOWN_COMPLETE:_,OVP_MEDIA_CHANGED:M,OVP_REALTIME_MESSAGE:S,OVP_CONFIG_FINALIZED:O});const L={Unknown:"00-00",MediaUnknown:"01-00",MediaUnavailable:"01-01",MediaUnsupportedVideoFormat:"01-02",MediaUnsupportedAudioFormat:"01-03",MediaBitrateExceeded:"01-04",MediaBufferOverread:"01-05",MediaIntegerOverflow:"01-06",MediaQuotaExceeded:"01-07",MediaInvalidCompositionDuration:"01-08",MediaInvalidCompositionSourceDuration:"01-09",MediaInvalidCompositionSourceStartTime:"01-10",MediaMalformedDepth:"01-11",PlaybackUnknown:"02-00",PlaybackVideoBufferUnderRun:"02-01",PlaybackAudioBufferUnderRun:"02-02",PlaybackVideoBufferingTimeout:"02-03",PlaybackAudioBufferingTimeout:"02-04",PlaybackManifestParseError:"02-05",PlaybackVideoDecodeError:"02-06",PlaybackAudioDecodeError:"02-07",PlaybackDroppedFramesExceeded:"02-08",PlaybackPlayheadExceedsDuration:"02-09",PlaybackUnsupportedDevice:"02-10",PlaybackManifestLoadError:"02-11",PlaybackManifestLoadTimeout:"02-12",PlaybackManifestParsingError:"02-13",PlaybackManifestIncompatibleCodecs:"02-14",PlaybackLevelEmptyError:"02-15",PlaybackLevelLoadError:"02-16",PlaybackLevelLoadTimeout:"02-17",PlaybackLevelSwitchError:"02-18",PlaybackAudioTrackLoadError:"02-19",PlaybackAudioTrackLoadTimeout:"02-20",PlaybackFragLoadError:"02-21",PlaybackFragLoadTimeout:"02-22",PlaybackFragDecryptError:"02-23",PlaybackFragParsingError:"02-24",PlaybackFragGap:"02-25",PlaybackRemuxAllocError:"02-26",PlaybackBufferAddCodecError:"02-27",PlaybackBufferIncompatibleCodecs:"02-28",PlaybackBufferAppendError:"02-29",PlaybackBufferStalledError:"02-30",PlaybackBufferFullError:"02-31",PlaybackBufferSeekOverHole:"02-32",PlaybackBufferNudgeOnStall:"02-33",PlaybackInternalException:"02-34",PlaybackInternalAborted:"02-35",PlaybackManifestLoaderFailure:"02-36",PlaybackSegmentBaseLoaderError:"02-37",PlaybackTimeSyncFailed:"02-38",PlaybackFragmentLoaderFailure:"02-39",PlaybackAppendError:"02-40",PlaybackRemoveError:"02-41",PlaybackDataUpdateFailed:"02-42",PlaybackManifestNoStreams:"02-43",PlaybackUnknownManifestType:"02-44",PlaybackDashInsufficientSegmentInfo:"02-45",PlaybackDashNoRepresentations:"02-46",PlaybackDashNoAdaptationSets:"02-47",PlaybackDashNoInitSegment:"02-48",PlaybackDashUnsupportedContainerFormat:"02-49",PlaybackDashKeySystemMismatch:"02-50",PlaybackMultipleKeyIDs:"02-51",PlaybackDashConflictingKeyIDs:"02-52",PlaybackRestrictedStreams:"02-53",PlaybackHlsMasterAndMediaTags:"02-54",PlaybackRepresentationIdConflict:"02-55",PlaybackHlsUnsupportedKeyFormats:"02-56",PlaybackManifestNoVariants:"02-57",PlaybackHlsUndeclaredVariables:"02-58",PlaybackAes128InvalidKeyLength:"02-59",PlaybackDashConflictingAes128Keys:"02-60",PlaybackDashUnsupportedAes128Encryption:"02-61",PlaybackManifestPatchMismatch:"02-62",PlaybackEmptyMediaPlaylist:"02-63",PlaybackNonContiguousCompositionTrack:"02-64",PlaybackDecoderNotFound:"02-65",PlaybackDecoderTemporarilyUnavailable:"02-66",PlaybackIncompatibleAsset:"02-67",PlaybackNoCompatibleExternalDisplay:"02-69",PlaybackOutOfMemory:"02-70",PlaybackToneMappingFailed:"02-71",PlaybackVideoCompositorFailed:"02-72",NetworkUnknown:"03-00",NetworkNoInternet:"03-01",NetworkRequestTimeout:"03-02",NetworkUnableToResolveHost:"03-03",NetworkResourceNotFound:"03-04",NetworkExpiredUrl:"03-05",NetworkUrlResolutionFailed:"03-06",NetworkDownloadErrorIdManifest:"03-07",NetworkDownloadErrorIdSidx:"03-08",NetworkDownloadErrorIdContent:"03-09",NetworkDownloadErrorIdInitialization:"03-10",NetworkDownloadErrorIdXlink:"03-11",NetworkHttpRequestFailed:"03-12",NetworkMaxRetriesExceeded:"03-13",NetworkSegmentMissing:"03-14",NetworkHttp400BadRequest:"03-400",NetworkHttp401Unauthorized:"03-401",NetworkHttp402PaymentRequired:"03-402",NetworkHttp403Forbidden:"03-403",NetworkHttp404NotFound:"03-404",NetworkHttp405MethodNotAllowed:"03-405",NetworkHttp406NotAcceptable:"03-406",NetworkHttp407ProxyAuthenticationRequired:"03-407",NetworkHttp408RequestTimeout:"03-408",NetworkHttp409Conflict:"03-409",NetworkHttp410Gone:"03-410",NetworkHttp411LengthRequired:"03-411",NetworkHttp412PreconditionFailed:"03-412",NetworkHttp413PayloadTooLarge:"03-413",NetworkHttp414URITooLong:"03-414",NetworkHttp415UnsupportedMediaType:"03-415",NetworkHttp416RangeNotSatisfiable:"03-416",NetworkHttp417ExpectationFailed:"03-417",NetworkHttp418ImATeapot:"03-418",NetworkHttp421MisdirectedRequest:"03-421",NetworkHttp422UnprocessableEntity:"03-422",NetworkHttp423Locked:"03-423",NetworkHttp424FailedDependency:"03-424",NetworkHttp425TooEarly:"03-425",NetworkHttp426UpgradeRequired:"03-426",NetworkHttp428PreconditionRequired:"03-428",NetworkHttp429TooManyRequests:"03-429",NetworkHttp431RequestHeaderFieldsTooLarge:"03-431",NetworkHttp451UnavailableForLegalReasons:"03-451",NetworkHttp500InternalServerError:"03-500",NetworkHttp501NotImplemented:"03-501",NetworkHttp502BadGateway:"03-502",NetworkHttp503ServiceUnavailable:"03-503",NetworkHttp504GatewayTimeout:"03-504",NetworkHttp505HTTPVersionNotSupported:"03-505",NetworkHttp506VariantAlsoNegotiates:"03-506",NetworkHttp507InsufficientStorage:"03-507",NetworkHttp508LoopDetected:"03-508",NetworkHttp510NotExtended:"03-510",NetworkHttp511NetworkAuthenticationRequired:"03-511",ContentProtectionUnknown:"04-00",ContentProtectionConcurrentStreamLimitExceeded:"04-01",ContentProtectionEntitlementRefused:"04-02",ContentProtectionLicenseExpired:"04-03",ContentProtectionBadLicenseRequest:"04-04",ContentProtectionLicenseServerTimeout:"04-05",ContentProtectionInsufficientHDCPSupport:"04-06",ContentProtectionGeoRestricted:"04-07",ContentProtectionParentalControlRestricted:"04-08",ContentProtectionCDNUnauthorized:"04-09",ContentProtectionInvalidAccessToken:"04-10",ContentProtectionKeySystemNoKeys:"04-11",ContentProtectionKeySystemNoAccess:"04-12",ContentProtectionKeySystemNoSession:"04-13",ContentProtectionKeySystemNoConfiguredLicense:"04-14",ContentProtectionKeySystemCertificateRequestFailed:"04-15",ContentProtectionKeySystemCertificateUpdateFailed:"04-16",ContentProtectionKeySystemSessionUpdateFailed:"04-17",ContentProtectionKeySystemStatusOutputRestricted:"04-18",ContentProtectionKeySystemStatusInternalError:"04-19",ContentProtectionKeyLoadError:"04-20",ContentProtectionKeyLoadTimeout:"04-21",ContentProtectionCapabilityMediaKeysError:"04-22",ContentProtectionManifestKeySystemUnknown:"04-23",ContentProtectionKeySystemUnavailable:"04-24",ContentProtectionCDMCreationFailed:"04-25",ContentProtectionCDMAttachFailed:"04-26",ContentProtectionCDMServerCertificateRejected:"04-27",ContentProtectionCDMSessionCreationFailed:"04-28",ContentProtectionCDMLicenseRequestFailed:"04-29",ContentProtectionCDMLicenseResponseRejected:"04-30",ContentProtectionManifestMissingDRMInfo:"04-31",ContentProtectionLicenseServerMissing:"04-32",ContentProtectionOfflineSessionRemoved:"04-33",ContentProtectionInitDataTransformationError:"04-34",ContentProtectionServerCertificateRequestFailed:"04-35",ContentProtectionInsufficientHDCPVersion:"04-36",ContentProtectionHDCPVersionCheckFailed:"04-37",AdsUnknown:"08-00",AdsVastParseError:"08-100",AdsInvalidVastSchema:"08-101",AdsVastVersionNotSupported:"08-102",AdsUnexpectedAdType:"08-200",AdsCreativeLinearityMismatch:"08-201",AdsCreativeDurationMismatch:"08-202",AdsCreativeSizeMismatch:"08-203",AdsWrapperVastError:"08-300",AdsVastResponseRedirectTimeout:"08-301",AdsWrapperLimitReached:"08-302",AdsVastResponseEmpty:"08-303",AdsLinearAdDisplayError:"08-400",AdsMediaFileNotFound:"08-401",AdsMediaFileUnavailable:"08-402",AdsUnsupportedMimeType:"08-403",AdsUnableToDisplayMediaFile:"08-405",AdsMezzanineFileMissing:"08-406",AdsMezzanineFileDownloaded:"08-407",AdsRejectedAd:"08-408",AdsInteractiveCreativeError:"08-409",AdsVerificationNodeExecutionError:"08-410",AdsNonLinearAdDisplayError:"08-500",AdsNonLinearAdSizeMismatch:"08-501",AdsNonLinearAdFetchError:"08-502",AdsNonLinearUnsupportedType:"08-503",AdsCompanionAdDisplayError:"08-600",AdsCompanionAdSizeMismatch:"08-601",AdsRequiredCompanionAdError:"08-602",AdsCompanionAdFetchError:"08-603",AdsUndefinedVastError:"08-900",AdsUnknownVpaidError:"08-901",AdsVastDocumentEmpty:"08-999"},T=Object.fromEntries(Object.entries(L).map(([e,t])=>[t,e]));const F=[1e7]+""+-1e3+-4e3+-8e3+-1e11,R="off";class FlowplayerError extends Error{static getErrorKey(e){return e in T?T[e]:T["00-00"]}constructor(e,t,o={}){super(e),this.message=e,this.flowplayerErrorCode=t,this.config=o,this.id="undefined"==typeof crypto?"":F.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)),this.isFatal=!!o.isFatal,this.errorKey=FlowplayerError.getErrorKey(this.flowplayerErrorCode)||"unknown"}toJSON(){return{message:this.message,flowplayer_error_code:this.flowplayerErrorCode,id:this.id,root_error_id:this.config.rootErrorId,resource:this.config.resource,is_fatal:this.isFatal,is_retry:!!this.config.isRetry}}}function I(e,t){const o=null==t?void 0:t.src;if(w(t))return function(e,t){const o=k(t.src||"");if(function(e){return"string"==typeof e.err}(o))return console.error(o.err);H(e,o)}(e,t);if(!o)return;e.setState(r,!0);const n=function(e){return~e.indexOf("/")?e:"/media/"+e}(o),i=l(n);fetch(i).then(async t=>t.ok?H(e,await t.json()):function(e,t,o,n){e.setState(r,!1);const i=new FlowplayerError(n.message||"error loading ovp source",function(e){const t=`03-${e}`;return t in T?t:L.NetworkUnknown}(o),{resource:t,isFatal:!0,retryOpts:{retry:R}});e.emit(a,{error:i})}(e,t.url,t.status,await t.json()))}function H(e,t){return e.emit(M,t),function(e){return Array.isArray(e.playlist)}(t)?function(e,t){e.emit(C,function(e,t){"number"!=typeof t.delay&&"number"!=typeof e.delay&&(t.delay=5);const n=Object.assign({},e),r=(null==e?void 0:e.playlist)||{},a=o(t,r),i=((null==a?void 0:a.playlist)||[]).map(e=>{t.ima&&Object.assign(e,{ima:t.ima});const o=p(e,n);return delete o.playlist,o});return delete a.ima,Object.assign(a,{playlist:i})}(e.opts,t))}(e,t):P(t)?function(e,t){var o,n;const r=(null===(o=null==t?void 0:t.metadata)||void 0===o?void 0:o.live_start_time)||(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.starttime);r&&(t.live_start_time=Pipe.of(r).fmap(b).unwrap());e.emit(N,Pipe.of(t).fmap(p,e.opts).unwrap())}(e,t):function(e,t){e.emit(E,Pipe.of(t).fmap(p,e.opts).unwrap())}(e,t)}const U={};function j(e,t,o){"object"!=typeof U[t]&&(U[t]=o);const n=e.opts,r=(null==n?void 0:n.metadata)||{};r.player_id=t,n.metadata=r,o.title&&delete o.title,o.description&&delete o.description;const a=Object.assign(n,o);e.setOpts(a),o.autoplay&&e.togglePlay(!0)}const x="recommendationsready";let V=!1;function K(e,t,o){q()||Pipe.of("recommendation").fmap(l,t,o).fmap(c).fmap(t=>t.then(t=>function(e,t){const o=t.playlist,n=e.opts;if(n.recommendations=o,!o.length)return;e.emit(x,{playlist:o.map(function(e){var t,o;return{poster:e.poster,src:e.src,title:null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.title,description:null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.description,metadata:e.metadata||{},chapters:e.chapters,thumbnails:e.thumbnails,subtitles:e.subtitles}})})}(e,t)).catch(B))}function q(){return V}function B(e){V=!0,console.error("Failed to load recommendations: %j",e)}function z(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}function W(e,t){const o=e._customElements.get(t);return o&&e.root.querySelector(o)||void 0}const $="flowplayer-live-countdown";function G(e){const t=Date.now()-(e.server_time_offset||0);return Math.floor(((e.live_start_time||0)-t)/1e3)}function Q(e,t){let o=0;function a(){const a=G(t);if(a<0||isNaN(a)||0===e.reaper||void 0===t.live_start_time)return clearInterval(o),function(e,t,o){e.emit(_);const n=W(e,$);if(n&&n.remove(),e.root.classList.remove("is-livecountdown"),o)return e.setState(r,!1);e.emit(E,t)}(e,t,void 0===t.live_start_time);var i,s,c;i=e,s=e.root,c=a,s.classList.add("is-livecountdown"),i.emit(A,{remaining_time:J(c+1)}),i.hasState(n)||i.setState(n,!0)}u(t),a(),o=setInterval(a,250)}function J(e){const t=function(e){"number"!=typeof e&&(e=parseInt(e,10)),e=Math.round(e);const t=Math.floor(e/86400);e-=86400*t;const o=Math.floor(e/3600);e-=3600*o;const n=Math.floor(e/60);return{days:t,hours:o,minutes:n,seconds:e-=60*n}}(e);let o="";return t.days&&(o+=t.days+":"),o+z(t.hours)+":"+z(t.minutes)+":"+z(t.seconds)}class WebsocketBridge{static of(e){return new WebsocketBridge(e)}constructor(e){this.manualDisconnect=!1,this.video=e,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}connect(e){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+e),this.current_media_id=e,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(e){JSON.parse(e.data).forEach(e=>{this.video.emit(S,e)})}reconnect(e){this.cleanup(),this.connect(e)}wireup(){this.client&&(this.client.addEventListener("message",this.onMessage),this.client.addEventListener("close",this.onClose))}cleanup(){this.client&&(this.client.removeEventListener("message",this.onMessage),this.client.removeEventListener("close",this.onClose),this.client=void 0)}disconnect(){this.client&&(this.manualDisconnect=!0,this.client.close())}}const Z=(e,t)=>new(((e,t)=>{const o=e.get(t);if(!o)throw new Error(`no flowplayer component with the name ${t} exists`);const n=window.customElements.get(t);if(!n)throw new Error(`no default flowplayer component with the name ${t} exists`);const r=window.customElements.get(o);return"function"!=typeof r?n:r})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class FlowplayerLiveCountdown extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-livecountdown");const t=function(...e){const t=document.createElement("div");return 0==e.length||t.classList.add(...e),t}("fp-inner");this.append(t);const o=document.createElement("p");o.innerText=e.i18n("ovp.starting_in"),t.append(o);const n=document.createElement("p");n.classList.add("fp-countdown"),t.append(n),e.on(A,t=>{const o=t.detail.remaining_time;e.root.classList.add("is-livecountdown"),n.innerText=o})}}const X=["*.lwcdn.com","*.flowplayer.com","*.wowza.com"];function Y(){try{return window.location.hostname!==window.parent.location.hostname?function(e){const t=document.createElement("a");return t.href=e,t}(document.referrer).hostname:document.location.hostname}catch(e){return window.location.hostname}}function ee(e){const t=document.createElement("a");t.href=e;const o=t.pathname&&t.pathname.split(".");return o.length>1&&o[o.length-1]}function te(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const oe=t=>{var{src:o}=t,n=e(t,["src"]);return[Object.assign({src:o,type:o?te("video/"+ee(o)):""},n)]};function ne(e){return oe({src:e})}function re(t){var{src:o,type:n}=t,r=e(t,["src","type"]);return o&&n?[Object.assign({src:o,type:n},r)]:n&&!o?[Object.assign({type:n},r)]:oe(Object.assign({src:o},r))}var ae,ie;!function(e){e[e.Err=0]="Err",e[e.Ok=1]="Ok"}(ae||(ae={}));const se=((ie=class OVP{constructor(e){((e,t,o)=>{window.customElements.get(t)||window.customElements.define(t,o),e.customElements.get(t)||e.customElements.set(t,t)})(e,$,FlowplayerLiveCountdown)}onload(e,t,o,n){if("string"==typeof(null==n?void 0:n.src))return"string"!=typeof e.player_id||0===n.src.indexOf(e.player_id)||w(n)||(n.src=[e.player_id,n.src].join("/")),I(o,n)}wants(e,t,o){return h(e,t)}init(t,n,a){const i=new WebsocketBridge(a);let s=Object.assign({},t);const d=function(e){if(!s)return e;t.autoplay!==s.autoplay&&(s.autoplay=t.autoplay),delete s.src;const n=o(e,s);return a.emit(O,n),n};a.on("src",()=>{(a.currentSrc||a.root.classList.contains("is-livecountdown"))&&(s=!1)}),a.on(g,function(){a.setState("is-waiting",!0),t.recommendations&&(t.recommendations=!1)}),a.on(M,function({data:e}){var t;const o=null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.media_id;(null==e?void 0:e.live)&&o&&(i.disconnect(),i.connect(o))}),a.on(S,function({data:e}){var o;const n=null==e?void 0:e.event,r=null==e?void 0:e.value,i=a.opt("metadata",{live_start_time:""});switch(n){case"METADATA":{const e=Object.assign(i,r),n=Object.assign(t,{metadata:e});n.live&&(null===(o=null==n?void 0:n.metadata)||void 0===o?void 0:o.live_start_time)&&(n.live_start_time=b(n.metadata.live_start_time)),a.setOpts(n);break}}}),a.on("beforeplay",function(e){const o=t;if(P(o)){if(ce(o))return;e.preventDefault()}}),a.on(E,function(e){const t=e.data;if(!t)return;var o;if(t.src&&(t.src=(o=t.src,"string"==typeof o?ne(o):Array.isArray(o)||"object"!=typeof o?o.reduce(function(e,t){return"string"==typeof t&&(t=ne(t)),"object"!=typeof t||Array.isArray(t)||(t=re(t)),e.concat(t)},[]):re(o)).map(e=>(e.src&&e.src.startsWith("//")&&(e.src="https:"+e.src),e))),0==a.reaper||"object"!=typeof t||G(t)>0)return;const n=d(t);a.setOpts(n),a.setAttrs(n),n.src&&a.setSrc(n.src),a.setState(r,!1)}),a.on("config",function({data:e}){var o,r;if("string"==typeof t.src&&h(t.src,{}))return;if((null==e?void 0:e.domains)&&(null==e?void 0:e.domains.length)&&!((e,t)=>{const o=e.split(".").reverse();return t.concat(X).some(e=>{const t=e.split(".").reverse(),n="*"===t[t.length-1];return n&&t.pop(),(n||t.length===o.length)&&t.every((e,t)=>o[t]===e)})})(Y(),e.domains))return function({root:e,video:t,data:o}){t&&t.destroy(),console.error(new Error(o.details||o.reason)),e.innerHTML="",e.classList.remove("flowplayer"),e.classList.add("flowplayer-fatal"),e.style.removeProperty("background-image");const n=document.createElement("h2");n.textContent="Playback Error";const r=document.createElement("p");r.textContent="Are you the site owner?";const a=document.createElement("a");a.classList.add("troubleshoot"),a.target="_blank",a.href="https://docs.flowplayer.com/troubleshooting/player#"+o.reason,a.textContent="Troubleshoot?";const i=document.createElement("img");i.src="https://flowplayer.com/user/pages/images/logo-white.png",e.append(n,r,a,i)}({root:n,video:a,data:{details:`Hostname ${Y()} is not allowed to load player ${null===(o=e.metadata)||void 0===o?void 0:o.player_id}.`,reason:"domain"}});if(t.src&&le(t.src))return;const i=null==e?void 0:e.brand_color;return i&&a.root.style.setProperty("--fp-brand-color","#"==i[0]?i:"#"+i),"string"==typeof t.player_id&&(null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.player_id)!==t.player_id?function(e,t){if("object"==typeof U[t])return console.debug("using Cache(%s)",t),j(e,t,U[t]);Pipe.of(t).fmap(l).fmap(c).fmap(o=>o.then(o=>j(e,t,o)).catch(console.error))}(a,t.player_id):void 0}),a.on(C,function(t){var o;const n=t.data;if(!n||0==a.reaper)return;const{playlist:i}=n,s=e(n,["playlist"]),c=d(Object.assign(s,{playlist:Object.assign({},s)}));Array.isArray(c.playlist)&&(c.playlist=s),delete c.loop,c.playlist.playlist_title||(c.playlist.playlist_title=null===(o=s.metadata)||void 0===o?void 0:o.playlist_title),a.setOpts(c),a.setAttrs(c);const l={type:"flowplayer/playlist",items:i};a.setSrc(l),a.setState(r,!1)}),a.on(N,function(e){const o=e.data;if(!o||0==a.reaper)return;const r=d(o);if(a.setOpts(r),a.setAttrs(r),G(o)<=0)return a.emit(E,o);W(a,$)||(n.appendChild(Z(a,$)),Q(a,t))}),a.on("timeupdate",function(){var e,o,n;const r=t;P(r)?ce(r)||(a.togglePlay(!1),a.emit("ended")):t.recommendations&&(null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id)&&(Array.isArray(t.recommendations)||a.currentTime/a.duration<.8||q()||(null===(o=null==t?void 0:t.metadata)||void 0===o?void 0:o.media_id)&&(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.player_id)&&K(a,t.metadata.media_id,t.metadata.player_id))}),a.on("reap",function(){i.disconnect()})}}).pluginName="ovp",ie.events=D,ie);function ce(e){var t,o;const n=null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.live_stop_time;if(!n)return!0;return!!(null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.allow_after_stop_time)||b(n)>Date.now()}const le=e=>{var t;if(e&&Array.isArray(e))return"object"==typeof e[0]&&"ovp/base64"===(null===(t=e[0])||void 0===t?void 0:t.type)};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 o=e.flowplayer;return"function"==typeof o?(o(t),t):(Array.isArray(o.extensions)||(o.extensions=[]),~o.extensions.indexOf(t)||o.extensions.push(t),t)}(window,se)});
|
package/plugins/playlist.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BitrateInfo } from 'dashjs';
|
|
2
1
|
import type { Get } from 'type-fest';
|
|
3
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Representation } from 'dashjs';
|
|
4
4
|
import type { TupleToUnion } from 'type-fest';
|
|
5
5
|
|
|
6
6
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1732,7 +1732,7 @@ PROGRESS = "progress";
|
|
|
1732
1732
|
*/
|
|
1733
1733
|
declare type QselOption = (Level & {
|
|
1734
1734
|
level: number;
|
|
1735
|
-
}) |
|
|
1735
|
+
}) | Representation | {
|
|
1736
1736
|
name: string | number;
|
|
1737
1737
|
encodingId: string;
|
|
1738
1738
|
spatialLayerId: number;
|
|
@@ -1780,8 +1780,8 @@ QUALITY_CHANGE = "qualitychange";
|
|
|
1780
1780
|
* @public
|
|
1781
1781
|
*/
|
|
1782
1782
|
declare type QualityChangeEventDetail = {
|
|
1783
|
-
before?: Level |
|
|
1784
|
-
after?: Level |
|
|
1783
|
+
before?: Level | Representation;
|
|
1784
|
+
after?: Level | Representation;
|
|
1785
1785
|
plugin: string;
|
|
1786
1786
|
automatic: boolean;
|
|
1787
1787
|
/* Excluded from this release type: downscale */
|
package/plugins/playlist.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=t.flowplayer||{},t.flowplayer.playlist=e())}(this,(function(){"use strict";var t=Object.freeze({__proto__:null,PLAYLIST_NEXT:"playlist:next",PLAYLIST_ENDED:"playlist:ended",PLAYLIST_READY:"playlist:ready",PLAYLIST_PREVIOUS:"playlist:previous",PLAYLIST_SELECTION:"playlist:selection",PLAYLIST_LOOP:"playlist:loop",PLAYLIST_ADD:"playlist:add",PLAYLIST_REMOVE:"playlist:remove",INTERSTITIAL_END:"interstitial/end",INTERSTITIAL_CANCEL:"interstitial/cancel",INTERSTITIAL_NEXT_ITEM:"interstitial/next_item"});const e={translation_key:"core.skip-next",name:"fp-skip-next"},n={translation_key:"core.skip-prev",name:"fp-skip-prev"};class Pipe{static of(t){return new Pipe(t)}static maybe(t,e,...n){return null==t?t:e.apply(t,[t,...n])}constructor(t){this.data=t}tap(t,...e){return t.apply(this,[this.data,...e]),new Pipe(this.data)}fmap(t,...e){const n=t.apply(this,[this.data,...e]);return new Pipe(n)}unwrap(){return this.data}}function i(t,e){if(!e)throw new Error(t)}function s(t){return"invalid playlist configuration\ndetails: "+t+"\n\tmust match Object of shape:\n"+["\t\t{ controls?: Selector|HTMLElement","player: Selector|HTMLElement","playlist: PlaylistId|Array(MediaId|PlayerConfig)","shuffle?: Boolean|false","loop?: Boolean|false","advance?: Boolean|true","delay?: Milliseconds|5000"].join("\n\t\t, ")+"\n\t\t}"}function l(t,e){Pipe.of(t).fmap(s).fmap(i,e)}function a(t){return void 0!==t}function o(t){return"string"==typeof t}function r(t){return"object"==typeof t}function c(t){return t instanceof HTMLElement}function p(t){var e;l("Config must be an Object",a(t)&&r(t)),l("property `playlist` is required",a(t.playlist)),l("property `playlist` was not a String(MediaId)",o(t.playlist)||(e=t.playlist,l("playlist property was not of type PlaylistId|Array(MediaId|PlayConfig)",Array.isArray(e)),l("playlist property cannot be an empty Array",e.length>0),!e.forEach((function(t,e){l("item at playlist["+e+"] was not valid",o(t)||r(t))})))),"loop shuffle".split(" ").forEach((function(e){a(t[e])&&l(e+" must be a boolean value if present","boolean"==typeof t[e])})),a(t.delay)&&l("property `delay` must be a Number (Milliseconds)","number"==typeof t.delay)}function u(t){try{p(t)}catch(t){return!1}return!0}class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}class FlowplayerIcon extends FlowplayerComponent{constructor(t,e){super(t),this.classList.add("fp-icon",e.name),e.title&&this.setAttribute("title",e.title),e.title&&this.setAttribute("aria-label",e.title),e.translation_key&&this.setAttribute("aria-label",t.i18n(e.translation_key)),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}const d=["title","delay","description","poster","src"];class UpNext extends FlowplayerComponent{static get observedAttributes(){return d}constructor(t){super(t),this.classList.add("up-next"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent("interstitial/end"))}),this.addEventListener("animationcancel",()=>{this.classList.add("cancelled"),this.dispatchEvent(new CustomEvent("interstitial/cancel"))}),this.addEventListener("interstitial/next_item",this._setUpNext.bind(this))}getTitle(){return this.getAttribute("title")||""}getDescription(){return this.getAttribute("description")||""}getPoster(){return this.getAttribute("poster")||""}getDelay(){return this.getAttribute("delay")||""}connectedCallback(){this.isConnected&&this._render()}attributeChangedCallback(){this._render()}_render(){var t,e;this.innerHTML="",this.classList.remove("cancelled");const n=document.createDocumentFragment(),i=document.createElement("div");i.classList.add("pane","left");const s=document.createElement("div");s.classList.add("pane","right"),n.append(i,s);const l=document.createElement("div");l.classList.add("poster"),l.style.backgroundImage="url("+this.getPoster()+")",i.append(l),l.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("interstitial/end")));const a=document.createElement("span");a.classList.add("fp-icon","fp-play"),l.append(a);const o=document.createElement("span");o.classList.add("title"),o.textContent=this.getTitle();const r=document.createElement("span");r.classList.add("description"),r.textContent=this.getDescription();const c=document.createElement("span");c.classList.add("countdown"),this.getDelay()&&(c.style.setProperty("--up-next-delay",this.getDelay()+"s"),c.classList.add("go"));const p=document.createElement("span");p.classList.add("cancel"),p.textContent=null!==(e=null===(t=this.player)||void 0===t?void 0:t.i18n("playlist.cancel"))&&void 0!==e?e:"cancel",p.addEventListener("click",()=>c.classList.remove("go")),s.append(o,r,p,c),this.append(n)}_setUpNext(t){var e,n,i;const s=t.detail.next,l=this.player.opt("playlist.delay",void 0)||10;this.setAttribute("title",null!==(e=s.title)&&void 0!==e?e:""),this.setAttribute("description",null!==(n=s.description)&&void 0!==n?n:""),this.setAttribute("poster",null!==(i=s.poster)&&void 0!==i?i:""),this.setAttribute("delay",l+"")}}const y=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const i=window.customElements.get(e);if(!i)throw new Error(`no default flowplayer component with the name ${e} exists`);const s=window.customElements.get(n);return"function"!=typeof s?i:s})(t._customElements,e))(t),m=(t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)};function f(t,e,n){const i=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;i.length;){if(null==t)return n;const e=i.shift();if("string"!=typeof e)return n;t=t[e]}return null==t?n:t}function h(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}class FlowplayerPlaylistControls extends FlowplayerComponent{constructor(t){super(t),this.playlistWrapper=document.createElement("ol"),this.className="fp-playlist-controls is-empty use-play-1",this.header=this.controlsHeader(t),this.append(this.header,this.playlistWrapper),t.on("playlist:ready",e=>{const n=e.detail.queue;n&&(this.list(n,t),this.classList.toggle("is-empty",!n.members.length))}),t.on("playlist:next",()=>{var e;(null===(e=t.playlist)||void 0===e?void 0:e.queue)&&Array.from(this.querySelectorAll("li")).forEach((e,n)=>{var i;const s=n===(null===(i=t.playlist)||void 0===i?void 0:i.queue.idx);e.classList.toggle("is-current",s),e.setAttribute("aria-current",""+s)})}),t.on("playlist:add",e=>{var n;const i=null===(n=t.playlist)||void 0===n?void 0:n.queue;if(!e.data||!i)return;e.data.members.forEach(e=>{const n=this.videoRow(e,t);n&&this.playlistWrapper.append(n)})}),t.on("playlist:remove",t=>{if(!t.data)return;const e=Array.from(this.querySelectorAll("li"))[t.data.index];e&&this.playlistWrapper.removeChild(e)})}list(t,e){this.playlistWrapper.innerHTML="",t.members.forEach(t=>{const n=this.videoRow(t,e);n&&this.playlistWrapper.append(n)})}videoRow(t,e){const n=document.createElement("li");return n.onclick=this.videoRow_onclick.bind(this,n,e),n.setAttribute("tabindex","0"),n.append(this.item(e,t)),n}item(t,e){const n=document.createElement("div");n.className="fp-playlist-controls-item";const i=this.itemHeader(t,e),s=this.itemContent(e);return n.append(i,s),n}itemContent(t){var e,n;const i=document.createElement("div");i.className="fp-playlist-controls-item-content";const s=document.createElement("div");s.className="fp-playlist-controls-item-title",s.textContent=t.title||(null===(e=t.metadata)||void 0===e?void 0:e.title)||"";const l=document.createElement("div");return l.className="fp-playlist-controls-item-desc",l.textContent=t.description||(null===(n=t.metadata)||void 0===n?void 0:n.description)||"",i.append(s,l),i}itemHeader(t,e){var n,i;const s=document.createElement("div");s.className="fp-playlist-controls-item-header";const l=document.createElement("img");l.alt=e.title||(null===(n=e.metadata)||void 0===n?void 0:n.title)||"",l.className="fp-playlist-controls-image",l.src=e.poster||"";const a=document.createElement("div");a.className="fp-playlist-controls-playing";const o=new(window.customElements.get("flowplayer-play-icon"))(t);o.ariaHidden="true",o.tabIndex=-1;const r=document.createElement("span");r.textContent=t.i18n("playlist.now_playing","Now playing"),a.append(o,r),s.append(l,a);const c=e.duration||(null===(i=e.metadata)||void 0===i?void 0:i.duration);if(void 0!==c){const t=document.createElement("span");t.className="fp-playlist-controls-duration",t.textContent=isFinite(c)?function(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const n=Math.floor(t/3600);let i=Math.floor(t/60);return t-=60*i,n>=1?(i-=60*n,e+n+":"+h(i)+":"+h(t)):e+h(i)+":"+h(t)}(c):"",s.append(t)}return s}controlsHeader(t){const e=document.createElement("div");e.className="fp-playlist-controls-header";const n=document.createElement("h3");n.id="title",n.className="fp-playlist-title",n.textContent="Playlist";const i=document.createElement("input");i.type="checkbox",i.className="fp-playlist-toggle-input",i.id="toggle";const s=document.createElement("label");s.className="fp-playlist-toggle-label",s.tabIndex=0,s.setAttribute("role","button"),s.setAttribute("for","toggle");const l=document.createElement("span");l.className="fp-playlist-toggle-title",l.textContent=t.i18n("playlist.autoplay","Autoplay");const a=document.createElement("div");return a.className="fp-playlist-toggle",a.append(l,i,s),s.addEventListener("click",e=>{e.preventDefault();const n=!i.checked;i.checked=n;const l=t.opts;l.playlist||(l.playlist={}),Object.assign(l.playlist,{advance:n}),s.ariaPressed=n+"",s.ariaLabel=n?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay")}),t.on("playlist:ready",()=>{var e,l;const a=t.opts,o=null===(e=null==a?void 0:a.playlist)||void 0===e?void 0:e.advance;i.checked=!1!==o,s.ariaPressed=""+(!1!==o),s.ariaLabel=!1!==o?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay"),n.textContent=(null===(l=a.playlist)||void 0===l?void 0:l.playlist_title)||t.i18n("playlist.playlist","Playlist")}),e.append(n,a),e}videoRow_onclick(t,e){var n;if(t.classList.contains("is-current"))return;const i=Array.from(this.querySelectorAll("li")).indexOf(t);-1!==i&&(null===(n=e.playlist)||void 0===n||n.play(i))}}var v;function x(t,e){var n,i;const s=e.sort||g,l=null!==(n=e.mode)&&void 0!==n?n:v.FIFO;return t=s(t.slice(0),l),{mode:l,sort:s,members:t,last_idx:t.length-1,plays:null!==(i=e.plays)&&void 0!==i?i:0,idx:-1}}function b(t){return t.idx==t.last_idx}function E(t){const e=t.idx+1;return e>t.last_idx?0:e}function w(t,e,n){return t.idx=e&&"number"==typeof n&&n>=0&&n<=t.last_idx?n:t.idx+1,t.members[t.idx]}function g(t,e){return(e&v.SHUFFLE)==v.SHUFFLE?t.sort((function(){return Math.random()-Math.random()})):t.slice(0)}function L(t){return x(t.members,{mode:t.mode,plays:t.plays+1,sort:t.sort})}!function(t){t[t.SHUFFLE=1]="SHUFFLE",t[t.FIFO=2]="FIFO",t[t.LOOP=4]="LOOP"}(v||(v={})),function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}}();const _=["touchstart","touchmove"];function A(t,e,n){const i=function(t,e){const n=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(n,"data",{get:()=>e}),n}(e,n);return t.dispatchEvent(i),t}function P(t,e,n,i){Array.isArray(e)?e.forEach(e=>I(t,e,n,i)):I(t,e,n,i)}function I(t,e,n,i){if(s=e,!~_.indexOf(s))return t.addEventListener(e,n,i),t;var s;const l=Object.assign(i||{},{passive:!0});return t.addEventListener(e,n,l),t}function q(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}function O(t,e,n){return t.setAttribute(e,n),t}function N(t,e,n){return e.split(" ").forEach(e=>t.classList.toggle(e,n)),t}function T(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}function k(t,e,n){const i=e.idx+e.plays<0;if(!i&&n.delay)return function(t,e){var n;const i=null===(n=t.playlist)||void 0===n?void 0:n.queue,s=q(t,"flowplayer-playlist-interstitial");if(!s||!i||!e.delay)return;t.root.classList.add("is-interstitial");const l=i.members[E(i)];A(s,"interstitial/next_item",{next:l})}(t,n);C(t,w(e,i,n.start_index),i)}function C(t,e,n){n||(t.preload=e.preload="auto",!t.opts.autoplay&&t.setOpts({autoplay:1})),t.emit("playlist/advance"),"object"==typeof e&&t.setOpts(e),function(t,e){var n;const i=null===(n=t.playlist)||void 0===n?void 0:n.queue;if(!i)return;const s=i.idx,l=i.members[s],a=t.currentSrc;if(l.src&&t.setSrc(l.src),t.emit("playlist:next",{next_index:s}),t.opts.autoplay||e)return;const o=e=>{("canplay"===e.type&&a!==t.currentSrc||"playlist:next"===e.type)&&(t.removeEventListener("canplay",o),t.removeEventListener("playlist:next",o),"canplay"===e.type&&t.togglePlay(!0))};t.on(["canplay","playlist:next"],o)}(t,n)}function S(e,n){return{queue:n,events:t,play:function(t){t<0||t>=n.members.length||(this.queue.idx=t,C(e,n.members[t]))},next:function(){this.queue.idx!==this.queue.last_idx&&this.play(this.queue.idx+1)},prev:function(){this.queue.idx&&this.play(this.queue.idx-1)},remove:function(t){const n=this.queue;return n.members[t]?n.idx===t?console.warn("operation failed: you cannot remove current playlist item"):(n.members.splice(t,1),n.last_idx=n.members.length-1,t<n.idx&&--n.idx,void e.emit("playlist:remove",{index:t})):console.warn("there is no playlist item at this index")},push:function(...t){const n=e.root;if(0==this.queue.idx&&n.classList.contains("is-interstitial"))return console.warn("new items cannot be added when playlist has ended.");const i=this.queue.members;i.push(...t),this.queue.last_idx=i.length-1,e.emit("playlist:add",{members:t})},clear:function(){this.queue.members=[],this.queue.plays--,function(t,e){t.playlist&&(e=t.playlist.queue=L(e),t.emit("playlist:ready",{queue:e,should_play:!1}))}(e,this.queue)}}}function F(t){const e=y(t,"flowplayer-skip-previous-icon");O(e,"role","button"),P(e,"click",(function(){t.playlist&&t.playlist.prev()}));const n=y(t,"flowplayer-skip-next-icon");O(n,"role","button"),P(n,"click",(function(){t.playlist&&t.playlist.next()}));const i=T("fp-playlist-prev-preview"),s=T("fp-playlist-next-preview"),l=q(t,"flowplayer-control-buttons");return l&&(l.prepend(e),l.append(n),l.append(i),l.append(s)),t.on("reap",(function(){t.skip_controls=void 0})),t.on(["playlist:next","playlist:add","playlist:remove"],(function(e){const n=f(e,"data.queue",f(t,"playlist.queue"));if(!n||!l||!t.skip_controls)return;N(l,"is-prev-button-disabled",!n.idx),N(l,"is-next-button-disabled",n.idx===n.last_idx);const a=n.idx<n.last_idx?function(t){if(!b(t)||0!=(t.mode&v.LOOP))return t.members[E(t)]}(n):null,o=n.idx>0?function(t){if(0!==t.idx||0!=(t.mode&v.LOOP))return t.members[function(t){const e=t.idx-1;return e<0?t.last_idx:e}(t)]}(n):null;s.style.backgroundImage=["url(",a?a.poster:null,")"].join(""),i.style.backgroundImage=["url(",o?o.poster:null,")"].join("")})),{prevButton:e,nextButton:n,prevPreview:i,nextPreview:s}}function M(t,e){if(!e)return;!1!==e.skip_controls&&(t.skip_controls=F(t));const n=function(t){let e=null;if(n=t.controls,!o(n)&&!c(n))return;var n;c(t.controls)?e=t.controls:o(t.controls)&&(e=document.querySelector(t.controls));return i("Could not find controls by Selector["+t.controls+"]",c(e)),e}(e);if(!n)return;const s=y(t,"flowplayer-playlist-controls");n.append(s)}function j(t,e,n){if(Array.isArray(e))return n(function(t,e){let n=e.shuffle?v.SHUFFLE:v.FIFO;return e.loop&&(n|=v.LOOP),x(t,{mode:n,sort:e.sort})}(e,t));throw new Error("config.playlist must be an Array")}function H(t){var e;t.on("playlist:ready",(function(e){var n,i;const s=t.opt("playlist",{}),l=null===(n=e.detail)||void 0===n?void 0:n.queue,a=null===(i=e.detail)||void 0===i?void 0:i.should_play;l&&s&&(t.playlist=S(t,l),a&&k(t,l,s))})),t.on("ended",(e=()=>{const e=t.opt("playlist");if(t.playlist&&e)return b(t.playlist.queue)?function(t,e){if(t.emit("playlist:ended"),!e.loop)return;if(!t.playlist)return;const n=t.playlist.queue=L(t.playlist.queue);if(t.emit("playlist:loop"),!e.shuffle)return k(t,n,e);t.emit("playlist:ready",{queue:n,should_play:!0})}(t,e):void(!1!==e.advance&&k(t,t.playlist.queue,e))},t=>{setTimeout((function(){if(!t.defaultPrevented&&!t.prevented)return e(t)}),0)})),t.on(["playing","waiting","seeking","src"],(function(){if(!t.root.classList.contains("is-interstitial"))return;const e=q(t,"flowplayer-playlist-interstitial");e&&A(e,"interstitial/cancel")}))}var D;const R=((D=class Playlist{constructor(t){m(t,"flowplayer-playlist-controls",FlowplayerPlaylistControls),m(t,"flowplayer-playlist-interstitial",class extends UpNext{constructor(t){super(t),this.classList.add("fp-interstitial")}}),m(t,"flowplayer-skip-next-icon",class extends FlowplayerIcon{constructor(t){super(t,e)}}),m(t,"flowplayer-skip-previous-icon",class extends FlowplayerIcon{constructor(t){super(t,n)}})}init(t,e,n){const i=t.playlist||{};i.delay="number"==typeof i.delay?i.delay:5,n.setOpts(Object.assign(Object.assign({},t),{playlist:i})),M(n,t.playlist),function(t){var e;const n=y(t,"flowplayer-playlist-interstitial");n.addEventListener("interstitial/cancel",()=>t.root.classList.remove("is-interstitial")),n.addEventListener("interstitial/end",()=>{var e;t.root.classList.remove("is-interstitial");const n=null===(e=t.playlist)||void 0===e?void 0:e.queue;n&&C(t,w(n,!1))}),null===(e=q(t,"flowplayer-ui"))||void 0===e||e.prepend(n)}(n),H(n)}onload(t,e,n,i){j(t.playlist||{},i.items,(function(t){n.setState("is-playlist",!0),n.emit("playlist:ready",{queue:t,should_play:0===n.currentSrc.length})}))}wants(t,e,n){return"flowplayer/playlist"==e.type&&!!e.items&&u(Object.assign(Object.assign({},n),{playlist:e.items}))}}).pluginName="playlist",D.events=t,D);return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;return"function"==typeof n?(n(e),e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e),e)}(window,R)}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=t.flowplayer||{},t.flowplayer.playlist=e())}(this,function(){"use strict";const t="is-interstitial",e="playlist:next",n="playlist:ended",s="playlist:ready",i="playlist:loop",l="playlist:add",o="playlist:remove",a="interstitial/end",r="interstitial/cancel",c="interstitial/next_item";var u=Object.freeze({__proto__:null,PLAYLIST_NEXT:e,PLAYLIST_ENDED:n,PLAYLIST_READY:s,PLAYLIST_PREVIOUS:"playlist:previous",PLAYLIST_SELECTION:"playlist:selection",PLAYLIST_LOOP:i,PLAYLIST_ADD:l,PLAYLIST_REMOVE:o,INTERSTITIAL_END:a,INTERSTITIAL_CANCEL:r,INTERSTITIAL_NEXT_ITEM:c});const p={translation_key:"core.skip-next",name:"fp-skip-next"},d={translation_key:"core.skip-prev",name:"fp-skip-prev"};class Pipe{static of(t){return new Pipe(t)}static maybe(t,e,...n){return null==t?t:e.apply(t,[t,...n])}constructor(t){this.data=t}tap(t,...e){return t.apply(this,[this.data,...e]),new Pipe(this.data)}fmap(t,...e){const n=t.apply(this,[this.data,...e]);return new Pipe(n)}unwrap(){return this.data}}function y(t,e){if(!e)throw new Error(t)}function m(t){return"invalid playlist configuration\ndetails: "+t+"\n\tmust match Object of shape:\n"+["\t\t{ controls?: Selector|HTMLElement","player: Selector|HTMLElement","playlist: PlaylistId|Array(MediaId|PlayerConfig)","shuffle?: Boolean|false","loop?: Boolean|false","advance?: Boolean|true","delay?: Milliseconds|5000"].join("\n\t\t, ")+"\n\t\t}"}function f(t,e){Pipe.of(t).fmap(m).fmap(y,e)}function h(t){return void 0!==t}function v(t){return"string"==typeof t}function b(t){return"object"==typeof t}function E(t){return t instanceof HTMLElement}function x(t){var e;f("Config must be an Object",h(t)&&b(t)),f("property `playlist` is required",h(t.playlist)),f("property `playlist` was not a String(MediaId)",v(t.playlist)||(e=t.playlist,f("playlist property was not of type PlaylistId|Array(MediaId|PlayConfig)",Array.isArray(e)),f("playlist property cannot be an empty Array",e.length>0),!e.forEach(function(t,e){f("item at playlist["+e+"] was not valid",v(t)||b(t))}))),"loop shuffle".split(" ").forEach(function(e){h(t[e])&&f(e+" must be a boolean value if present","boolean"==typeof t[e])}),h(t.delay)&&f("property `delay` must be a Number (Milliseconds)","number"==typeof t.delay)}function g(t){try{x(t)}catch(t){return!1}return!0}class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}class FlowplayerIcon extends FlowplayerComponent{constructor(t,e){super(t),this.classList.add("fp-icon",e.name),e.title&&this.setAttribute("title",e.title),e.title&&this.setAttribute("aria-label",e.title),e.translation_key&&this.setAttribute("aria-label",t.i18n(e.translation_key)),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}const w=["title","delay","description","poster","src"];class UpNext extends FlowplayerComponent{static get observedAttributes(){return w}constructor(t){super(t),this.classList.add("up-next"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent(a))}),this.addEventListener("animationcancel",()=>{this.classList.add("cancelled"),this.dispatchEvent(new CustomEvent(r))}),this.addEventListener(c,this._setUpNext.bind(this))}getTitle(){return this.getAttribute("title")||""}getDescription(){return this.getAttribute("description")||""}getPoster(){return this.getAttribute("poster")||""}getDelay(){return this.getAttribute("delay")||""}connectedCallback(){this.isConnected&&this._render()}attributeChangedCallback(){this._render()}_render(){var t,e;this.innerHTML="",this.classList.remove("cancelled");const n=document.createDocumentFragment(),s=document.createElement("div");s.classList.add("pane","left");const i=document.createElement("div");i.classList.add("pane","right"),n.append(s,i);const l=document.createElement("div");l.classList.add("poster"),l.style.backgroundImage="url("+this.getPoster()+")",s.append(l),l.addEventListener("click",()=>this.dispatchEvent(new CustomEvent(a)));const o=document.createElement("span");o.classList.add("fp-icon","fp-play"),l.append(o);const r=document.createElement("span");r.classList.add("title"),r.textContent=this.getTitle();const c=document.createElement("span");c.classList.add("description"),c.textContent=this.getDescription();const u=document.createElement("span");u.classList.add("countdown"),this.getDelay()&&(u.style.setProperty("--up-next-delay",this.getDelay()+"s"),u.classList.add("go"));const p=document.createElement("span");p.classList.add("cancel"),p.textContent=null!==(e=null===(t=this.player)||void 0===t?void 0:t.i18n("playlist.cancel"))&&void 0!==e?e:"cancel",p.addEventListener("click",()=>u.classList.remove("go")),i.append(r,c,p,u),this.append(n)}_setUpNext(t){var e,n,s;const i=t.detail.next,l=this.player.opt("playlist.delay",void 0)||10;this.setAttribute("title",null!==(e=i.title)&&void 0!==e?e:""),this.setAttribute("description",null!==(n=i.description)&&void 0!==n?n:""),this.setAttribute("poster",null!==(s=i.poster)&&void 0!==s?s:""),this.setAttribute("delay",l+"")}}const L=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const s=window.customElements.get(e);if(!s)throw new Error(`no default flowplayer component with the name ${e} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(t._customElements,e))(t),A=(t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)};function _(t,e,n){const s=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;s.length;){if(null==t)return n;const e=s.shift();if("string"!=typeof e)return n;t=t[e]}return null==t?n:t}function P(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}const I="flowplayer-playlist-interstitial",q="flowplayer-skip-next-icon",O="flowplayer-skip-previous-icon",N="flowplayer-playlist-controls";class FlowplayerPlaylistControls extends FlowplayerComponent{constructor(t){super(t),this.playlistWrapper=document.createElement("ol"),this.className="fp-playlist-controls is-empty use-play-1",this.header=this.controlsHeader(t),this.append(this.header,this.playlistWrapper),t.on(s,e=>{const n=e.detail.queue;n&&(this.list(n,t),this.classList.toggle("is-empty",!n.members.length))}),t.on(e,()=>{var e;(null===(e=t.playlist)||void 0===e?void 0:e.queue)&&Array.from(this.querySelectorAll("li")).forEach((e,n)=>{var s;const i=n===(null===(s=t.playlist)||void 0===s?void 0:s.queue.idx);e.classList.toggle("is-current",i),e.setAttribute("aria-current",""+i)})}),t.on(l,e=>{var n;const s=null===(n=t.playlist)||void 0===n?void 0:n.queue;if(!e.data||!s)return;e.data.members.forEach(e=>{const n=this.videoRow(e,t);n&&this.playlistWrapper.append(n)})}),t.on(o,t=>{if(!t.data)return;const e=Array.from(this.querySelectorAll("li"))[t.data.index];e&&this.playlistWrapper.removeChild(e)})}list(t,e){this.playlistWrapper.innerHTML="",t.members.forEach(t=>{const n=this.videoRow(t,e);n&&this.playlistWrapper.append(n)})}videoRow(t,e){const n=document.createElement("li");return n.onclick=this.videoRow_onclick.bind(this,n,e),n.setAttribute("tabindex","0"),n.append(this.item(e,t)),n}item(t,e){const n=document.createElement("div");n.className="fp-playlist-controls-item";const s=this.itemHeader(t,e),i=this.itemContent(e);return n.append(s,i),n}itemContent(t){var e,n;const s=document.createElement("div");s.className="fp-playlist-controls-item-content";const i=document.createElement("div");i.className="fp-playlist-controls-item-title",i.textContent=t.title||(null===(e=t.metadata)||void 0===e?void 0:e.title)||"";const l=document.createElement("div");return l.className="fp-playlist-controls-item-desc",l.textContent=t.description||(null===(n=t.metadata)||void 0===n?void 0:n.description)||"",s.append(i,l),s}itemHeader(t,e){var n,s;const i=document.createElement("div");i.className="fp-playlist-controls-item-header";const l=document.createElement("img");l.alt=e.title||(null===(n=e.metadata)||void 0===n?void 0:n.title)||"",l.className="fp-playlist-controls-image",l.src=e.poster||"";const o=document.createElement("div");o.className="fp-playlist-controls-playing";const a=new(window.customElements.get("flowplayer-play-icon"))(t);a.ariaHidden="true",a.tabIndex=-1;const r=document.createElement("span");r.textContent=t.i18n("playlist.now_playing","Now playing"),o.append(a,r),i.append(l,o);const c=e.duration||(null===(s=e.metadata)||void 0===s?void 0:s.duration);if(void 0!==c){const t=document.createElement("span");t.className="fp-playlist-controls-duration",t.textContent=isFinite(c)?function(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const n=Math.floor(t/3600);let s=Math.floor(t/60);return t-=60*s,n>=1?(s-=60*n,e+n+":"+P(s)+":"+P(t)):e+P(s)+":"+P(t)}(c):"",i.append(t)}return i}controlsHeader(t){const e=document.createElement("div");e.className="fp-playlist-controls-header";const n=document.createElement("h3");n.id="title",n.className="fp-playlist-title",n.textContent="Playlist";const i=document.createElement("input");i.type="checkbox",i.className="fp-playlist-toggle-input",i.id="toggle";const l=document.createElement("label");l.className="fp-playlist-toggle-label",l.tabIndex=0,l.setAttribute("role","button"),l.setAttribute("for","toggle");const o=document.createElement("span");o.className="fp-playlist-toggle-title",o.textContent=t.i18n("playlist.autoplay","Autoplay");const a=document.createElement("div");return a.className="fp-playlist-toggle",a.append(o,i,l),l.addEventListener("click",e=>{e.preventDefault();const n=!i.checked;i.checked=n;const s=t.opts;s.playlist||(s.playlist={}),Object.assign(s.playlist,{advance:n}),l.ariaPressed=n+"",l.ariaLabel=n?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay")}),t.on(s,()=>{var e,s;const o=t.opts,a=null===(e=null==o?void 0:o.playlist)||void 0===e?void 0:e.advance;i.checked=!1!==a,l.ariaPressed=`${!1!==a}`,l.ariaLabel=!1!==a?t.i18n("playlist.turn_off_autoplay","Turn off autoplay"):t.i18n("playlist.autoplay","Autoplay"),n.textContent=(null===(s=o.playlist)||void 0===s?void 0:s.playlist_title)||t.i18n("playlist.playlist","Playlist")}),e.append(n,a),e}videoRow_onclick(t,e){var n;if(t.classList.contains("is-current"))return;const s=Array.from(this.querySelectorAll("li")).indexOf(t);-1!==s&&(null===(n=e.playlist)||void 0===n||n.play(s))}}const T="click",C="canplay";var S;function k(t,e){var n,s;const i=e.sort||H,l=null!==(n=e.mode)&&void 0!==n?n:S.FIFO;return t=i(t.slice(0),l),{mode:l,sort:i,members:t,last_idx:t.length-1,plays:null!==(s=e.plays)&&void 0!==s?s:0,idx:-1}}function F(t){return t.idx==t.last_idx}function M(t){const e=t.idx+1;return e>t.last_idx?0:e}function j(t,e,n){return t.idx=e&&"number"==typeof n&&n>=0&&n<=t.last_idx?n:t.idx+1,t.members[t.idx]}function H(t,e){return(e&S.SHUFFLE)==S.SHUFFLE?t.sort(function(){return Math.random()-Math.random()}):t.slice(0)}function D(t){return k(t.members,{mode:t.mode,plays:t.plays+1,sort:t.sort})}!function(t){t[t.SHUFFLE=1]="SHUFFLE",t[t.FIFO=2]="FIFO",t[t.LOOP=4]="LOOP"}(S||(S={})),function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}}();const R=["touchstart","touchmove"];function U(t,e,n){const s=function(t,e){const n=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(n,"data",{get:()=>e}),n}(e,n);return t.dispatchEvent(s),t}function Y(t,e,n,s){Array.isArray(e)?e.forEach(e=>W(t,e,n,s)):W(t,e,n,s)}function W(t,e,n,s){if(i=e,!~R.indexOf(i))return t.addEventListener(e,n,s),t;var i;const l=Object.assign(s||{},{passive:!0});return t.addEventListener(e,n,l),t}function B(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}function X(t,e,n){return t.setAttribute(e,n),t}function $(t,e,n){return e.split(" ").forEach(e=>t.classList.toggle(e,n)),t}function V(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}function z(e,n,s){const i=n.idx+n.plays<0;if(!i&&s.delay)return function(e,n){var s;const i=null===(s=e.playlist)||void 0===s?void 0:s.queue,l=B(e,I);if(!l||!i||!n.delay)return;e.root.classList.add(t);const o=i.members[M(i)];U(l,c,{next:o})}(e,s);G(e,j(n,i,s.start_index),i)}function G(t,n,s){s||(t.preload=n.preload="auto",!t.opts.autoplay&&t.setOpts({autoplay:1})),t.emit("playlist/advance"),"object"==typeof n&&t.setOpts(n),function(t,n){var s;const i=null===(s=t.playlist)||void 0===s?void 0:s.queue;if(!i)return;const l=i.idx,o=i.members[l],a=t.currentSrc;if(o.src&&t.setSrc(o.src),t.emit(e,{next_index:l}),t.opts.autoplay||n)return;const r=n=>{(n.type===C&&a!==t.currentSrc||n.type===e)&&(t.removeEventListener(C,r),t.removeEventListener(e,r),n.type===C&&t.togglePlay(!0))};t.on([C,e],r)}(t,s)}function J(e,n){return{queue:n,events:u,play:function(t){t<0||t>=n.members.length||(this.queue.idx=t,G(e,n.members[t]))},next:function(){this.queue.idx!==this.queue.last_idx&&this.play(this.queue.idx+1)},prev:function(){this.queue.idx&&this.play(this.queue.idx-1)},remove:function(t){const n=this.queue;return n.members[t]?n.idx===t?console.warn("operation failed: you cannot remove current playlist item"):(n.members.splice(t,1),n.last_idx=n.members.length-1,t<n.idx&&--n.idx,void e.emit(o,{index:t})):console.warn("there is no playlist item at this index")},push:function(...n){const s=e.root;if(0==this.queue.idx&&s.classList.contains(t))return console.warn("new items cannot be added when playlist has ended.");const i=this.queue.members;i.push(...n),this.queue.last_idx=i.length-1,e.emit(l,{members:n})},clear:function(){this.queue.members=[],this.queue.plays--,function(t,e){t.playlist&&(e=t.playlist.queue=D(e),t.emit(s,{queue:e,should_play:!1}))}(e,this.queue)}}}function K(t){const n=L(t,O);X(n,"role","button"),Y(n,T,function(){t.playlist&&t.playlist.prev()});const s=L(t,q);X(s,"role","button"),Y(s,T,function(){t.playlist&&t.playlist.next()});const i=V("fp-playlist-prev-preview"),a=V("fp-playlist-next-preview"),r=B(t,"flowplayer-control-buttons");return r&&(r.prepend(n),r.append(s),r.append(i),r.append(a)),t.on("reap",function(){t.skip_controls=void 0}),t.on([e,l,o],function(e){const n=_(e,"data.queue",_(t,"playlist.queue"));if(!n||!r||!t.skip_controls)return;$(r,"is-prev-button-disabled",!n.idx),$(r,"is-next-button-disabled",n.idx===n.last_idx);const s=n.idx<n.last_idx?function(t){if(!F(t)||0!==(t.mode&S.LOOP))return t.members[M(t)]}(n):null,l=n.idx>0?function(t){if(0!==t.idx||0!==(t.mode&S.LOOP))return t.members[function(t){const e=t.idx-1;return e<0?t.last_idx:e}(t)]}(n):null;a.style.backgroundImage=["url(",s?s.poster:null,")"].join(""),i.style.backgroundImage=["url(",l?l.poster:null,")"].join("")}),{prevButton:n,nextButton:s,prevPreview:i,nextPreview:a}}function Q(t,e){if(!e)return;!1!==e.skip_controls&&(t.skip_controls=K(t));const n=function(t){let e=null;if(n=t.controls,!v(n)&&!E(n))return;var n;E(t.controls)?e=t.controls:v(t.controls)&&(e=document.querySelector(t.controls));return y("Could not find controls by Selector["+t.controls+"]",E(e)),e}(e);if(!n)return;const s=L(t,N);n.append(s)}function Z(t,e,n){if(Array.isArray(e))return n(function(t,e){let n=e.shuffle?S.SHUFFLE:S.FIFO;return e.loop&&(n|=S.LOOP),k(t,{mode:n,sort:e.sort})}(e,t));throw new Error("config.playlist must be an Array")}function tt(e){var l;e.on(s,function(t){var n,s;const i=e.opt("playlist",{}),l=null===(n=t.detail)||void 0===n?void 0:n.queue,o=null===(s=t.detail)||void 0===s?void 0:s.should_play;l&&i&&(e.playlist=J(e,l),o&&z(e,l,i))}),e.on("ended",(l=()=>{const t=e.opt("playlist");if(e.playlist&&t)return F(e.playlist.queue)?function(t,e){if(t.emit(n),!e.loop)return;if(!t.playlist)return;const l=t.playlist.queue=D(t.playlist.queue);if(t.emit(i),!e.shuffle)return z(t,l,e);t.emit(s,{queue:l,should_play:!0})}(e,t):void(!1!==t.advance&&z(e,e.playlist.queue,t))},t=>{setTimeout(function(){if(!t.defaultPrevented&&!t.prevented)return l(t)},0)})),e.on(["playing","waiting","seeking","src"],function(){if(!e.root.classList.contains(t))return;const n=B(e,I);n&&U(n,r)})}var et;const nt=(et=class Playlist{constructor(t){A(t,N,FlowplayerPlaylistControls),A(t,I,class extends UpNext{constructor(t){super(t),this.classList.add("fp-interstitial")}}),A(t,q,class extends FlowplayerIcon{constructor(t){super(t,p)}}),A(t,O,class extends FlowplayerIcon{constructor(t){super(t,d)}})}init(e,n,s){const i=e.playlist||{};i.delay="number"==typeof i.delay?i.delay:5,s.setOpts(Object.assign(Object.assign({},e),{playlist:i})),Q(s,e.playlist),function(e){var n;const s=L(e,I);s.addEventListener(r,()=>e.root.classList.remove(t)),s.addEventListener(a,()=>{var n;e.root.classList.remove(t);const s=null===(n=e.playlist)||void 0===n?void 0:n.queue;s&&G(e,j(s,!1))}),null===(n=B(e,"flowplayer-ui"))||void 0===n||n.prepend(s)}(s),tt(s)}onload(t,e,n,i){Z(t.playlist||{},i.items,function(t){n.setState("is-playlist",!0),n.emit(s,{queue:t,should_play:0===n.currentSrc.length})})}wants(t,e,n){return"flowplayer/playlist"==e.type&&!!e.items&&g(Object.assign(Object.assign({},n),{playlist:e.items}))}},et.pluginName="playlist",et.events=u,et);return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;return"function"==typeof n?(n(e),e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e),e)}(window,nt)});
|
package/plugins/preview.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BitrateInfo } from 'dashjs';
|
|
2
1
|
import type { Get } from 'type-fest';
|
|
3
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Representation } from 'dashjs';
|
|
4
4
|
import type { TupleToUnion } from 'type-fest';
|
|
5
5
|
|
|
6
6
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1548,7 +1548,7 @@ PROGRESS = "progress";
|
|
|
1548
1548
|
*/
|
|
1549
1549
|
declare type QselOption = (Level & {
|
|
1550
1550
|
level: number;
|
|
1551
|
-
}) |
|
|
1551
|
+
}) | Representation | {
|
|
1552
1552
|
name: string | number;
|
|
1553
1553
|
encodingId: string;
|
|
1554
1554
|
spatialLayerId: number;
|
|
@@ -1596,8 +1596,8 @@ QUALITY_CHANGE = "qualitychange";
|
|
|
1596
1596
|
* @public
|
|
1597
1597
|
*/
|
|
1598
1598
|
declare type QualityChangeEventDetail = {
|
|
1599
|
-
before?: Level |
|
|
1600
|
-
after?: Level |
|
|
1599
|
+
before?: Level | Representation;
|
|
1600
|
+
after?: Level | Representation;
|
|
1601
1601
|
plugin: string;
|
|
1602
1602
|
automatic: boolean;
|
|
1603
1603
|
/* Excluded from this release type: downscale */
|
package/plugins/preview.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.preview=i())}(this,
|
|
1
|
+
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.preview=i())}(this,function(){"use strict";var e=Object.freeze({__proto__:null,MOUSEOVER:1,MOBILE_VIEWPORT_VISIBLE:2,VIEWPORT_VISIBLE:4});class PreviewPlugin{init(e,i,t){t.on("config",({detail:e})=>{e&&JSON.stringify(this.preview_config)!==JSON.stringify(e.preview)&&this.configure(e)}),this.root=i,this.player=t,this.configure(e)}configure(e){var i,t;if(null===(i=this.preview)||void 0===i||i.remove(),!e.preview||!e.poster)return;this.preview_config=Object.assign({},e.preview),this.createPreview(e.preview.src);const r=e.preview.trigger||3;(4&r||function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,i=e?navigator.userAgent:"",t=/iP(hone|od)/i.test(i)&&!/iPad/.test(i)&&!/IEMobile/i.test(i),r=/Android/.test(i)&&!/Firefox/.test(i),n=/^((?!chrome|android).)*safari/i.test(i),o=/chrome|crios/i.test(i)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(i),s=/firefox|fxios/i.test(i)&&!/seamonkey/i.test(i),a=/edg/i.test(i),d=/opr|opera/i.test(i),u=/SamsungBrowser/.test(i),l=u&&/SMART-TV/.test(i);return{controls:!t,video:function(i){return e&&document.createElement("video").canPlayType(i)},lang:e&&window.navigator.language,android:r,iphone:t,safari:n,edge:a,opera:d,chrome:o,firefox:s,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:u,samsung_tv:u&&l,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}}().touch&&2&r)&&(null===(t=this.preview)||void 0===t||t.classList.add("in-viewport"))}createPreview(e){var i;if(!this.root||0===(null==e?void 0:e.length))return;if(this.preview=document.createElement("img"),this.preview.classList.add("fp-preview"),this.player&&(null===(i=function(e,i){const t=e._customElements.get(i);return t&&e.root.querySelector(t)||void 0}(this.player,"flowplayer-ui"))||void 0===i||i.prepend(this.preview)),!Array.isArray(e))return this.preview.setAttribute("src",e);const t=this.root.clientWidth;this.preview.src=e.reduce((e,i)=>i.dimensions&&e.dimensions&&Math.abs(i.dimensions.width-t)<Math.abs(e.dimensions.width-t)?i:e).src}}PreviewPlugin.pluginName="preview",PreviewPlugin.trigger=e;return function(e,i){if("object"==typeof exports&&"undefined"!=typeof module)return i;if(null===document.currentScript)return i;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;return"function"==typeof t?(t(i),i):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(i)||t.extensions.push(i),i)}(window,PreviewPlugin)});
|