@flowplayer/player 2.9.11 → 3.0.1-canary.11
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 +2 -2
- package/default.js +2 -2
- package/embed.js +360 -3
- package/flowplayer.css +1 -1
- package/index.d.ts +80 -68
- package/package.json +4 -13
- package/plugins/ads.js +2 -2
- package/plugins/airplay.js +1 -1
- package/plugins/analytics.js +1 -1
- package/plugins/asel.js +1 -1
- package/plugins/audio.js +1 -1
- package/plugins/chapters.js +1 -0
- package/plugins/chromecast.js +2 -2
- package/plugins/context-menu.js +1 -1
- package/plugins/cuepoints.js +1 -1
- package/plugins/dash.js +2 -18
- package/plugins/drm.js +1 -1
- package/plugins/endscreen.js +1 -1
- package/plugins/fas.js +1 -1
- package/plugins/float-on-scroll.js +1 -1
- package/plugins/gemius.js +1 -1
- package/plugins/google-analytics.js +1 -1
- package/plugins/health.js +1 -1
- package/plugins/hls.js +357 -15
- package/plugins/id3.js +1 -1
- package/plugins/iframe.js +1 -1
- package/plugins/keyboard.js +1 -1
- package/plugins/media-session.js +1 -1
- package/plugins/message.js +1 -1
- package/plugins/ovp.js +15 -1
- package/plugins/playlist.js +1 -1
- package/plugins/preview.js +1 -0
- package/plugins/qsel.js +1 -1
- package/plugins/qul.js +1 -1
- package/plugins/share.js +1 -1
- package/plugins/speed.js +1 -1
- package/plugins/subtitles.js +1 -1
- package/plugins/thumbnails.js +1 -1
- package/contracts/google-analytics.json +0 -21
- package/core/events.d.ts +0 -12
- package/core/events.js +0 -9
- package/plugins/comscore.js +0 -1
- package/plugins/debug.js +0 -1
- package/plugins/flashls.js +0 -15
- package/plugins/i18n.js +0 -1
- package/plugins/mux.js +0 -1
- package/plugins/subtitles-html.js +0 -1
- package/util/loader.d.ts +0 -8
- package/util/loader.js +0 -43
package/plugins/id3.js
CHANGED
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
function n(e,n,t,o){return new(t||(t=Promise))((function(i,f){function r(e){try{u(o.next(e))}catch(e){f(e)}}function a(e){try{u(o.throw(e))}catch(e){f(e)}}function u(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,a)}u((o=o.apply(e,n||[])).next())}))}
|
|
16
|
+
function n(e,n,t,o){return new(t||(t=Promise))((function(i,f){function r(e){try{u(o.next(e))}catch(e){f(e)}}function a(e){try{u(o.throw(e))}catch(e){f(e)}}function u(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,a)}u((o=o.apply(e,n||[])).next())}))}class t{init(e,t,o){o.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label?function(e,t){t.addEventListener("cuechange",()=>n(this,void 0,void 0,(function*(){Array.from(t.activeCues||[]).forEach(t=>n(this,void 0,void 0,(function*(){(function(e){return"object"==typeof e.value&&"string"==typeof e.value.info&&"string"==typeof e.value.key&&"object"==typeof e.value.data})(t)&&e.emit("ID3",{cue:t})})))})))}(o,e):void 0})}}return t.events=e,function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)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,t),t}));
|
package/plugins/iframe.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.iframe=n())}(this,(function(){"use strict";
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.iframe=n())}(this,(function(){"use strict";class e{constructor(n){e.ATTACHED||(e.ATTACHED=!0,window.addEventListener("message",(function(t){if(!e.is_flowplayer_message(t.data))return;const o=n.instances||[],s=o[0];if(!s)return;o.length>1&&console.warn("Multiple player instances in iframe. Messaging supported with first instance only.");switch(e.message_body(t.data)){case"pause":return s.togglePlay(!1);case"play":return s.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()})))}))}}return 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)},function(){try{return window.self!==window.top}catch(e){return!0}}()&&function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)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,e),e}));
|
package/plugins/keyboard.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.keyboard=t())}(this,(function(){"use strict";function e(e,t,n){const i=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;i.length;){if(null==e)return n;const t=i.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n: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.keyboard=t())}(this,(function(){"use strict";function e(e,t,n){const i=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;i.length;){if(null==e)return n;const t=i.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}function t(e,t,n){const i=function(e,t){const n=new Event(e);return t&&Object.assign(n,{data:t}),n}(t,n);return e.dispatchEvent(i),e}!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();var n={TAB:9,ENTER:13,ESCAPE:27,SPACE:32,ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40,F:70,H:72,J:74,K:75,L:76,M:77};let i=void 0;function o(e){e.setState("is-kb-active",!0),clearTimeout(i),i=setTimeout((function(){e.setState("is-kb-active",!1)}),2500)}function r(e,t){e.enqueueSeek(t)&&o(e)}let s=void 0;const u=[n.ARROW_UP,n.ARROW_RIGHT,n.ARROW_LEFT,n.ARROW_DOWN],a=[n.SPACE,n.F,n.ESCAPE,n.M,n.ARROW_UP,n.ARROW_DOWN,n.ARROW_RIGHT,n.ARROW_LEFT,n.H,n.J,n.K,n.L];function c(e,t){e.volume=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.volume+t,1,0),o(e)}function f(e,t){return!(t.altKey||t.shiftKey||t.metaKey||t.ctrlKey)&&(!!(e&&e.in_viewport&&e.started)&&(!!e.root&&(function(e){let t=document.activeElement;for(;t;){if(t===e)return!0;t=t.parentElement}return!1}(e.root)||document.activeElement===document.body)))}function l(e){e.preventDefault(),e.stopPropagation()}function R(e,t){return!!d(e,t)}function d(e,t){return!!e.parentElement&&(e.parentElement.matches(t)?e.parentElement:R(e.parentElement,t))}document.addEventListener("keydown",(function(i){setTimeout((function(){i.defaultPrevented||function(i){const o=i.which,p=s,A=e(p,"opts.keyboard.seek_step",5),E=document.activeElement;if(!E)return;if(!p)return;if((o===n.SPACE||o===n.ENTER)&&E.hasAttribute("tabindex")&&R(E,".flowplayer"))return E.dispatchEvent(new MouseEvent("click",{bubbles:!0})),l(i);if(~u.indexOf(o)&&E.hasAttribute("aria-valuenow")){const e=~[n.ARROW_UP,n.ARROW_RIGHT].indexOf(o);if(E.matches(".fp-volume"))return c(p,e?.15:-.15),l(i);if(E.matches(".fp-timeline"))return r(p,e?A:-1*A),l(i)}if((o===n.ARROW_DOWN||o===n.ARROW_UP||o===n.ESCAPE)&&R(E,".fp-menu"))return i.preventDefault(),o===n.ARROW_DOWN&&E.nextSibling&&E.nextSibling.focus(),o===n.ARROW_UP&&E.previousSibling&&E.nextSibling.focus(),void(o===n.ESCAPE&&t(p.root,"menu:toggle:open",{open:!1,menu:d(E,".fp-menu")}));if(o===n.TAB){const e=window.flowplayer;e&&Array.isArray(e.instances)&&e.instances.forEach((function(e){e.setState("is-hovered",!0),e.setState("is-accessibility",!0)}))}if(!f(p,i))return;const m=!p.hasState("no-timeline");switch(~a.indexOf(o)&&i.preventDefault(),o){case n.SPACE:return p.togglePlay();case n.F:return p.toggleFullScreen();case n.ESCAPE:return p.toggleFullScreen(!1);case n.M:return p.toggleMute();case n.ARROW_UP:case n.K:return c(p,.15);case n.ARROW_DOWN:case n.J:return c(p,-.15);case n.ARROW_RIGHT:case n.L:return m&&r(p,A);case n.ARROW_LEFT:case n.H:m&&r(p,-1*A)}}(i)}),0)}));class p{init(e,t,n){n.on(["loadstart","playing","fullscreenenter"],(function(){s=n}))}}return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,p),p}));
|
package/plugins/media-session.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.media_session=t())}(this,(function(){"use strict";let e=void 0;function t(t,n){t.enqueueSeek(n)&&function(t){t.setState("is-kb-active",!0),clearTimeout(e),e=setTimeout((function(){t.setState("is-kb-active",!1)}),2500)}(t)}const n="pause",i="playing",o="seeked";var a="playlist:next";let s=void 0;function l(e){e.data&&r(e.data)}function r(e){var t,n,i;const o=null!==(t=e.media_session)&&void 0!==t?t:{};if(null!==(n=o.title)&&void 0!==n||(o.title=e.title),null==o.artwork){const t=null!==(i=e.poster)&&void 0!==i?i:"";o.artwork=[{src:t,sizes:"512x512"},{src:t,sizes:"256x256"}]}navigator.mediaSession.metadata=new MediaMetadata(o)}function c(){const e=navigator.mediaSession;if(null==e.setPositionState)return;const t=s;t&&(e.setPositionState({duration:Math.round(t.duration||0),playbackRate:t.hasState("is-playing")?t.playbackRate:.001,position:Math.round(t.currentTime)}),e.playbackState=t.hasState("is-playing")?"playing":"paused")}function u(e){const n=s,i=navigator.mediaSession;if(n){if(i.setActionHandler("play",(function(){n.togglePlay()})),i.setActionHandler("pause",(function(){n.togglePlay()})),"playlist"in n){const e=n.playlist;i.setActionHandler("nexttrack",(function(){e&&e.next()})),i.setActionHandler("previoustrack",(function(){e&&e.prev()}))}!function(e,n){var i,o;if(null!==(i=n.seekable)&&void 0!==i&&!i||e.hasState("no-timeline"))return;const a=navigator.mediaSession,s=null!==(o=n.seek_step)&&void 0!==o?o:5;e.disabled||a.setActionHandler("seekforward",(function(){t(e,s)}));a.setActionHandler("seekbackward",(function(){t(e,-s)}));try{a.setActionHandler("seekto",(function(t){"number"==typeof t.seekTime&&(t.seekTime>e.currentTime&&e.disabled?c():t&&t.seekTime<e.duration&&(e.currentTime=t.seekTime))}))}catch(e){}}(n,e)}}class d{init(e,t,d){null!=navigator.mediaSession&&d.on(["loadstart",i,"fullscreenenter"],(function(){let t=s;d!==t&&(t&&(["ratechange",o,i,n].forEach(e=>{t&&t.off(e,c)}),t.off(a,l),t=void 0),s=d,r(e),u(e),c(),d.on(["ratechange",o,i,n],c),d.on(a,l))}))}}return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,d),d}));
|
package/plugins/message.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.message=s())}(this,(function(){"use strict";const e=/<trans(.*)trans>/;class s{init(t,n,o){let i="";o.on("message:show",(function(s){var t,a,d;const f=null===(t=s.data)||void 0===t?void 0:t.sticky,l=null===(a=s.data)||void 0===a?void 0:a.timeout;let c=(null===(d=s.data)||void 0===d?void 0:d.message)||"";if(c==i)return;if(i=c||"",e.test(c)){const s=e.exec(c)||["",""];c=o.i18n(s[1].trim())}const u=document.createElement("div");u.classList.add("fp-message");const r=document.createElement("p");r.innerText=c,u.append(r),n.append(u),setTimeout((function(){u.classList.add("fp-shown")}),100),f||setTimeout((function(){o.emit("message:dismiss",u)}),l)})),o.on("message:dismiss",(function(e){const s=e.data;s&&(s.classList.remove("fp-shown"),setTimeout((function(){s.remove()}),1e3))})),o.message={events:s.events}}}return s.events={SHOW_MESSAGE:"message:show",DISMISS_MESSAGE:"message:dismiss"},function(e,s){if("object"==typeof exports&&"undefined"!=typeof module)return s;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;"function"==typeof t?t(s):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(s)||t.extensions.push(s))}(window,s),s}));
|
package/plugins/ovp.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
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.ovp=e())}(this,(function(){"use strict";const t=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),e=(...n)=>n.reduce((n,r)=>t(r)?(Object.keys(r).forEach(o=>{if(t(n[o])&&t(r[o]))return n[o]=e(n[o],r[o]);n[o]=r[o]}),n):n,{}),n=[].slice;function r(){}function o(t,e,...n){return Object.assign(t,e)}function i(...t){return t.slice(1).reduce((t,e)=>o(t,e),t[0]||{})}function a(t){return Array.isArray(t)?t.slice(0):t.split(".")}function s(t,e,n){const r=a(e);for(;r.length;){if(null==t)return n;const e=r.shift();if("string"!=typeof e)return n;t=t[e]}return null==t?n:t}function c(t,e,n){const r=(e=a(e)).pop(),o=s(t,e);return o&&r&&(o[r]=n),t}function u(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}function l(t){return"function"==typeof t}function f(){throw new Error("Function was expected as Argument[0]")}var d=[].slice;function p(t){if(!(this instanceof p))return new p(t);var e=this;return e.data=t,e.tap=function(){var t=d.call(arguments),n=t.shift();return n==p.lift?e.data:l(n)?(n.apply(e,[e.data].concat(t)),e):void f()},e.into=e.fmap=function(){var t=d.call(arguments),n=t.shift();return n==p.lift?e.data:l(n)?p(n.apply(e,[e.data].concat(t))):void f()},e.unwrap=function(){return e.data},e}p.of=p,p.lift=function(t){return t instanceof p?t.data:t},p._apply=p.apply=function(t,e){if(0==e.length)return t();if(1==e.length)return t(e[0]);if(2==e.length)return t(e[0],e[1]);if(3==e.length)return t(e[0],e[1],e[2]);if(4==e.length)return t(e[0],e[1],e[2],e[3]);if(5==e.length)return t(e[0],e[1],e[2],e[3],e[4]);throw new Error("Pipe._apply() does not support arity > 5")},p.maybe=function(t,e,n){return t?p._apply(e,[t].concat(d.call(arguments,2,arguments.length))):t},p.curry=function(t,e,n){return(e=e||[]).length>t.length-1?t.apply(n,e):function(){var r=e.concat(d.call(arguments));return p.curry(t,r,n)}};var m=[].slice,v=Array.isArray;function y(t){return t&&"object"==typeof t&&"[object RegExp]"!==Object.prototype.toString.call(t)&&"[object Date]"!==Object.prototype.toString.call(t)}function h(t,e){return t.length===t.filter(e).length}function _(){return h(m.call(arguments),v)}function g(t,e){for(var n in t)e(n,t[n])}function w(t){return y(t)?v(t)?t.map(w):E({},t):t}function b(t,e){var n={};return g(t,(function(t,e){n[t]=w(e)})),function(t,e){return g(e,(function(e,n){if(void 0===t[e])return t[e]=w(n);t[e]=E(t[e],n)})),t}(n,e)}function E(t,e){return _(t,e)?function(t){return w(t)}(t):!1===t?t:!0===t&&!1!==e||!y(t)&&y(e)?e:void 0===t||y(t)?y(t)&&!y(e)?t:function(){return h(m.call(arguments),y)}(t,e)?b(t,e):void 0:t}function O(){return[].reduce.call(arguments,(function(t,e){return E(t,e)}),_.apply(null,arguments)?[]:{})}function A(){return O.apply(null,m.call(arguments).reverse())}function j(t,e){var n=new XMLHttpRequest;n.open("GET",t,!0),n.onreadystatechange=function(){try{var t=n.status;if(n.readyState<4)return;if(200!=t&&n.readyState>3&&"function"==typeof e.err){var r={status:t};try{o(r,JSON.parse(n.responseText))}catch(r){}return e.err(r)}e.ok(JSON.parse(n.responseText))}catch(r){console.error(r),e.err(r)}},n.send()}function C(){var t=[].join.call(arguments,"/");return"/"!==t[0]&&(t="/"+t),T()+"/web/public/native/config"+t}function T(){return("undefined"!=typeof flowplayer?flowplayer:{}).OVP_API||"https://ljsp.lwcdn.com"}function S(t){return~t.indexOf("/")?t:"/media/"+t}var x={404:"media not found",402:"invalid subscription",400:"bad request",415:"unsupported media type"};function L(t,e){var n=i({},t);return e.forEach((function(t){delete n[t]})),n}var N={media_id:"id",media_duration:"duration",media_name:"title",media_tags:"tags",category:"category_name",ad_keywords:"ad_keywords"};var M=["src","metadata","title","description","duration","poster"];function P(t){var e=s(t,"ima.ads");return Array.isArray(e)&&c(t,"ima.ads",e.map((function(e){return"number"==typeof e.percentage&&(e.time=e.percentage*t.duration),e}))),t}function D(t,e){e="object"==typeof e?e:{};var n={title:s(t,"metadata.title",null),description:s(t,"metadata.description",null)};return A({ima:{parameters:function(t,e,n){for(var r in n=n||{},t)n[r]=s(e||{},t[r]);return n}(N,s(t,"metadata",{}))}},n,t,L(e,M),L(e.embed||{},["src"]))}var k=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;function I(t){return"object"==typeof t&&"ovp/base64"==t.type}function R(t,e,n){return function(t,e){return!(~t.indexOf(".")||!k.test(t))&&(e.type="video/ovp",!0)}(t,e)||I(e)}function q(t){try{return V(decodeURIComponent(atob(t).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return{err:t.message}}}function V(t){return null===t?{}:JSON.parse(t)}var U=Object.freeze({__proto__:null,base64:q,json:V});function H(t){var e=t.split(/[^0-9]/);return Date.UTC(e[0],e[1]-1,e[2],e[3],e[4],e[5])}var W=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"});function J(t,e){if(I(e))return F(t,e);p(e).fmap(s,"src").fmap(S).fmap(C).fmap(j,{ok:p.curry(z,[t]),err:p.curry(G,[t])})}function F(t,e){p(e).fmap(s,"src").fmap(p.maybe,q).fmap(p.maybe,p.curry(z,[t]))}function z(t,e){if(t.emit("ovp:media:changed",e),s(e,"playlist"))return B(t,e);if(s(e,"live"))return K(t,e);if(s(e,"src"))return Q(t,e);throw new Error("Status[200] >> unhandled case\n"+JSON.stringify(e,null,2))}function G(t,e){return e.message?t.emit("ovp:error",e):e.status?t.emit("ovp:error",new Error(x[e.status])):t.emit("ovp:error",e)}function Q(t,e){t.emit("ovp:request:media:complete",p.of(e).fmap(D,t.opts).fmap(P).fmap(p.lift))}function B(t,e){if("function"!=typeof flowplayer.playlist)return console.warn("OVP responded with Playlist media but the playlist plugin does not exist"),G(t,{status:415});var n,r,o,a;t.emit("ovp:request:playlist:complete",(n=t.opts,r=e,o=i({},n),i(a=A({},r,s(n,"playlist",{})),{playlist:s(a,"playlist",[]).map((function(t){return D(t,o)}))})))}function K(t,e){var n=s(e,"metadata.live_start_time",s(e,"metadata.starttime"));c(e,"live_start_time",p.of(n).fmap(H).fmap(p.lift)),t.emit("ovp:live:countdown:start",p.of(e).fmap(D,t.opts).fmap(P).fmap(p.lift))}var X={};function Y(t,e){if("object"==typeof X[e])return console.debug("using Cache(%s)",e),Z(t,e,X[e]);p(e).fmap(C).fmap(j,{ok:p.curry(Z,[t,e]),err:console.error})}function Z(t,e,n){"object"!=typeof X[e]&&(X[e]=n);var r=s(t,"opts",{}),o=s(r,"metadata",{});c(o,"player_id",e),["title","description"].forEach((function(t){!0===n[t]&&"string"==typeof r[t]&&c(n,t,s(r,t))})),c(r,"metadata",o);var a=i(r,n);t.setOpts(a),n.autoplay&&t.togglePlay(!0)}var $=Object.freeze({__proto__:null,fetch_unknown_media:J,handle_base64:F,handle_200:z,handle_err:G,handle_single_media:Q,handle_playlist:B,handle_live:K,fetch_player_id:Y,handle_player_only:Z}),tt=void 0;function et(t,e,n){nt()||p.of("recommendation").fmap(C,e,n).fmap(j,{err:rt,ok:p.curry(ot,[t])})}function nt(){return tt}function rt(t){tt=!0,console.error("Failed to load recommendations: %j",t)}function ot(t,e){var n=e.playlist;c(t,"opts.recommendations",n),s(n,"length",0)&&t.emit("recommendationsready",{playlist:n.map((function(t){return{poster:t.poster,src:t.src,title:s(t,"metadata.title"),metadata:t.metadata||{}}}))})}const it=!!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){}return t}()&&{passive:!0},at=["touchstart","touchmove"];function st(t){var e=t;return e.emit=function(t,n,r={}){const i=function(t){const e=document.createEvent("Event");return e.initEvent(t,!1,!0),e}(t);return n&&o(i,{data:n||{}}),e.dispatchEvent(i),!1===r.return_self?i:e},e.on=function(t,n){return"string"==typeof t&&(t=t.split(" ")),t.forEach((function(t){return function(t){return~at.indexOf(t)}(t)?e.addEventListener(t,n,it):e.addEventListener(t,n)})),e},e.off=function(t,n){return e.removeEventListener(t,n),e},e.one=e.once=function(t,n){return e.on(t,(function r(o){e.off(t,r),n(o)}))},e}const ct=Array.isArray,ut="undefined"!=typeof window&&st(window),lt="undefined"!=typeof document&&st(document),ft=["span","a","em","p","i"];function dt(t,e,n){var r=mt(document.createElement(t));if(ct(e)&&(n=e,e=!1),n||(n=[]),n&&!ct(n)&&(n=[n]),n.length&&n.filter(t=>!!t).forEach(t=>r.append(t)),"object"!=typeof e)return r;for(var o in e)o in r?r[o]=e[o]:r.setAttribute(o,e[o]);return r}function pt(t){var e=t.tagName;t.__flowplayer__=1,t.find=function(e){var n=t.querySelector(e);return n?mt(n):n},t.html=function(e){return t.innerHTML=e,t},t.empty=function(){return t.innerHTML="",t},t.offset=function(){var e={top:0,left:0},n=t;do{e.left+=n.offsetLeft||0,e.top+=n.offsetTop||0}while(n=n.offsetParent);return e},t.innerWidth=function(){var e=getComputedStyle(t);return t.clientWidth-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)};var r=t.insert=function(e,n){return n?ct(n)?n.map((function(n){return t.insert(e,n)}))[0]:mt(n="string"==typeof n?t.insertAdjacentHTML(e,n):t.insertAdjacentElement?t.insertAdjacentElement(e,n):t.appendChild(n)):n};return t.append=r.bind(t,"beforeend"),t.prepend=r.bind(t,"afterbegin"),t.css=function(e,n){return"object"==typeof e?(Object.entries(e).forEach(([e,n])=>t.css(e,n)),t):void 0===n&&"string"==typeof e?getComputedStyle(t)[e]:("number"==typeof n&&(n+="px"),t.style[e]=n,t)},t.show=function(){return t.css({display:~ft.indexOf(e)?"inline":"block"})},t.hide=function(){return t.css({display:"none"})},t.remove=function(){var e=t.parentNode;e&&e.removeChild(t)},t.attr=function(e,n){return null==n?t.getAttribute(e):(t.setAttribute(e,n),t)},t.txt=function(e){return t.textContent=e,t},t.fp=function(e){return t.addClass("fp-"+e)},t.addClass=function(e){return e.split(" ").forEach((function(e){t.hasClass(e)||(t.className+=(t.className?" ":"")+e)})),t},t.removeClass=function(e){const n=e.split(" ");var r=t.className.split(" ");return t.className=r.filter((function(t){return!~n.indexOf(t)})).join(" "),t},t.toggleClass=function(e,n){return void 0===n&&(n=!t.hasClass(e)),n?t.addClass(e):t.removeClass(e)},t.findAll=function(e){return r=t.querySelectorAll(e),n.call(r);var r},t.hasClass=function(e){return~t.className.split(" ").indexOf(e)},t}function mt(t){return void 0===t||function(t){return t&&t.__flowplayer__}(t)?t:pt(st(t))}function vt(t,e){if("string"==typeof t&&"<"==t[0])return dt(t.slice(1,-1),e);if("string"!=typeof t)return mt(t);var n=e instanceof HTMLElement&&e.querySelector(".fp-"+t)||document.querySelector(t);return n?mt(n):void 0}const yt=t=>(e,n)=>("string"==typeof e&&(e={class:e}),dt(t,e,n));function ht(t,e,n){if(!gt(t))return n.emit("ovp:request:media:complete",t);var o=e.append(vt.div({class:"fp-livecountdown"})),i=o.append(vt.div({class:"fp-inner"}));i.append(vt.p({},n._t("ovp.starting_in")));var a=i.append(vt.p({class:"fp-countdown"}));function c(t){var r=s(t,"data.remaining",-1);if(r<0||isNaN(r))return n.emit("ovp:live:countdown:complete");e.addClass("is-livecountdown"),a.txt(function(t){var e=function(t){"number"!=typeof t&&(t=parseInt(t,10)),t=Math.round(t);var e=Math.floor(t/86400);t-=86400*e;var n=Math.floor(t/3600);t-=3600*n;var r=Math.floor(t/60);return{days:e,hours:n,minutes:r,seconds:t-=60*r}}(t),n="";e.days&&(n+=e.days+":");return n+u(e.hours)+":"+u(e.minutes)+":"+u(e.seconds)}(r+1)),n.hasState("is-starting")||n.setState("is-starting",!0)}n.on("ovp:live:countdown:tick",c),n.one("ovp:live:countdown:complete",(function(){o.remove(),e.removeClass("is-livecountdown"),n.off("ovp:live:countdown:tick",c),n.emit("ovp:request:media:complete",t)})),function(t,e){var n;function o(){return t=e.live_start_time,n=s(e,"server_time_offset",0),r=Date.now()-n,Math.floor((t-r)/1e3);var t,n,r}function i(){var e=o();t.emit("ovp:live:countdown:tick",{remaining:e}),(e<0||0===t.reaper)&&clearInterval(n)}a=e,c={err:console.error,ok:r},j(T()+"/web/public/countdown/time.json",{err:c.err,ok:function(t){var e=Date.now()-t.millisUtc;c.ok(E(a,{server_time_offset:e}))}}),i(),n=setInterval(i,250);var a,c}(n,t)}function _t(t,e,n){}function gt(t){return t&&t.live_start_time-Date.now()>0}Object.assign(vt,{div:yt("div"),img:yt("img"),li:yt("li"),ol:yt("ol"),span:yt("span"),p:yt("p"),i:yt("i"),a:yt("a"),el:dt,document:lt,window:ut});function wt(t,e,n){var r="flowplayer-ovp-branding-"+e;if(!t.hasClass(r)){!function(t){if(-1==t.className.indexOf("flowplayer-ovp-branding-"))return;t.className=t.className.split(" ").filter((function(t){return-1==t.indexOf("flowplayer-ovp-branding-")})).join(" ")}(t);var o=function(t){if(document.getElementById(t))return!1;var e=document.createElement("style");return e.id=t,e.appendChild(document.createTextNode("")),document.head.appendChild(e),e.sheet}(r);o&&(!function(t,e,n,r){if("insertRule"in t)return t.insertRule(e+"{"+n+"}",r);if("addRule"in t)t.addRule(e,n,r)}(o,"."+r+" .fp-color","background-color: #"+n+";"),t.addClass(r))}}class bt{constructor(t){this.manualDisconnect=!1,this.video=t,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}static of(t){return new bt(t)}connect(t){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+t),this.current_media_id=t,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(t){JSON.parse(t.data).forEach(t=>{this.video.emit("ovp:message:realtime",t)})}reconnect(t){this.cleanup(),this.connect(t)}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())}}function Et(t,n,r,a){var c=new bt(r),u=i({},t),l=function(t){if(!u)return t;delete u.src;var n=e(t,u);return u=0,n};if(4==arguments.length&&"object"==typeof a)return"string"!=typeof t.player_id||0===a.src.indexOf(t.player_id)||I(a)||(a.src=[t.player_id,a.src].join("/")),J(r,a);r.on("ovp:error",(function(t){r.emit("error",t.data)})),r.on("ovp:request:start",(function(){r.setState("is-waiting",!0),t.recommendations&&(t.recommendations=1)})),r.on("ovp:media:changed",(function(t){if(s(t,"data.live")){var e=s(t,"data.metadata.media_id");c.disconnect(),c.connect(e)}})),r.on("ovp:message:realtime",(function(e){var n=s(e,"data.event"),i=s(e,"data.value");switch(n){case"METADATA":var a=o(t,{metadata:o(s(r,"opts.metadata",{}),i)});a.live&&s(a,"metadata.live_start_time")&&(a.live_start_time=H(a.metadata.live_start_time)),r.setOpts(a)}})),r.on("beforeplay",(function(e){Ot(t)||e.preventDefault()})),r.on("ovp:request:media:complete",(function(t){if(0!=r.reaper&&"object"==typeof t.data&&!gt(t.data)){var e=l(t.data);r.setOpts(e),r.setAttrs(e),r.setSrc(e.src),e.autoplay&&r.togglePlay(!0,(function(){setTimeout(r.setState,0,"is-seamless",!1)}))}})),r.on("config",(function(e){var o=s(e,"data.brand_color"),i=s(e,"data.metadata.player_id");if(o&&i&&wt(n,i,o),!("string"==typeof t.src&&R(t.src,{})||t.src&&t.src.length&&"ovp/base64"===t.src[0].type))return"string"==typeof t.player_id&&s(t,"metadata.player_id")!==t.player_id?Y(r,t.player_id):void 0})),r.on("ovp:request:playlist:complete",(function(t){if(0!=r.reaper&&"object"==typeof t.data){var e=l(t.data);flowplayer.playlist(n,e)}})),r.on("ovp:live:countdown:start",(function(e){if(0!=r.reaper&&"object"==typeof e.data){var o=l(e.data);r.setOpts(o),r.setAttrs(o),r.render("live/countdown",[t,n,r])}})),r.on("timeupdate",(function(){t.live?Ot(t)||(r.togglePlay(!1),r.emit("ended")):t.recommendations&&s(t,"metadata.media_id")&&(Array.isArray(t.recommendations)||r.currentTime/r.duration<.8||nt()||et(r,s(t,"metadata.media_id"),s(t,"metadata.player_id")))})),r.on("reap",(function(){c.disconnect()}))}function Ot(t){var e=s(t,"metadata.live_stop_time",!1);return!e||s(t,"metadata.allow_after_stop_time",!0)||H(e)>Date.now()}return Et.onumd=function(t){t.components.put("live/countdown",{onrender:ht,onremove:_t})},Et.wants=R,function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});var n=t.flowplayer;"function"==typeof n?n(e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e))}("undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o(Et,{events:W,Decode:U,Loader:$})),Et}));
|
|
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.ovp=e())}(this,(function(){"use strict";
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */const t=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),e=(...n)=>n.reduce((n,o)=>t(o)?(Object.keys(o).forEach(i=>{if(t(n[i])&&t(o[i]))return n[i]=e(n[i],o[i]);n[i]=o[i]}),n):n,{});class n{constructor(t){this.data=t}static of(t){return new n(t)}static maybe(t,e,...n){return null==t?t:e.apply(t,[t,...n])}tap(t,...e){return t.apply(this,[this.data,...e]),new n(this.data)}fmap(t,...e){const o=t.apply(this,[this.data,...e]);return new n(o)}unwrap(){return this.data}}function o(t){return fetch(t).then(t=>t.json())}function i(){let t=[].join.call(arguments,"/");return"/"!==t[0]&&(t="/"+t),a()+"/web/public/native/config"+t}const a=()=>"https://ljsp.lwcdn.com";function r(t){return~t.indexOf("/")?t:"/media/"+t}var s={404:"media not found",402:"invalid subscription",400:"bad request",415:"unsupported media type"};function l(t){const e=t.ima,n=t.duration;if(!e||!n)return t;const o=null==e?void 0:e.ads;return Array.isArray(o)&&(e.ads=o.map((function(t){return"number"==typeof t.percentage&&(t.time=t.percentage*n),t}))),t}function c(t,n){var o,i;n="object"==typeof n?n:{};const a={title:null===(o=null==t?void 0:t.metadata)||void 0===o?void 0:o.title,description:null===(i=null==t?void 0:t.metadata)||void 0===i?void 0:i.description},r={ima:{parameters:function({media_id:t,duration:e,title:n,tags:o,category_name:i,ad_keywords:a}){return{ad_keywords:a||"",media_id:t||"",category:i||"",media_name:n||"",media_tags:o||"",media_duration:e||-1}}((null==t?void 0:t.metadata)||{})}},s=n.embed||{};return delete s.src,e(r,a,t,(delete(l=n).src,delete l.metadata,delete l.title,delete l.description,delete l.duration,delete l.poster,l),s);var l}const d=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;function u(t){return"object"==typeof t&&"ovp/base64"==t.type}function p(t,e){return function(t,e){return!(~t.indexOf(".")||!d.test(t))&&(e.type="video/ovp",!0)}(t,e)||u(e)}function f(t){try{return function(t){return null===t?{}:JSON.parse(t)}(decodeURIComponent(atob(t).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return{err:t.message}}}function m(t){const e=t.split(/[^0-9]/).map(t=>parseInt(t,10));return Date.UTC(e[0],e[1]-1,e[2],e[3],e[4],e[5])}function v(t){return t.live}var y=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"});function _(t,e){const o=null==e?void 0:e.src;if(u(e))return function(t,e){const n=f(e.src||"");if(function(t){return"string"==typeof t.err}(n))return console.error(n.err);h(t,n)}(t,e);o&&n.of(o).fmap(r).fmap(i).fmap(t=>fetch(t)).fmap(e=>e.then(t=>Promise.all([t.status,t.json()])).then(([e,n])=>200==e?h(t,n):g(t,n)))}function h(t,o){return t.emit("ovp:media:changed",o),function(t){return Array.isArray(t.playlist)}(o)?function(t,n){if("function"!=typeof window.flowplayer.playlist)return console.warn("OVP responded with Playlist media but the playlist plugin does not exist"),g(t,{status:415});t.emit("ovp:request:playlist:complete",function(t,n){const o=Object.assign({},t),i=(null==t?void 0:t.playlist)||{},a=e(n,i),r=((null==a?void 0:a.playlist)||[]).map(t=>c(t,o));return Object.assign(a,{playlist:r})}(t.opts,n))}(t,o):v(o)?function(t,e){var o,i;const a=(null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.live_start_time)||(null===(i=null==e?void 0:e.metadata)||void 0===i?void 0:i.starttime);a&&(e.live_start_time=n.of(a).fmap(m).unwrap());t.emit("ovp:live:countdown:start",n.of(e).fmap(c,t.opts).fmap(l).unwrap())}(t,o):function(t,e){t.emit("ovp:request:media:complete",n.of(e).fmap(c,t.opts).fmap(l).unwrap())}(t,o)}function g(t,e){return e.message?t.emit("ovp:error",e):e.status?t.emit("ovp:error",new Error(s[e.status])):t.emit("ovp:error",e)}const w={};function b(t,e,n){"object"!=typeof w[e]&&(w[e]=n);const o=t.opts,i=(null==o?void 0:o.metadata)||{};i.player_id=e,o.metadata=i,n.title&&delete n.title,n.description&&delete n.description;const a=Object.assign(o,n);t.setOpts(a),n.autoplay&&t.togglePlay(!0)}let O=!1;function E(t,e,a){j()||n.of("recommendation").fmap(i,e,a).fmap(o).fmap(e=>e.then(e=>function(t,e){const n=e.playlist;if(t.opts.recommendations=n,!n.length)return;t.emit("recommendationsready",{playlist:n.map((function(t){var e;return{poster:t.poster,src:t.src,title:null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.title,metadata:t.metadata||{}}}))})}(t,e)).catch(A))}function j(){return O}function A(t){O=!0,console.error("Failed to load recommendations: %j",t)}class T{constructor(t){this.manualDisconnect=!1,this.video=t,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}static of(t){return new T(t)}connect(t){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+t),this.current_media_id=t,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(t){JSON.parse(t.data).forEach(t=>{this.video.emit("ovp:message:realtime",t)})}reconnect(t){this.cleanup(),this.connect(t)}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())}}class P{onload(t,e,n,o){if("string"==typeof o.src)return"string"!=typeof t.player_id||0===o.src.indexOf(t.player_id)||u(o)||(o.src=[t.player_id,o.src].join("/")),_(n,o)}wants(t,e,n){return p(t,e)}init(t,a,r){const s=new T(r);let l=Object.assign({},t);const c=function(t){if(!l)return t;delete l.src;const n=e(t,l);return l=!1,n};r.on("ovp:error",(function(t){r.emit("error",t.data)})),r.on("ovp:request:start",(function(){r.setState("is-waiting",!0),t.recommendations&&(t.recommendations=!1)})),r.on("ovp:media:changed",(function({data:t}){var e;const n=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id;(null==t?void 0:t.live)&&n&&(s.disconnect(),s.connect(n))})),r.on("ovp:message:realtime",(function({data:e}){var n;const o=null==e?void 0:e.event,i=null==e?void 0:e.value,a=r.opt("metadata",{live_start_time:""});switch(o){case"METADATA":{const e=Object.assign(a,i),o=Object.assign(t,{metadata:e});o.live&&(null===(n=null==o?void 0:o.metadata)||void 0===n?void 0:n.live_start_time)&&(o.live_start_time=m(o.metadata.live_start_time)),r.setOpts(o);break}}})),r.on("beforeplay",(function(e){const n=t;if(v(n)){if(C(n))return;e.preventDefault()}})),r.on("ovp:request:media:complete",(function(t){const e=t.data;if(!e)return;if(0==r.reaper||"object"!=typeof t.data||function(t){return t&&t.live_start_time&&t.live_start_time-Date.now()>0}(t.data))return;const n=c(e);r.setOpts(n),n.src&&r.setSrc(n.src),n.autoplay&&r.togglePlay(!0)})),r.on("config",(function({data:e}){var s;const l=null==e?void 0:e.brand_color;if(l&&function(t,e){t.style.setProperty("--fp-brand-color",e)}(a,l),!("string"==typeof t.src&&p(t.src,{})||t.src&&S(t.src)))return"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(t,e){if("object"==typeof w[e])return console.debug("using Cache(%s)",e),b(t,e,w[e]);n.of(e).fmap(i).fmap(o).fmap(n=>n.then(n=>b(t,e,n)).catch(console.error))}(r,t.player_id):void 0})),r.on("ovp:request:playlist:complete",(function(t){const e=t.data;if(!e||0==r.reaper)return;const{playlist:n}=e,o=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(n[o[i]]=t[o[i]])}return n}(e,["playlist"]),i=c({playlist:o});r.setOpts(i);const a={type:"flowplayer/playlist",items:n};r.setSrc(a)})),r.on("ovp:live:countdown:start",(function(e){const n=e.data;if(!n||0==r.reaper)return;const o=c(n);r.setOpts(o),r.render("live/countdown",[t,a,r])})),r.on("timeupdate",(function(){var e,n,o;const i=t;v(i)?C(i)||(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||j()||(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.media_id)&&(null===(o=null==t?void 0:t.metadata)||void 0===o?void 0:o.player_id)&&E(r,t.metadata.media_id,t.metadata.player_id))})),r.on("reap",(function(){s.disconnect()}))}}function C(t){var e,n;const o=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.live_stop_time;if(!o)return;return(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.allow_after_stop_time)?void 0:m(o)>Date.now()}P.events=y;const S=t=>{var e;if(t&&Array.isArray(t))return"object"==typeof t[0]&&"ovp/base64"===(null===(e=t[0])||void 0===e?void 0:e.type)};return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;"function"==typeof n?n(e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e))}(window,P),P}));
|
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";const t=[].slice;function e(t,e,n){const r=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;r.length;){if(null==t)return n;const e=r.shift();if("string"!=typeof e)return n;t=t[e]}return null==t?n:t}const n=!!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){}return t}()&&{passive:!0},r=["touchstart","touchmove"];function i(t){var e=t;return e.emit=function(t,n,r={}){const i=function(t){const e=document.createEvent("Event");return e.initEvent(t,!1,!0),e}(t);var o,a;return n&&(o=i,a={data:n||{}},Object.assign(o,a)),e.dispatchEvent(i),!1===r.return_self?i:e},e.on=function(t,i){return"string"==typeof t&&(t=t.split(" ")),t.forEach((function(t){return function(t){return~r.indexOf(t)}(t)?e.addEventListener(t,i,n):e.addEventListener(t,i)})),e},e.off=function(t,n){return e.removeEventListener(t,n),e},e.one=e.once=function(t,n){return e.on(t,(function r(i){e.off(t,r),n(i)}))},e}const o=Array.isArray,a="undefined"!=typeof window&&i(window),s="undefined"!=typeof document&&i(document),l=["span","a","em","p","i"];function u(t,e,n){var r=f(document.createElement(t));if(o(e)&&(n=e,e=!1),n||(n=[]),n&&!o(n)&&(n=[n]),n.length&&n.filter(t=>!!t).forEach(t=>r.append(t)),"object"!=typeof e)return r;for(var i in e)i in r?r[i]=e[i]:r.setAttribute(i,e[i]);return r}function c(e){var n=e.tagName;e.__flowplayer__=1,e.find=function(t){var n=e.querySelector(t);return n?f(n):n},e.html=function(t){return e.innerHTML=t,e},e.empty=function(){return e.innerHTML="",e},e.offset=function(){var t={top:0,left:0},n=e;do{t.left+=n.offsetLeft||0,t.top+=n.offsetTop||0}while(n=n.offsetParent);return t},e.innerWidth=function(){var t=getComputedStyle(e);return e.clientWidth-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)};var r=e.insert=function(t,n){return n?o(n)?n.map((function(n){return e.insert(t,n)}))[0]:f(n="string"==typeof n?e.insertAdjacentHTML(t,n):e.insertAdjacentElement?e.insertAdjacentElement(t,n):e.appendChild(n)):n};return e.append=r.bind(e,"beforeend"),e.prepend=r.bind(e,"afterbegin"),e.css=function(t,n){return"object"==typeof t?(Object.entries(t).forEach(([t,n])=>e.css(t,n)),e):void 0===n&&"string"==typeof t?getComputedStyle(e)[t]:("number"==typeof n&&(n+="px"),e.style[t]=n,e)},e.show=function(){return e.css({display:~l.indexOf(n)?"inline":"block"})},e.hide=function(){return e.css({display:"none"})},e.remove=function(){var t=e.parentNode;t&&t.removeChild(e)},e.attr=function(t,n){return null==n?e.getAttribute(t):(e.setAttribute(t,n),e)},e.txt=function(t){return e.textContent=t,e},e.fp=function(t){return e.addClass("fp-"+t)},e.addClass=function(t){return t.split(" ").forEach((function(t){e.hasClass(t)||(e.className+=(e.className?" ":"")+t)})),e},e.removeClass=function(t){const n=t.split(" ");var r=e.className.split(" ");return e.className=r.filter((function(t){return!~n.indexOf(t)})).join(" "),e},e.toggleClass=function(t,n){return void 0===n&&(n=!e.hasClass(t)),n?e.addClass(t):e.removeClass(t)},e.findAll=function(n){return r=e.querySelectorAll(n),t.call(r);var r},e.hasClass=function(t){return~e.className.split(" ").indexOf(t)},e}function f(t){return void 0===t||function(t){return t&&t.__flowplayer__}(t)?t:c(i(t))}function p(t,e){if("string"==typeof t&&"<"==t[0])return u(t.slice(1,-1),e);if("string"!=typeof t)return f(t);var n=e instanceof HTMLElement&&e.querySelector(".fp-"+t)||document.querySelector(t);return n?f(n):void 0}const d=t=>(e,n)=>("string"==typeof e&&(e={class:e}),u(t,e,n));function y(t,e){if(1!=!!e)throw new Error(t)}function m(t,e){this.mode=e.mode,this.sort=e.sort||m._sort,this.members=this.sort(t.slice(0),e.mode),this.last_idx=this.members.length-1,this.plays=e.plays||0,this.idx=-1}Object.assign(p,{div:d("div"),img:d("img"),li:d("li"),ol:d("ol"),span:d("span"),p:d("p"),i:d("i"),a:d("a"),el:u,document:s,window:a});var v=m.modes={SHUFFLE:1,FIFO:2,LOOP:4};m.is_ended=function(t){return t.idx==t.last_idx},m.reduce=function(t,e,n){return t.members.reduce.apply(t.members,[].slice.call(arguments,1,arguments.length))},m.map=function(t,e){return t.members.map.apply(t.members,[].slice.call(arguments,1,arguments.length))},m.next_video=function(t){if(!m.is_ended(t)||0!=(t.mode&v.LOOP))return t.members[m.next_id(t)]},m.prev_video=function(t){if(0!==t.idx||0!=(t.mode&v.LOOP))return t.members[m.prev_id(t)]},m.current_video=function(t){return-1==t.idx?t.members[0]:t.members[t.idx]},m.next_id=function(t){var e=t.idx+1;return e>t.last_idx?0:e},m.prev_id=function(t){var e=t.idx-1;return e<0?t.last_idx:e},m.lpop=function(t){return++t.idx,t.members[t.idx]},m._sort=function(t,e){return(e&v.SHUFFLE)==v.SHUFFLE?t.sort((function(){return Math.random()-Math.random()})):t.slice(0)},m.reset=function(t){return new m(t.members,{mode:t.mode,plays:t.plays+1,sort:t.sort})},m.of=function(t,e){var n=e.shuffle?v.SHUFFLE:v.FIFO;return e.loop&&(n|=v.LOOP),new m(t,{mode:n,sort:e.sort})};var h={PLAYLIST_NEXT:"playlist:next",PLAYLIST_PREVIOUS:"playlist:previous",PLAYLIST_LOOP:"playlist:loop",PLAYLIST_ENDED:"playlist:ended",PLAYLIST_READY:"playlist:ready",PLAYLIST_INTERSTITIAL:"playlist:interstitial",PLAYLIST_INTERSTITIAL_END:"playlist:interstitial_end"};function _(t){return"function"==typeof t}function g(){throw new Error("Function was expected as Argument[0]")}var b=[].slice;function w(t){if(!(this instanceof w))return new w(t);var e=this;return e.data=t,e.tap=function(){var t=b.call(arguments),n=t.shift();return n==w.lift?e.data:_(n)?(n.apply(e,[e.data].concat(t)),e):void g()},e.into=e.fmap=function(){var t=b.call(arguments),n=t.shift();return n==w.lift?e.data:_(n)?w(n.apply(e,[e.data].concat(t))):void g()},e.unwrap=function(){return e.data},e}function L(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 x(t,e){w.of(t).fmap(L).fmap(y,e)}function A(t){return void 0!==t}function T(t){return"string"==typeof t}function E(t){return"object"==typeof t}function I(t){try{return t instanceof HTMLElement}catch(e){return E(t)&&E(t.style)&&E(t.ownerDocument)}}function S(t){var e;x("Config must be an Object",A(t)&&E(t)),x("property `playlist` is required",A(t.playlist)),x("property `playlist` was not a String(MediaId)",T(t.playlist)||(e=t.playlist,x("playlist property was not of type PlaylistId|Array(MediaId|PlayConfig)",Array.isArray(e)),x("playlist property cannot be an empty Array",e.length>0),!e.forEach((function(t,e){x("item at playlist["+e+"] was not valid",T(t)||E(t))})))),"loop shuffle".split(" ").forEach((function(e){A(t[e])&&x(e+" must be a boolean value if present","boolean"==typeof t[e])})),A(t.delay)&&x("property `delay` must be a Number (Milliseconds)","number"==typeof t.delay)}function P(t,e,n){var r=m.lpop(e),i=e.idx+e.plays<1;return q(t,r,n),i&&n.autoplay?t.togglePlay(!0):i?t.setState("is-starting",!0):!i&&n.advance?O(t,n,(function(){t.paused&&(t.setState("is-seamless",!0),t.togglePlay(!0))})):void t.emit(h.PLAYLIST_INTERSTITIAL,{config:n})}function q(t,n,r){"object"==typeof n&&t.setOpts(n),function(t,n,r){if(t.setSrc(T(n)||n.type?n:n.src),t.emit(h.PLAYLIST_NEXT,n),e(r,"should_play",!1))t.togglePlay(!0)}(t,n,r)}function k(t,e){e=t.playlist.queue=m.reset(e),t.emit(h.PLAYLIST_READY,{queue:e,should_play:!1})}function O(t,e,n){var r=setTimeout(n,e.delay||0);e.delay>0&&t.emit(h.PLAYLIST_INTERSTITIAL,{timer:r,config:e})}function N(t,e,n){if(e[t])return(n=n||[]).unshift(p.span({innerText:e[t]})),p.div({class:t},n)}w.of=w,w.lift=function(t){return t instanceof w?t.data:t},w._apply=w.apply=function(t,e){if(0==e.length)return t();if(1==e.length)return t(e[0]);if(2==e.length)return t(e[0],e[1]);if(3==e.length)return t(e[0],e[1],e[2]);if(4==e.length)return t(e[0],e[1],e[2],e[3]);if(5==e.length)return t(e[0],e[1],e[2],e[3],e[4]);throw new Error("Pipe._apply() does not support arity > 5")},w.maybe=function(t,e,n){return t?w._apply(e,[t].concat(b.call(arguments,2,arguments.length))):t},w.curry=function(t,e,n){return(e=e||[]).length>t.length-1?t.apply(n,e):function(){var r=e.concat(b.call(arguments));return w.curry(t,r,n)}};var Y={coords:"0 0 41 42",link:"#fp-skip-next",translation_key:"core.skip-next",name:"fp-skip-next"},C={coords:"0 0 41 42",link:"#fp-skip-prev",translation_key:"core.skip-prev",name:"fp-skip-prev"};function j(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function D(t){var e,n,r=j("svg");return r.setAttribute("viewBox",t.coords),t.name&&r.setAttribute("class",t.name),t.title&&r.setAttribute("title",t.title),t.title&&r.setAttribute("aria-label",t.title),r.setAttribute("tabindex","0"),r.setAttribute("focusable","true"),r.appendChild((e=t.link,(n=j("use")).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e),n)),p(r)}function F(t,n,r){p(t),t.addClass("fp-playlist-controls "+(r.theme||"fp-dark")),n.setState("is-playlist",!0);var i=n.root.className.split(" ").filter((function(t){return t.match(/^use-play/)})).pop();if(i&&t.addClass(i),n.on([h.PLAYLIST_NEXT,"playing","pause",h.PLAYLIST_READY],(function(r){var i=e(r,"data.queue",e(n,"playlist.queue"));if(i&&(new M(t,i,n),n.root.controls.btns.toggleClass("is-prev-button-disabled",!i.idx),n.root.controls.btns.toggleClass("is-next-button-disabled",i.idx===i.last_idx),n.skip_controls)){var o=i.idx<i.last_idx?m.next_video(i):null,a=i.idx>0?m.prev_video(i):null;n.skip_controls.nextPreview.style.backgroundImage=["url(",o?o.poster:null,")"].join(""),n.skip_controls.prevPreview.style.backgroundImage=["url(",a?a.poster:null,")"].join("")}})),r.skip_controls&&!n.skip_controls){var o=function(t){var e=D(C).attr("role","button");e.on("click",(function(){t.playlist.prev()}));var n=D(Y).attr("role","button");n.on("click",(function(){t.playlist.next()}));var r=p.div("fp-playlist-prev-preview"),i=p.div("fp-playlist-next-preview");return t.root.controls.btns.prepend(e),t.root.controls.btns.append(n),t.root.controls.btns.append(r),t.root.controls.btns.append(i),{prevButton:e,nextButton:n,prevPreview:r,nextPreview:i}}(n);n.reaper.put("skip_controls",o),n.on("reap",(function(){for(var t in o)o[t]=0}))}}function M(t,e,n){t.empty();var r=t.append(p.ol("fp-playlist"));m.map(e,(function(t,i){var o=R(t,e,n,i);o&&r.append(o)}))}function R(t,e,n,r){if(t.title){var i={class:r==e.idx?"is-current "+function(t){return t.paused?"is-paused":"is-playing"}(n):"is-queued",onclick:R.onclick.bind(null,t,e,n,r)};return p.li(i,[p.div("fp-color"),H(t),B(t,n)])}}function H(t){return p.div("video-info",[N("title",t),N("description",t)])}function B(t,e){var n=p.div("video-buttons",e.root.ui.findAll(".fp-switch").map((function(t){return p(t.cloneNode(!0)).removeClass("fp-switch")})));return t.poster&&(n.style.backgroundImage=["url(",t.poster,")"].join("")),n}R.onclick=function(t,e,n,r){return e.idx!=r||n.paused?e.idx==r&&n.paused?n.play():(e.idx=r,void q(n,t,{should_play:!0})):n.pause()};function U(t){return Math.min(100*t,100)+"%"}function X(t,e){var n=p.div("fp-interstitial"),r=t.root.ui.find(".fp-middle");r.append(n),t.on(h.PLAYLIST_INTERSTITIAL,(function(i){var o=i.data;t.setState("is-interstitial",!0);var a=m.current_video(t.playlist.queue);a&&(n.empty().append(X.Innards(t,a,r,o)),e.advance&&X.animate_countdown(t,o,n.querySelector(".countdown")))})),t.on("src playing waiting",(function(){t.emit(h.PLAYLIST_INTERSTITIAL_END)})),t.on(h.PLAYLIST_INTERSTITIAL_END,(function(){t.setState("is-interstitial",!1)}))}X.animate_countdown=function(t,e,n){if(!n)throw new Error("no element to animate was passed");var r=e.config.delay,i=Date.now()+r,o=Date.now(),a=Math.ceil(1e3/60);!function s(){var l=Date.now();if(!(l>i)&&t.paused){if(!e.timer)return n.css({width:U(0)});requestAnimationFrame(s),l-o<a||(o=l,n.css({width:U(1-(i-l)/r)}))}}()},X.Innards=function(t,e,n,r){var i=p.div("left",n.findAll(".fp-switch").map((function(t){return p(t.cloneNode(!0)).removeClass("fp-switch")})));return e.poster&&(i.style.backgroundImage=["url(",e.poster,")"].join("")),[i,p.div("right",[p.div("up-next",[p.span().txt(t._t("playlist.up_next")),p.div("fp-color countdown")]),N("title",e),N("description",e),r.timer&&p.div({class:"cancel",onclick:function(t){return clearTimeout(r.timer),r.timer=0,p(t.target).remove(),t.preventDefault(),!1}},[p.span().txt(t._t("playlist.cancel"))])])]};var V=["playlist","controls","shuffle","loop","advance","delay","player","skip_controls"],W=["src"];function Q(t){S(t)}function z(t,e){var n=this;n.queue=e,n.play=function(e){n.queue.idx=e,q(t,m.current_video(n.queue),{should_play:!0})},n.next=function(){n.queue.idx!==n.queue.last_idx&&n.play(n.queue.idx+1)},n.prev=function(){n.queue.idx&&n.play(n.queue.idx-1)},n.remove=function(e){n.queue.members[e]&&(n.queue.members.splice(e,1),n.queue.plays--,k(t,n.queue))},n.push=function(e){n.queue.members=n.queue.members.concat(e),n.queue.plays--,k(t,n.queue)},n.clear=function(){n.queue.members=[],n.queue.plays--,k(t,n.queue)}}function G(t,e){e.delay="delay"in e?e.delay:1e4,Q(e);const n=function(t){var e={};for(var n in W.forEach((function(e){e in t&&(console.warn(new Error("unsupported attribute: "+e+" found on the top-level config")),delete t[e])})),t)~V.indexOf(n)||(e[n]=t[n]);return e}(e);e=function(t,e){var n={};for(var r in t)V.indexOf(r)<0||(n[r]=t[r]);for(r in e)V.indexOf(r)<0||(n[r]=e[r]);return n}((t=flowplayer(t,n)).opts,e),new X(t,e);var r=G.make_controls(t,e);return G.attach_events(t,r,e),G.fetch(e,(function(e){t.emit(h.PLAYLIST_READY,{queue:e,should_play:0===t.currentSrc.length})})),t}return G.make_controls=function(t,e){var n=G.cast_controls(e);if(n)return p(n),new F(n,t,e),n},G.cast_controls=function(t){var e,n;if(T(n=t.controls)||I(n))return I(t.controls)?e=t.controls:T(t.controls)&&(e=document.querySelector(t.controls)),y("Count not find controls by Selector["+t.controls+"]",I(e)),e},G.fetch=function(t,e){if(Array.isArray(t.playlist))return e(m.of(t.playlist,t));throw new Error("config.playlist must be an Array")},G.attach_events=function(t,e,n){t.on(h.PLAYLIST_READY,(function(e){var r=e.data.queue,i=e.data.should_play;t.reaper.put("playlist",new z(t,r)),i&&P(t,r,n)})),t.on("ended",(function(e){setTimeout((function(){if(!e.defaultPrevented)return m.is_ended(t.playlist.queue)?function(t,e){t.emit(h.PLAYLIST_ENDED),e.loop&&(t.playlist.queue=m.reset(t.playlist.queue),t.emit(h.PLAYLIST_LOOP),O(t,e,(function(){t.emit(h.PLAYLIST_READY,{queue:t.playlist.queue,should_play:!0})})))}(t,n):void(0!=n.advance&&P(t,t.playlist.queue,n))}),0)}))},G.events=h,G.VideoQueue=m,G}));
|
|
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";function t(t,e){if(!e)throw new Error(t)}var e;function n(t,n){var i,o;const s=n.sort||r,l=null!==(i=n.mode)&&void 0!==i?i:e.FIFO;return t=s(t.slice(0),l),{mode:l,sort:s,members:t,last_idx:t.length-1,plays:null!==(o=n.plays)&&void 0!==o?o:0,idx:-1}}function i(t){return t.idx==t.last_idx}function o(t){return-1==t.idx?t.members[0]:t.members[t.idx]}function r(t,n){return(n&e.SHUFFLE)==e.SHUFFLE?t.sort((function(){return Math.random()-Math.random()})):t.slice(0)}function s(t){return n(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"}(e||(e={}));var l={PLAYLIST_NEXT:"playlist:next",PLAYLIST_PREVIOUS:"playlist:previous",PLAYLIST_LOOP:"playlist:loop",PLAYLIST_ENDED:"playlist:ended",PLAYLIST_READY:"playlist:ready",PLAYLIST_INTERSTITIAL:"playlist:interstitial",PLAYLIST_INTERSTITIAL_END:"playlist:interstitial_end"};function a(t,e,n){const i=function(t){return++t.idx,t.members[t.idx]}(e),o=e.idx+e.plays<1;return function(t,e,n){"object"==typeof e&&t.setOpts(e);u(t,e,{should_play:n.should_play})}(t,i,n),o&&n.autoplay?t.togglePlay(!0):o?t.setState("is-starting",!0):!o&&n.advance?p(t,n,(function(){t.paused&&(t.setState("is-seamless",!0),t.togglePlay(!0))})):void t.emit(l.PLAYLIST_INTERSTITIAL,{config:n})}function u(t,e,n){var i;if(e.src&&t.setSrc(e.src),t.emit(l.PLAYLIST_NEXT,e),null!==(i=n.should_play)&&void 0!==i&&i)return t.togglePlay(!0)}function c(t,e){t.playlist&&(e=t.playlist.queue=s(e),t.emit(l.PLAYLIST_READY,{queue:e,should_play:!1}))}function p(t,e,n){var i;const o=setTimeout(n,e.delay||0);null!==(i=e.delay)&&void 0!==i&&i&&t.emit(l.PLAYLIST_INTERSTITIAL,{timer:o,config: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 d(t){return t.innerHTML="",t}function y(t,e){const n=t.style;return Object.keys(e).forEach(t=>n[t]=e[t]),t}function m(t,e,n){return t.setAttribute(e,n),t}function h(t,e){return t.classList.add(...e.split(" ")),t}function L(t,e,n){return e.split(" ").forEach(e=>t.classList.toggle(e,n)),t}function v(t,e){return Array.from(t.querySelectorAll(e))}function b(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}!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 x=["touchstart","touchmove"];function A(t,e,n,i){Array.isArray(e)?e.forEach(e=>E(t,e,n,i)):E(t,e,n,i)}function E(t,e,n,i){if(o=e,!~x.indexOf(o))return t.addEventListener(e,n,i),t;var o;const r=Object.assign(i||{},{passive:!0});return t.addEventListener(e,n,r),t}const T={translation_key:"core.skip-next",name:"fp-skip-next"},I={translation_key:"core.skip-prev",name:"fp-skip-prev"};function _(t){const e=document.createElement("div");return e.setAttribute("class",t.name),t.title&&e.setAttribute("title",t.title),t.title&&e.setAttribute("aria-label",t.title),e.setAttribute("tabindex","0"),e.setAttribute("focusable","true"),e}function S(t,e){if(!e[t])return;const n=document.createElement("span");n.innerText=e[t];const i=b(t);return i.append(n),i}function g(t,n){const o=n.opt("playlist",{});h(t,"fp-playlist-controls "+(o.theme||"fp-dark")),n.setState("is-playlist",!0);const r=n.root.className.split(" ").filter((function(t){return t.match(/^use-play/)})).pop();if(r&&h(t,r),n.on([l.PLAYLIST_NEXT,"playing","pause",l.PLAYLIST_READY],(function(o){const r=f(o,"data.queue",f(n,"playlist.queue"));if(r){!function(t,e,n){d(t);const i=document.createElement("ol");h(i,"fp-playlist"),t.append(i),e.members.forEach((t,o)=>{const r=function(t,e,n,i){if(!t.title)return;const o=i==e.idx?"is-current "+function(t){return t.paused?"is-paused":"is-playing"}(n):"is-queued",r=document.createElement("li");return h(r,o),r.onclick=P.bind(null,t,e,n,i),function(t,e){t.append(...e)}(r,[b("fp-color"),w(t),q(t,n)]),r}(t,e,n,o);r&&i.append(r)})}(t,r,n);const o=n.root.querySelector(".fp-btns");if(o&&(L(o,"is-prev-button-disabled",!r.idx),L(o,"is-next-button-disabled",r.idx===r.last_idx)),n.skip_controls){const t=r.idx<r.last_idx?function(t){if(!i(t)||0!=(t.mode&e.LOOP))return t.members[function(t){const e=t.idx+1;return e>t.last_idx?0:e}(t)]}(r):null,o=r.idx>0?function(t){if(0!==t.idx||0!=(t.mode&e.LOOP))return t.members[function(t){const e=t.idx-1;return e<0?t.last_idx:e}(t)]}(r):null;n.skip_controls.nextPreview.style.backgroundImage=["url(",t?t.poster:null,")"].join(""),n.skip_controls.prevPreview.style.backgroundImage=["url(",o?o.poster:null,")"].join("")}}})),o.skip_controls&&!n.skip_controls){const t=function(t){const e=_(I);m(e,"role","button"),A(e,"click",(function(){t.playlist&&t.playlist.prev()}));const n=_(T);m(n,"role","button"),A(n,"click",(function(){t.playlist&&t.playlist.next()}));const i=b("fp-playlist-prev-preview"),o=b("fp-playlist-next-preview"),r=t.root.querySelector(".fp-btns");r&&(r.prepend(e),r.append(n),r.append(i),r.append(o));return{prevButton:e,nextButton:n,prevPreview:i,nextPreview:o}}(n);n.skip_controls=t,n.on("reap",(function(){n.skip_controls=void 0}))}}function P(t,e,n,i){return e.idx!=i||n.paused?e.idx==i&&n.paused?n.play():(e.idx=i,void u(n,t,{should_play:!0})):n.pause()}function w(t){const e=b("video-info"),n=S("title",t);n&&e.append(n);const i=S("description",t);return i&&e.append(i),e}function q(t,e){const n=b("video-buttons"),i=e.reaper&&e.reaper.get("ui");return i&&v(i,".fp-switch").forEach(t=>{Array.from(t.children).forEach(t=>{n.append(t.cloneNode())})}),t.poster&&(n.style.backgroundImage=["url(",t.poster,")"].join("")),n}function O(t){return Math.min(100*t,100)+"%"}function Y(t){const e=b("fp-interstitial"),n=t.root.querySelector(".fp-middle");n&&n.append(e),t.on(l.PLAYLIST_INTERSTITIAL,(function(i){const r=i.data;t.setState("is-interstitial",!0);const s=t.playlist&&o(t.playlist.queue);if(!s)return;r&&n&&e.append(...function(t,e,n,i){const o=b("left");v(n,".fp-play").forEach(t=>o.append(t.cloneNode())),e.poster&&(o.style.backgroundImage=["url(",e.poster,")"].join(""));const r=b("right"),s=b("up-next"),l=document.createElement("span");l.innerText=t.i18n("playlist.up_next");const a=b("fp-color","countdown");s.append(l,a),r.append(s);const u=S("title",e);u&&r.append(u);const c=S("description",e);if(c&&r.append(c),i.timer){const e=b("cancel");e.onclick=function(t){return i.timer&&clearTimeout(i.timer),i.timer=void 0,t.target.remove(),t.preventDefault(),!1};const n=document.createElement("span");n.innerText=t.i18n("playlist.cancel"),e.append(n),r.append(e)}return[o,r]}(t,s,n,r)),t.once("play",t=>{d(e)});t.opt("playlist",{}).advance&&r&&function(t,e,n){var i;if(!n)throw new Error("no element to animate was passed");const o=null!==(i=e.config.delay)&&void 0!==i?i:0,r=Date.now()+o;let s=Date.now();const l=Math.ceil(1e3/60);!function i(){const a=Date.now();if(a>r||!t.paused)return;if(!e.timer)return y(n,{width:O(0)});requestAnimationFrame(i),a-s<l||(s=a,y(n,{width:O(1-(r-a)/o)}))}()}(t,r,e.querySelector(".countdown"))})),t.on(["src","playing","waiting"],(function(){t.emit(l.PLAYLIST_INTERSTITIAL_END)})),t.on(l.PLAYLIST_INTERSTITIAL_END,(function(){t.setState("is-interstitial",!1)}))}class k{constructor(t){this.data=t}static of(t){return new k(t)}static maybe(t,e,...n){return null==t?t:e.apply(t,[t,...n])}tap(t,...e){return t.apply(this,[this.data,...e]),new k(this.data)}fmap(t,...e){const n=t.apply(this,[this.data,...e]);return new k(n)}unwrap(){return this.data}}function j(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(e,n){k.of(e).fmap(j).fmap(t,n)}function N(t){return void 0!==t}function D(t){return"string"==typeof t}function R(t){return"object"==typeof t}function M(t){return t instanceof HTMLElement}function H(t){var e;F("Config must be an Object",N(t)&&R(t)),F("property `playlist` is required",N(t.playlist)),F("property `playlist` was not a String(MediaId)",D(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",D(t)||R(t))})))),"loop shuffle".split(" ").forEach((function(e){N(t[e])&&F(e+" must be a boolean value if present","boolean"==typeof t[e])})),N(t.delay)&&F("property `delay` must be a Number (Milliseconds)","number"==typeof t.delay)}const U=["playlist","controls","shuffle","loop","advance","delay","player","skip_controls"];function B(t){try{H(t)}catch(t){return!1}return!0}function C(t,e){const n={};return Object.keys(t).forEach(e=>{U.indexOf(e)<0||(n[e]=t[e])}),e&&Object.keys(e).forEach(t=>{U.indexOf(t)<0||(n[t]=e[t])}),n}class X{init(e,n,r){const f=C(e,e.playlist);f.delay="number"==typeof f.delay?f.delay:1e4,r.setOpts(Object.assign(Object.assign({},e),{playlist:f})),Y(r),function(e){const n=function(e){let n=null;if(i=e.controls,!D(i)&&!M(i))return;var i;M(e.controls)?n=e.controls:D(e.controls)&&(n=document.querySelector(e.controls));return t("Count not find controls by Selector["+e.controls+"]",M(n)),n}(e.opt("playlist",{}));if(!n)return;g(n,e)}(r),function(t){t.on(l.PLAYLIST_READY,(function(e){var n,i;const r=t.opt("playlist",{}),s=null===(n=e.data)||void 0===n?void 0:n.queue,p=null===(i=e.data)||void 0===i?void 0:i.should_play;s&&r&&(t.playlist=function(t,e){return{queue:e,events:l,play:function(e){this.queue.idx=e,u(t,o(this.queue),{should_play:!0})},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(e){this.queue.members[e]&&(this.queue.members.splice(e,1),this.queue.plays--,c(t,this.queue))},push:function(e){this.queue.members=this.queue.members.concat(e),this.queue.plays--,c(t,this.queue)},clear:function(){this.queue.members=[],this.queue.plays--,c(t,this.queue)}}}(t,s),p&&a(t,s,r))})),t.on("ended",(function(e){setTimeout((function(){const n=t.opt("playlist");if(!e.defaultPrevented&&t.playlist&&n)return i(t.playlist.queue)?function(t,e){if(t.emit(l.PLAYLIST_ENDED),!e.loop)return;if(!t.playlist)return;const n=t.playlist.queue=s(t.playlist.queue);t.emit(l.PLAYLIST_LOOP),p(t,e,()=>t.emit(l.PLAYLIST_READY,{queue:n,should_play:!0}))}(t,n):void(0!=n.advance&&a(t,t.playlist.queue,n))}),0)}))}(r)}onload(t,i,o,r){!function(t,i,o){if(Array.isArray(i))return o(function(t,i){let o=i.shuffle?e.SHUFFLE:e.FIFO;return i.loop&&(o|=e.LOOP),n(t,{mode:o,sort:i.sort})}(i,t));throw new Error("config.playlist must be an Array")}(C(o.opts,t.playlist),r.items,(function(t){o.emit(l.PLAYLIST_READY,{queue:t,should_play:0===o.currentSrc.length})}))}wants(t,e,n){return"flowplayer/playlist"==e.type&&!!e.items&&B(Object.assign(Object.assign({},n),{playlist:e.items}))}}return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;"function"==typeof n?n(e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e))}(window,X),X}));
|
|
@@ -0,0 +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.preview=t())}(this,(function(){"use strict";const e=1;var t=Object.freeze({__proto__:null,MOUSEOVER:e});class o{constructor(){this.mouseLeave=this.mouseLeave.bind(this),this.mouseEnter=this.mouseEnter.bind(this)}init(e,t,o){o.on("config",({data:e})=>{e&&this.configure(e)}),this.configure(e),this.root=t}configure(t){var o,i;if(!1===t.preview||!t.poster)return this.shutdown();if(void 0===t.preview)return;this.shutdown(),this.config=t;const{type:s="image/gif",trigger:n=e,src:r}=t.preview;if(!/^image/.test(s))return console.warn("flowplayer[preview] - only image/* supported");this.previewSource=r,e&n&&(null===(o=this.root)||void 0===o||o.addEventListener("mouseenter",this.mouseEnter),null===(i=this.root)||void 0===i||i.addEventListener("mouseleave",this.mouseLeave))}shutdown(){var e,t;null===(e=this.root)||void 0===e||e.removeEventListener("mouseenter",this.mouseEnter),null===(t=this.root)||void 0===t||t.removeEventListener("mouseleave",this.mouseLeave)}mouseEnter(){this.root&&(this.root.style.backgroundImage=`url('${this.previewSource}')`)}mouseLeave(){this.root&&this.config&&(this.root.style.backgroundImage=`url('${this.config.poster}')`)}}return o.trigger=t,function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)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,o)}));
|
package/plugins/qsel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t
|
|
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.qsel=t())}(this,(function(){"use strict";function e(...e){return e.slice(1).reduce((e,t)=>{return n=e,i=t,Object.assign(n,i);var n,i},e[0]||{})}function t(e,t,n){const i=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;i.length;){if(null==e)return n;const t=i.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}function n(e){const t=document.createElement("div");return t.setAttribute("class",e.name),e.title&&t.setAttribute("title",e.title),e.title&&t.setAttribute("aria-label",e.title),t.setAttribute("tabindex","0"),t.setAttribute("focusable","true"),t}const i="fp-on",o="fp-invis";function s(e,t){const i=document.createElement("details"),s=document.createElement("summary"),c=document.createElement("ol"),l=document.createElement("div"),u=document.createElement("span");if(i.classList.add("fp-menu-container",o,t.class),i.setAttribute("aria-controls",t.id||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)),i.setAttribute("aria-label",t.menuTitle||""),t.summaryTitle&&(s.textContent=t.summaryTitle),t.summaryIcon){const e=n(t.summaryIcon);e.setAttribute("tabindex",""),s.append(e)}if(t.menuTitle){const e=document.createElement("h3");e.textContent=t.menuTitle,l.append(e)}return t.icons&&l.classList.add("fp-icons"),l.classList.add("fp-menu"),l.append(u),l.append(c),u.classList.add("fp-close"),u.innerHTML="×",i.append(s),i.append(l),i.addEventListener("click",(function(t){t.preventDefault(),!this.open&&document.active_menu&&a(),document.active_menu=this.open?void 0:this,this.open=!this.open,e.classList.toggle("has-menu-opened",this.open)})),t.options&&r(i,t.options),i}function r(e,t){const n=e.querySelector("ol");n&&(n.innerHTML="",t&&t.forEach(c,n),e.classList.toggle(o,0==(null==t?void 0:t.length)),l(n))}function c(e,t){const i=document.createElement("li");i.setAttribute("tabindex","0"),i.setAttribute("role","menuitem"),e.icon&&i.append(e.icon instanceof HTMLElement?e.icon:n(e.icon));const o=document.createElement("span");o.textContent=e.text,i.append(o),i.addEventListener("click",n=>{!function(e,t,n){void 0===e.idx||e.idx!==t||n?e.idx=t:delete e.idx;l(e)}(this,t),"function"==typeof e.onclick&&e.onclick(n,e,t,this)}),i.idx=t,this.append(i)}function l(e){(function(e){return Array.from(e.querySelectorAll("li"))})(e).forEach(t=>{t.classList.toggle(i,t.idx===e.idx)})}document.addEventListener("click",(function(e){this.active_menu&&!this.active_menu.contains(e.target)&&(a(),this.active_menu=void 0)}));function a(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{const t=e.root.querySelector("details[open].fp-menu-container");t&&(t.open=!1,e.root.classList.toggle("has-menu-opened",!1))})}function u(e,t,n){e.emit("quality:set",n)}return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,class{init(n,i,o){if(!1===n.qsel)return;const c=s(i,{summaryTitle:"HD",menuTitle:o.i18n("qsel.menu_title"),class:"fp-qsel"});o.on("mount",(function(){var e;i.querySelector(".fp-controls")&&(null===(e=i.querySelector(".fp-controls"))||void 0===e||e.append(c))})),o.on("qualities",i=>{if(!Array.isArray(i.data))return;const s=i.data,l=[],a=t(n,"qsel.labels",[]);s.forEach((t,n)=>{if("boolean"==typeof a[n]&&!a[n])return;let i=t.height?t.height+"p":t.text;"number"==typeof t.height&&t.height>719&&(i+=" HD");const s=e({},t,{text:a[n]||i,onclick:u.bind(0,o)});l.push(s)}),r(c,l)})}})}));
|
package/plugins/qul.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.qul=n())}(this,(function(){"use strict";const e=
|
|
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.qul=n())}(this,(function(){"use strict";const e="application/vnd.apple.mpegURL";document.createElement("video").canPlayType(e);function n(n){var t;return void 0===window.MediaSource&&void 0===window.WebKitMediaSource||function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,n=e?navigator.userAgent:"",t=/iP(hone|od)/i.test(n)&&!/iPad/.test(n)&&!/IEMobile/i.test(n),o=/Android/.test(n)&&!/Firefox/.test(n),i=/^((?!chrome|android).)*safari/i.test(n),r=/SamsungBrowser/.test(n),d=r&&/SMART-TV/.test(n);return{controls:!t,video:function(n){return e&&document.createElement("video").canPlayType(n)},lang:e&&window.navigator.language,android:o,iphone:t,safari:i,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:r,samsung_tv:r&&d}}().video(e)&&(null===(t=null==n?void 0:n.hls)||void 0===t?void 0:t.native)}function t(e,n){n.id&&clearInterval(n.id)}function o(e,n){i(e.original_src,(o,i,r)=>{if(200!=i)return t(0,n),o?e.emit("error",o):e.emit("error",{code:i,resp:r})})}function i(e,n){const t=new XMLHttpRequest;t.onload=function(){if(200==t.status)return n(void 0,t.status);try{const e=JSON.parse(t.responseText);n(void 0,"qul:"+t.status,e)}catch(e){n(e)}},t.open("GET",function(e){const n=document.createElement("a");n.href=e;const t="bust="+Date.now();return[n.protocol,"//",n.hostname,n.pathname,n.search,n.search.length?"&":"?",t].join("")}(e)),t.send()}!function(){let e=!1;try{const n=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,n),window.removeEventListener("testPassive",null,n)}catch(e){}}();function r(e,n,t){const o=document.createElement("a");o.href=e;let i=encodeURIComponent(n);return t&&(i+="/dId:"+encodeURIComponent(t)),[o.protocol,"//",o.hostname,o.pathname.replace(a(o.pathname,0),i+"/"+a(o.pathname,0))].join("")}class d{init(e,d,a){var u,l,c;const v=(null===(u=e.qul)||void 0===u?void 0:u.device_id)||(null===(l=e.qul)||void 0===l?void 0:l.dId)||a.deviceId();let f,p=null===(c=e.qul)||void 0===c?void 0:c.token;const m={};a.on("src",(function(i){var d;i.data&&(f=null===(d=i.data)||void 0===d?void 0:d.src,t(0,m),"string"==typeof f&&f.match(/\.m3u8$/)&&p&&(i.data.src=r(f,p,v),n(e)&&Object.assign(m,function(e,n){var i;const r=(null===(i=null==n?void 0:n.qul)||void 0===i?void 0:i.interval)||2e4,d={id:0,interval:Math.min(2e4,r)};return e.once("reap",(function(){t(0,d)})),d.id=setInterval(o,d.interval,e,d),setTimeout(o,0,e,d),d}(a,a.opts))))})),a.on("config",(function(e){var n,t,o,i,d,s;const u=null===(t=null===(n=e.data)||void 0===n?void 0:n.qul)||void 0===t?void 0:t.token,l=(null===(i=null===(o=e.data)||void 0===o?void 0:o.qul)||void 0===i?void 0:i.device_id)||(null===(s=null===(d=e.data)||void 0===d?void 0:d.qul)||void 0===s?void 0:s.dId);u&&u!==p&&function(e,n){p=e,a.setSrc({type:"application/x-mpegurl",src:r(f,p,n)})}(u,l)})),a.on("error",(function(e){var n,o;const r=((null===(n=e.data)||void 0===n?void 0:n.code)||"").toString();if(!r.match(/^(qul|http)/))return;t(0,m),e.preventDefault(),a.setState("is-error",!0);const u=null===(o=e.data)||void 0===o?void 0:o.resp,l=d.querySelector(".fp-ui");if(u)return s(a,l,u,r);i(a.original_src,(e,n,t)=>{if(e)return a.emit("error",e);!isNaN(Number(n))&&Number(n)<400||s(a,l,t,null==n?void 0:n.toString())})}))}}function s(e,n,t,o){const i=(null==t?void 0:t.message)||"an error occurred during this session",r=(null==t?void 0:t.key)?e.i18n(t.key,i):i;e.pause();const d=function(e,n){const t=new Event(e);return n&&Object.assign(t,{data:n}),t}("qul:error",{code:o,resp:t});e.dispatchEvent(d),d.defaultPrevented||n&&function(e,n,t,o){if(!e)return;const i=document.createElement("div");if(i.classList.add("fp-error"),i.innerText=n,o){const n=e.querySelector("#"+o);n&&e.removeChild(n),i.id=o}if(e.append(i),t){const e=document.createElement("div");e.classList.add("fp-error-details"),e.innerText=t,i.append(e)}}(n,r,"","qul_error")}function a(e,n){return e.split("/").reverse().slice(0,n+1).reverse().join("/")}return d.events={QUL_ERROR:"qul:error"},function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)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,d)}));
|
package/plugins/share.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.share=e())}(this,(function(){"use strict";const t=[].slice;function e(t,e,...n){return Object.assign(t,e)}function n(t,e,n){const o=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;o.length;){if(null==t)return n;const e=o.shift();if("string"!=typeof e)return n;t=t[e]}return null==t?n:t}const o=!!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){}return t}()&&{passive:!0},i=["touchstart","touchmove"];function r(t){var n=t;return n.emit=function(t,o,i={}){const r=function(t){const e=document.createEvent("Event");return e.initEvent(t,!1,!0),e}(t);return o&&e(r,{data:o||{}}),n.dispatchEvent(r),!1===i.return_self?r:n},n.on=function(t,e){return"string"==typeof t&&(t=t.split(" ")),t.forEach((function(t){return function(t){return~i.indexOf(t)}(t)?n.addEventListener(t,e,o):n.addEventListener(t,e)})),n},n.off=function(t,e){return n.removeEventListener(t,e),n},n.one=n.once=function(t,e){return n.on(t,(function o(i){n.off(t,o),e(i)}))},n}const a=Array.isArray,s="undefined"!=typeof window&&r(window),u="undefined"!=typeof document&&r(document),l=["span","a","em","p","i"];function c(t,e,n){var o=d(document.createElement(t));if(a(e)&&(n=e,e=!1),n||(n=[]),n&&!a(n)&&(n=[n]),n.length&&n.filter(t=>!!t).forEach(t=>o.append(t)),"object"!=typeof e)return o;for(var i in e)i in o?o[i]=e[i]:o.setAttribute(i,e[i]);return o}function f(e){var n=e.tagName;e.__flowplayer__=1,e.find=function(t){var n=e.querySelector(t);return n?d(n):n},e.html=function(t){return e.innerHTML=t,e},e.empty=function(){return e.innerHTML="",e},e.offset=function(){var t={top:0,left:0},n=e;do{t.left+=n.offsetLeft||0,t.top+=n.offsetTop||0}while(n=n.offsetParent);return t},e.innerWidth=function(){var t=getComputedStyle(e);return e.clientWidth-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)};var o=e.insert=function(t,n){return n?a(n)?n.map((function(n){return e.insert(t,n)}))[0]:d(n="string"==typeof n?e.insertAdjacentHTML(t,n):e.insertAdjacentElement?e.insertAdjacentElement(t,n):e.appendChild(n)):n};return e.append=o.bind(e,"beforeend"),e.prepend=o.bind(e,"afterbegin"),e.css=function(t,n){return"object"==typeof t?(Object.entries(t).forEach(([t,n])=>e.css(t,n)),e):void 0===n&&"string"==typeof t?getComputedStyle(e)[t]:("number"==typeof n&&(n+="px"),e.style[t]=n,e)},e.show=function(){return e.css({display:~l.indexOf(n)?"inline":"block"})},e.hide=function(){return e.css({display:"none"})},e.remove=function(){var t=e.parentNode;t&&t.removeChild(e)},e.attr=function(t,n){return null==n?e.getAttribute(t):(e.setAttribute(t,n),e)},e.txt=function(t){return e.textContent=t,e},e.fp=function(t){return e.addClass("fp-"+t)},e.addClass=function(t){return t.split(" ").forEach((function(t){e.hasClass(t)||(e.className+=(e.className?" ":"")+t)})),e},e.removeClass=function(t){const n=t.split(" ");var o=e.className.split(" ");return e.className=o.filter((function(t){return!~n.indexOf(t)})).join(" "),e},e.toggleClass=function(t,n){return void 0===n&&(n=!e.hasClass(t)),n?e.addClass(t):e.removeClass(t)},e.findAll=function(n){return o=e.querySelectorAll(n),t.call(o);var o},e.hasClass=function(t){return~e.className.split(" ").indexOf(t)},e}function d(t){return void 0===t||function(t){return t&&t.__flowplayer__}(t)?t:f(r(t))}function p(t,e){if("string"==typeof t&&"<"==t[0])return c(t.slice(1,-1),e);if("string"!=typeof t)return d(t);var n=e instanceof HTMLElement&&e.querySelector(".fp-"+t)||document.querySelector(t);return n?d(n):void 0}const m=t=>(e,n)=>("string"==typeof e&&(e={class:e}),c(t,e,n));function h(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function v(t){var e,n,o=h("svg");return o.setAttribute("viewBox",t.coords),t.name&&o.setAttribute("class",t.name),t.title&&o.setAttribute("title",t.title),t.title&&o.setAttribute("aria-label",t.title),o.setAttribute("tabindex","0"),o.setAttribute("focusable","true"),o.appendChild((e=t.link,(n=h("use")).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e),n)),p(o)}Object.assign(p,{div:m("div"),img:m("img"),li:m("li"),ol:m("ol"),span:m("span"),p:m("p"),i:m("i"),a:m("a"),el:c,document:u,window:s});var g={TOGGLE_OPEN:"menu:toggle:open",RENDER:"menu:render",PUSH:"menu:push"},_={ON:"fp-on",INVIS:"fp-invis"};function w(t,e){var n=window.__flowplayer_active_menu;if(n&&n.root&&n.root!==e&&n.root.toggleClass("has-menu-opened",!1),!t||!e)return n.menu=0,void(n.root=0);n.menu=t,n.root=e,n.root.toggleClass("has-menu-opened",!0)}if(!window.__flowplayer_active_menu){window.__flowplayer_active_menu={menu:0,root:0};document.addEventListener("click",(function(t){if(window.__flowplayer_active_menu){var e=window.__flowplayer_active_menu.menu,n=window.__flowplayer_active_menu.root;if(e&&n)if(document.contains(e)){if(e.hasClass(_.ON)){var o=e.parentElement;e.contains(t.target)||o.contains(t.target)||n.emit(g.TOGGLE_OPEN,{menu:e,open:!1})}}else w(null)}}))}function y(t,n,o){var i=o.id||"menu-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5);return o=o||{},t.attr("role","button").attr("aria-haspopup","true").attr("aria-expanded","false").attr("aria-controls",i).attr("aria-label",o.title),o.options=o.options||[],o.id=i,y._interface(t,n,function(...t){return t.slice(1).reduce((t,n)=>e(t,n),t[0]||{})}({},o))}y.title=function(t){return p("<h3>").txt(t)},y.close=function(t){return p.span("fp-close").on("click",t).html("×")},y.option=function(t,e){var n=this,o=p("<li>").attr("tabindex","0").attr("role","menuitem"),i=n._attrs;t.icon&&o.append(v(t.icon)),o.append(p("<span>").txt(t.text)),o.on("click",(function(o){i.multi||n.options().forEach(y.off),n.activate(e),"function"==typeof t.onclick&&t.onclick(o,t,e,n)})),o.idx=e,n.append(o)},y._interface=function(t,e,o){t.addClass("fp-menu-container");var i=p("<ul>").attr("id",o.id).addClass("fp-menu").attr("role","menu");return o.icons&&i.addClass("fp-icons"),i._attrs=o,t.on("click",(function(t){setTimeout((function(){if(!t.defaultPrevented)return i.hasClass(_.ON)?e.emit(g.TOGGLE_OPEN,{menu:i,open:!1}):void e.emit(g.TOGGLE_OPEN,{menu:i,open:!0})}),0)})),e.on(g.TOGGLE_OPEN,(function(o){if(n(o,"data.menu")!==i)return i.toggleClass(_.ON,!1),t.attr("aria-expanded","false");var r=n(o,"data.open",!1);if(i.toggleClass(_.ON,r),r?w(i,e):w(null),t.attr("aria-expanded",r?"true":"false"),e.hasClass("is-accessibility"))if(r){var a=i.options()[0];a&&a.focus()}else t.focus()})),i.push=function(t){return i._attrs.options=n(i,"_attrs.options",[]),i._attrs.options.push(t),i.render()},i.select=function(t){return i.render(i.options.filter(t))},i.render=function(e){var n=i._attrs;return i.empty(),i.prepend(y.close()),n.title&&i.prepend(y.title(n.title)),n.options=e||n.options,n.options.forEach(y.option,i),t.toggleClass(_.INVIS,0==n.options.length),i._activate(),i},i.close=function(){i.hasClass(_.ON)&&e.emit(g.TOGGLE_OPEN,{menu:i,open:!1})},i._activate=function(){i.options().forEach((function(t){t.toggleClass(_.ON,t.idx===i.idx)}))},i.options=function(){return[].slice.call(i.querySelectorAll("li"))},i.activate=function(t,e){void 0===i.idx||i.idx!==t||e?i.idx=t:delete i.idx,i._activate()},i.deactivate=function(){i.activate(i.idx)},i.render(o.options),t.appendChild(i),i},y.on=function(t){return t.addClass(_.ON),t},y.off=function(t){return t.removeClass(_.ON),t},y.CONTAINER_CLASS="fp-menu",y.Events=g,y.States=_;var b={coords:"-5 25 460 460",link:"#fp-facebook",name:"fp-facebook"},x={coords:"0 0 512 512",link:"#fp-link",name:"fp-link"},C={coords:"0 0 448 512",link:"#fp-share",name:"fp-share"},E={coords:"0 0 512 512",link:"#fp-share",name:"fp-embed"},O={coords:"0 0 512 512",link:"#fp-twitter",name:"fp-twitter"};function k(){try{return(document.querySelector("meta[name='description']")||{content:""}).content}catch(t){return""}}function N(t){if("string"==typeof t.link)return t.link;var e=document.querySelector("link[rel=canonical]");return e?e.href:window.location.toString()}function A(t,e,o){var i=0,r=p.span("fp-share-menu fp-menu-container").attr("tabindex","0");r.append(v(C).attr("tabindex",""));var a={prev_config:0,webshare_listener:0};o.on("mount",(function(){var t=n(e,"ui.header.secondary");t&&t.append(r)}));var s=y(r,e,{title:o._t("share.menu_title"),icons:!0,options:[]});function u(t,e,n){return{text:(i=t,0===i.indexOf("share.")?o._t(i):i),icon:n,onclick:S.bind(null,o,s,e)};var i}o.on("config",(function(e){var i=n(e,"data.share",{});if(!1===i)return function(t){t.removeClass("webshare-enabled")}(r);if(a.prev_config!==i){if(a.prev_config=i,function(){try{return"https:"===window.location.protocol&&"function"==typeof navigator.share}catch(t){return!1}}()&&n(i,"web_share",!0))return function(t){t.addClass("webshare-enabled")}(r),a.webshare_listener||function(t,e,o){o.webshare_listener=!0,e.on("click",(function(o){if(!i&&e.hasClass("webshare-enabled")){o.preventDefault();var i=navigator.share({title:n(t,"share.title",document.title),text:n(t,"share.text",k()),url:N(n(t,"share",{}))});i.catch((function(){}))}}))}(t,r,a);var l=[],c="string"==typeof i.link?i.link:window.location.toString();if(i.iframe){var f="string"==typeof i.iframe?i.iframe:c;l.push(u("share.embed",L.bind(null,f,o),E))}i.link&&l.push(u("share.link",T.bind(null,c),x)),i.facebook&&l.push(u("Facebook",R.bind(null,c),b)),i.twitter&&l.push(u("Twitter",G.bind(null,c),O)),s.render(l)}}));e.on(y.Events.TOGGLE_OPEN,(function(t){if(t.data&&t.data.menu===s){if(o.root.toggleClass("is-share-menu",t.data.open),e.hasClass("is-small"))return(n=!!t.data)&&!o.paused&&(o.pause(),i=1),!n&&i&&(o.play(),i=0),void function(t,e,n,o){var i=o.getBoundingClientRect(),r=function(t,e){var n={top:0,left:0},o=t;for(;o.parentElement&&o.parentElement!==e;)o=o.parentElement,n.top+=o.offsetTop,n.left+=o.offsetLeft;return n}(e,o),a=(s=n,[].reduce.call(s.childNodes,(function(t,e){return t+e.getBoundingClientRect().height}),0));var s;n.css({position:"absolute",right:"auto",bottom:"auto",top:-r.top+"px",left:-r.left+"px",width:i.width+"px",height:a+"px",minHeight:i.height+"px",maxHeight:i.height+"px",margin:0})}(0,r,s,e);var n;!function(t,e,n,o){var i,r=function(t,e){var n=t.getBoundingClientRect(),o=e.getBoundingClientRect();return{left:n.left-o.left,right:n.right-o.left,top:n.top-o.top,bottom:n.bottom-o.top}}(e,o),a=o.getBoundingClientRect(),s=o.hasClass("logo-on-right");i={right:"auto",left:r.right+"px",top:(s?0:r.top)+"px",bottom:"auto",width:"auto",height:"auto",minHeight:"",maxHeight:.75*a.height+"px",margin:"0.5em"},n.css(i)}(0,r,s,e)}}))}function S(t,e,n){e.deactivate();var o=n();o.success&&o.message&&t.message&&t.root.emit(t.message.events.SHOW_MESSAGE,{message:o.message})}function L(t,e){var n=e.videoHeight/e.videoWidth;return T('<div style="position:relative;width:100%;display:inline-block;"><iframe src="__IFRAME_SRC__" allowfullscreen style="border:none;position:absolute;top:0;left:0;width:100%;height:100%;"></iframe><div style="padding-top: __RATIO__%;"></div></div>'.replace("__IFRAME_SRC__",encodeURI(t)).replace("__RATIO__",100*n))}function T(t){var e=p.el("textarea").css({opacity:0,position:"absolute"});e.value=t;var n=p(document.body);n.append(e),e.select();var o=document.execCommand("copy");return n.removeChild(e),{success:o,message:o?"<trans share.clipboard_success trans>":"<trans share.clipboard_failure trans>"}}function R(t){return P("https://www.facebook.com/sharer.php?u="+encodeURIComponent(t)),{success:!0}}function G(t){return P("https://twitter.com/intent/tweet?url="+encodeURIComponent(t)),{success:!0}}function P(t){var e,n,o=screen.height,i=screen.width;e=Math.round(i/2-275),n=0,o>420&&(n=Math.round(o/2-210)),window.open(t,"sharer","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left="+e+",top="+n)}return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});var n=t.flowplayer;"function"==typeof n?n(e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e))}(window,A),A}));
|
|
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.share=t())}(this,(function(){"use strict";const e={name:"fp-facebook"},t={name:"fp-link"},n={name:"fp-share"},o={name:"fp-embed"},i={name:"fp-twitter"};function s(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}function r(){try{return(document.querySelector("meta[name='description']")||{content:""}).content}catch(e){return""}}function c(e){if("string"==typeof e.link)return e.link;const t=document.querySelector("link[rel=canonical]");return t?t.href:window.location.toString()}function a(e){const t=document.createElement("div");return t.setAttribute("class",e.name),e.title&&t.setAttribute("title",e.title),e.title&&t.setAttribute("aria-label",e.title),t.setAttribute("tabindex","0"),t.setAttribute("focusable","true"),t}const l="fp-on",u="fp-invis";function d(e,t){const n=document.createElement("details"),o=document.createElement("summary"),i=document.createElement("ol"),s=document.createElement("div"),r=document.createElement("span");if(n.classList.add("fp-menu-container",u,t.class),n.setAttribute("aria-controls",t.id||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)),n.setAttribute("aria-label",t.menuTitle||""),t.summaryTitle&&(o.textContent=t.summaryTitle),t.summaryIcon){const e=a(t.summaryIcon);e.setAttribute("tabindex",""),o.append(e)}if(t.menuTitle){const e=document.createElement("h3");e.textContent=t.menuTitle,s.append(e)}return t.icons&&s.classList.add("fp-icons"),s.classList.add("fp-menu"),s.append(r),s.append(i),r.classList.add("fp-close"),r.innerHTML="×",n.append(o),n.append(s),n.addEventListener("click",(function(t){t.preventDefault(),!this.open&&document.active_menu&&y(),document.active_menu=this.open?void 0:this,this.open=!this.open,e.classList.toggle("has-menu-opened",this.open)})),t.options&&p(n,t.options),n}function p(e,t){const n=e.querySelector("ol");n&&(n.innerHTML="",t&&t.forEach(f,n),e.classList.toggle(u,0==(null==t?void 0:t.length)),h(n))}function f(e,t){const n=document.createElement("li");n.setAttribute("tabindex","0"),n.setAttribute("role","menuitem"),e.icon&&n.append(e.icon instanceof HTMLElement?e.icon:a(e.icon));const o=document.createElement("span");o.textContent=e.text,n.append(o),n.addEventListener("click",n=>{m(this,t),"function"==typeof e.onclick&&e.onclick(n,e,t,this)}),n.idx=t,this.append(n)}function m(e,t,n){void 0===e.idx||e.idx!==t||n?e.idx=t:delete e.idx,h(e)}function h(e){(function(e){return Array.from(e.querySelectorAll("li"))})(e).forEach(t=>{t.classList.toggle(l,t.idx===e.idx)})}document.addEventListener("click",(function(e){this.active_menu&&!this.active_menu.contains(e.target)&&(y(),this.active_menu=void 0)}));function y(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{const t=e.root.querySelector("details[open].fp-menu-container");t&&(t.open=!1,e.root.classList.toggle("has-menu-opened",!1))})}class b{constructor(){this.share_options=[]}init(a,l,u){const f=d(l,{menuTitle:u.i18n("share.menu_title"),summaryIcon:n,class:"fp-share-menu",icons:!0}),m=f.querySelector(".fp-menu"),h=f.querySelector("ol");if(!m)return;if(!h)return;const y={prev_config:0,webshare_listener:0};u.on("mount",(function(){var e;l.querySelector(".fp-secondary")&&(null===(e=l.querySelector(".fp-secondary"))||void 0===e||e.append(f))})),f.addEventListener("toggle",(function(){l.classList.toggle("is-share-menu",this.open),this.open&&l.classList.contains("is-small")&&u.pause()})),u.on("config",n=>{const l=s(n,"data.share",{});if(!1===l)return void f.classList.remove("webshare-enabled");if(y.prev_config===l)return;if(y.prev_config=l,function(){try{return"http:"===window.location.protocol&&"function"==typeof navigator.share}catch(e){return!1}}()&&s(l,"web_share",!0))return function(e){e.classList.add("webshare-enabled")}(f),f.removeChild(m),y.webshare_listener||function(e,t,n){n.webshare_listener=!0,t.addEventListener("click",(function(n){if(!t.classList.contains("webshare-enabled"))return;n.preventDefault();navigator.share({title:s(e,"share.title",document.title),text:s(e,"share.text",r()),url:c(s(e,"share",{}))}).catch((function(){}))}))}(a,f,y);this.share_options=[];const d="string"==typeof l.link?l.link:window.location.toString();if(l.iframe){const e="string"==typeof l.iframe?l.iframe:d;this.share_options.push(_(u,h,"share.embed",w.bind(null,e,u),o))}l.link&&this.share_options.push(_(u,h,"share.link",x.bind(null,d),t)),l.facebook&&this.share_options.push(_(u,h,"Facebook",A.bind(null,d),e)),l.twitter&&this.share_options.push(_(u,h,"Twitter",E.bind(null,d),i)),p(f,this.share_options)})}add_option(e,t){const n=e.root.querySelector(".fp-menu-container.fp-share-menu"),o=null==n?void 0:n.querySelector("ol");o&&n&&(this.share_options.push(_(e,o,t.text,t.onClick,t.icon)),p(n,this.share_options))}}function _(e,t,n,o,i){return{text:g(e,n),icon:i,onclick:v.bind(null,e,t,o)}}function g(e,t){return 0===t.indexOf("share.")?e.i18n(t):t}function v(e,t,n){!function(e){m(e,e.idx)}(t);const o=n();o.success&&o.message&&e.message&&e.emit(e.message.events.SHOW_MESSAGE,{message:o.message})}function w(e,t){const n=t.videoHeight/t.videoWidth;return x('<div style="position:relative;width:100%;display:inline-block;"><iframe src="__IFRAME_SRC__" allowfullscreen style="border:none;position:absolute;top:0;left:0;width:100%;height:100%;"></iframe><div style="padding-top: __RATIO__%;"></div></div>'.replace("__IFRAME_SRC__",encodeURI(e)).replace("__RATIO__",""+100*n))}function x(e){const t=document.createElement("textarea");t.setAttribute("style","position:absolute;opacity:0"),t.value=e;const n=document.body;n.append(t),t.select();const o=document.execCommand("copy");return n.removeChild(t),{success:o,message:o?"<trans share.clipboard_success trans>":"<trans share.clipboard_failure trans>"}}function A(e){return S("https://www.facebook.com/sharer.php?u="+encodeURIComponent(e)),{success:!0}}function E(e){return S("https://twitter.com/intent/tweet?url="+encodeURIComponent(e)),{success:!0}}function S(e){let t;const n=screen.height,o=screen.width,i=Math.round(o/2-275);t=0,n>420&&(t=Math.round(n/2-210)),window.open(e,"sharer","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left="+i+",top="+t)}return b.SHARE_MENU_ACTIVE_CLASS="is-share-menu",function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,b),b}));
|
package/plugins/speed.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t
|
|
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.speed=t())}(this,(function(){"use strict";function e(...e){return e.slice(1).reduce((e,t)=>{return n=e,i=t,Object.assign(n,i);var n,i},e[0]||{})}function t(e,t,n){const i=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;i.length;){if(null==e)return n;const t=i.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}function n(e){const t=document.createElement("div");return t.setAttribute("class",e.name),e.title&&t.setAttribute("title",e.title),e.title&&t.setAttribute("aria-label",e.title),t.setAttribute("tabindex","0"),t.setAttribute("focusable","true"),t}const i="fp-on",o="fp-invis";function s(e,t){const i=document.createElement("details"),s=document.createElement("summary"),c=document.createElement("ol"),l=document.createElement("div"),u=document.createElement("span");if(i.classList.add("fp-menu-container",o,t.class),i.setAttribute("aria-controls",t.id||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)),i.setAttribute("aria-label",t.menuTitle||""),t.summaryTitle&&(s.textContent=t.summaryTitle),t.summaryIcon){const e=n(t.summaryIcon);e.setAttribute("tabindex",""),s.append(e)}if(t.menuTitle){const e=document.createElement("h3");e.textContent=t.menuTitle,l.append(e)}return t.icons&&l.classList.add("fp-icons"),l.classList.add("fp-menu"),l.append(u),l.append(c),u.classList.add("fp-close"),u.innerHTML="×",i.append(s),i.append(l),i.addEventListener("click",(function(t){t.preventDefault(),!this.open&&document.active_menu&&a(),document.active_menu=this.open?void 0:this,this.open=!this.open,e.classList.toggle("has-menu-opened",this.open)})),t.options&&r(i,t.options),i}function r(e,t){const n=e.querySelector("ol");n&&(n.innerHTML="",t&&t.forEach(c,n),e.classList.toggle(o,0==(null==t?void 0:t.length)),l(n))}function c(e,t){const i=document.createElement("li");i.setAttribute("tabindex","0"),i.setAttribute("role","menuitem"),e.icon&&i.append(e.icon instanceof HTMLElement?e.icon:n(e.icon));const o=document.createElement("span");o.textContent=e.text,i.append(o),i.addEventListener("click",n=>{!function(e,t,n){void 0===e.idx||e.idx!==t||n?e.idx=t:delete e.idx;l(e)}(this,t),"function"==typeof e.onclick&&e.onclick(n,e,t,this)}),i.idx=t,this.append(i)}function l(e){(function(e){return Array.from(e.querySelectorAll("li"))})(e).forEach(t=>{t.classList.toggle(i,t.idx===e.idx)})}document.addEventListener("click",(function(e){this.active_menu&&!this.active_menu.contains(e.target)&&(a(),this.active_menu=void 0)}));function a(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{const t=e.root.querySelector("details[open].fp-menu-container");t&&(t.open=!1,e.root.classList.toggle("has-menu-opened",!1))})}class u{init(n,i,o){let c=void 0;const l=s(i,{summaryTitle:"1x",menuTitle:o.i18n("speed.menu_title"),class:"fp-speed"});o.on("config",()=>{const i=t(n,"speed",!0);if(i===c)return;if(c=i,0==i)return r(l,[]);const s=t(n,"speed.options",u.DEFAULT_SPEED_OPTIONS),a=t(n,"speed.labels",[]);r(l,s.map((t,n)=>{const i=t+"x";return e({},t,{text:a[n]||i,rate:t,onclick:d.bind(0,o,l)})}))}),o.on("mount",(function(){var e;i.querySelector(".fp-controls")&&(null===(e=i.querySelector(".fp-controls"))||void 0===e||e.append(l))}))}}function d(e,t,n,i){const o=i.rate,s=t.querySelector("summary");s&&(s.textContent=o+"x"),isNaN(o)||(e.playbackRate=o)}return u.DEFAULT_SPEED_OPTIONS=[.2,.5,1,2,10],function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)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,u)}));
|
package/plugins/subtitles.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.subtitles=e())}(this,(function(){"use strict";const t=[].slice;function e(t,e,...n){return Object.assign(t,e)}function n(t,e,n){const r=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;r.length;){if(null==t)return n;const e=r.shift();if("string"!=typeof e)return n;t=t[e]}return null==t?n:t}function r(e){return t.call(e)}const i=!!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){}return t}()&&{passive:!0},o=["touchstart","touchmove"];function a(t){var n=t;return n.emit=function(t,r,i={}){const o=function(t){const e=document.createEvent("Event");return e.initEvent(t,!1,!0),e}(t);return r&&e(o,{data:r||{}}),n.dispatchEvent(o),!1===i.return_self?o:n},n.on=function(t,e){return"string"==typeof t&&(t=t.split(" ")),t.forEach((function(t){return function(t){return~o.indexOf(t)}(t)?n.addEventListener(t,e,i):n.addEventListener(t,e)})),n},n.off=function(t,e){return n.removeEventListener(t,e),n},n.one=n.once=function(t,e){return n.on(t,(function r(i){n.off(t,r),e(i)}))},n}const c=Array.isArray,s="undefined"!=typeof window&&a(window),u="undefined"!=typeof document&&a(document),f=["span","a","em","p","i"];function l(t,e,n){var r=d(document.createElement(t));if(c(e)&&(n=e,e=!1),n||(n=[]),n&&!c(n)&&(n=[n]),n.length&&n.filter(t=>!!t).forEach(t=>r.append(t)),"object"!=typeof e)return r;for(var i in e)i in r?r[i]=e[i]:r.setAttribute(i,e[i]);return r}function d(t){return void 0===t||function(t){return t&&t.__flowplayer__}(t)?t:function(t){var e=t.tagName;t.__flowplayer__=1,t.find=function(e){var n=t.querySelector(e);return n?d(n):n},t.html=function(e){return t.innerHTML=e,t},t.empty=function(){return t.innerHTML="",t},t.offset=function(){var e={top:0,left:0},n=t;do{e.left+=n.offsetLeft||0,e.top+=n.offsetTop||0}while(n=n.offsetParent);return e},t.innerWidth=function(){var e=getComputedStyle(t);return t.clientWidth-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)};var n=t.insert=function(e,n){return n?c(n)?n.map((function(n){return t.insert(e,n)}))[0]:d(n="string"==typeof n?t.insertAdjacentHTML(e,n):t.insertAdjacentElement?t.insertAdjacentElement(e,n):t.appendChild(n)):n};return t.append=n.bind(t,"beforeend"),t.prepend=n.bind(t,"afterbegin"),t.css=function(e,n){return"object"==typeof e?(Object.entries(e).forEach(([e,n])=>t.css(e,n)),t):void 0===n&&"string"==typeof e?getComputedStyle(t)[e]:("number"==typeof n&&(n+="px"),t.style[e]=n,t)},t.show=function(){return t.css({display:~f.indexOf(e)?"inline":"block"})},t.hide=function(){return t.css({display:"none"})},t.remove=function(){var e=t.parentNode;e&&e.removeChild(t)},t.attr=function(e,n){return null==n?t.getAttribute(e):(t.setAttribute(e,n),t)},t.txt=function(e){return t.textContent=e,t},t.fp=function(e){return t.addClass("fp-"+e)},t.addClass=function(e){return e.split(" ").forEach((function(e){t.hasClass(e)||(t.className+=(t.className?" ":"")+e)})),t},t.removeClass=function(e){const n=e.split(" ");var r=t.className.split(" ");return t.className=r.filter((function(t){return!~n.indexOf(t)})).join(" "),t},t.toggleClass=function(e,n){return void 0===n&&(n=!t.hasClass(e)),n?t.addClass(e):t.removeClass(e)},t.findAll=function(e){return r(t.querySelectorAll(e))},t.hasClass=function(e){return~t.className.split(" ").indexOf(e)},t}(a(t))}function p(t,e){if("string"==typeof t&&"<"==t[0])return l(t.slice(1,-1),e);if("string"!=typeof t)return d(t);var n=e instanceof HTMLElement&&e.querySelector(".fp-"+t)||document.querySelector(t);return n?d(n):void 0}const m=t=>(e,n)=>("string"==typeof e&&(e={class:e}),l(t,e,n));Object.assign(p,{div:m("div"),img:m("img"),li:m("li"),ol:m("ol"),span:m("span"),p:m("p"),i:m("i"),a:m("a"),el:l,document:u,window:s});function v(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function h(t){var e,n,r=v("svg");return r.setAttribute("viewBox",t.coords),t.name&&r.setAttribute("class",t.name),t.title&&r.setAttribute("title",t.title),t.title&&r.setAttribute("aria-label",t.title),r.setAttribute("tabindex","0"),r.setAttribute("focusable","true"),r.appendChild((e=t.link,(n=v("use")).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e),n)),p(r)}var g={TOGGLE_OPEN:"menu:toggle:open",RENDER:"menu:render",PUSH:"menu:push"},y={ON:"fp-on",INVIS:"fp-invis"};function _(t,e){var n=window.__flowplayer_active_menu;if(n&&n.root&&n.root!==e&&n.root.toggleClass("has-menu-opened",!1),!t||!e)return n.menu=0,void(n.root=0);n.menu=t,n.root=e,n.root.toggleClass("has-menu-opened",!0)}if(!window.__flowplayer_active_menu){window.__flowplayer_active_menu={menu:0,root:0};document.addEventListener("click",(function(t){if(window.__flowplayer_active_menu){var e=window.__flowplayer_active_menu.menu,n=window.__flowplayer_active_menu.root;if(e&&n)if(document.contains(e)){if(e.hasClass(y.ON)){var r=e.parentElement;e.contains(t.target)||r.contains(t.target)||n.emit(g.TOGGLE_OPEN,{menu:e,open:!1})}}else _(null)}}))}function w(t,n,r){var i=r.id||"menu-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5);return r=r||{},t.attr("role","button").attr("aria-haspopup","true").attr("aria-expanded","false").attr("aria-controls",i).attr("aria-label",r.title),r.options=r.options||[],r.id=i,w._interface(t,n,function(...t){return t.slice(1).reduce((t,n)=>e(t,n),t[0]||{})}({},r))}function b(t){return"function"==typeof t}function x(){throw new Error("Function was expected as Argument[0]")}w.title=function(t){return p("<h3>").txt(t)},w.close=function(t){return p.span("fp-close").on("click",t).html("×")},w.option=function(t,e){var n=this,r=p("<li>").attr("tabindex","0").attr("role","menuitem"),i=n._attrs;t.icon&&r.append(h(t.icon)),r.append(p("<span>").txt(t.text)),r.on("click",(function(r){i.multi||n.options().forEach(w.off),n.activate(e),"function"==typeof t.onclick&&t.onclick(r,t,e,n)})),r.idx=e,n.append(r)},w._interface=function(t,e,r){t.addClass("fp-menu-container");var i=p("<ul>").attr("id",r.id).addClass("fp-menu").attr("role","menu");return r.icons&&i.addClass("fp-icons"),i._attrs=r,t.on("click",(function(t){setTimeout((function(){if(!t.defaultPrevented)return i.hasClass(y.ON)?e.emit(g.TOGGLE_OPEN,{menu:i,open:!1}):void e.emit(g.TOGGLE_OPEN,{menu:i,open:!0})}),0)})),e.on(g.TOGGLE_OPEN,(function(r){if(n(r,"data.menu")!==i)return i.toggleClass(y.ON,!1),t.attr("aria-expanded","false");var o=n(r,"data.open",!1);if(i.toggleClass(y.ON,o),o?_(i,e):_(null),t.attr("aria-expanded",o?"true":"false"),e.hasClass("is-accessibility"))if(o){var a=i.options()[0];a&&a.focus()}else t.focus()})),i.push=function(t){return i._attrs.options=n(i,"_attrs.options",[]),i._attrs.options.push(t),i.render()},i.select=function(t){return i.render(i.options.filter(t))},i.render=function(e){var n=i._attrs;return i.empty(),i.prepend(w.close()),n.title&&i.prepend(w.title(n.title)),n.options=e||n.options,n.options.forEach(w.option,i),t.toggleClass(y.INVIS,0==n.options.length),i._activate(),i},i.close=function(){i.hasClass(y.ON)&&e.emit(g.TOGGLE_OPEN,{menu:i,open:!1})},i._activate=function(){i.options().forEach((function(t){t.toggleClass(y.ON,t.idx===i.idx)}))},i.options=function(){return[].slice.call(i.querySelectorAll("li"))},i.activate=function(t,e){void 0===i.idx||i.idx!==t||e?i.idx=t:delete i.idx,i._activate()},i.deactivate=function(){i.activate(i.idx)},i.render(r.options),t.appendChild(i),i},w.on=function(t){return t.addClass(y.ON),t},w.off=function(t){return t.removeClass(y.ON),t},w.CONTAINER_CLASS="fp-menu",w.Events=g,w.States=y;var k=[].slice;function E(t){if(!(this instanceof E))return new E(t);var e=this;return e.data=t,e.tap=function(){var t=k.call(arguments),n=t.shift();return n==E.lift?e.data:b(n)?(n.apply(e,[e.data].concat(t)),e):void x()},e.into=e.fmap=function(){var t=k.call(arguments),n=t.shift();return n==E.lift?e.data:b(n)?E(n.apply(e,[e.data].concat(t))):void x()},e.unwrap=function(){return e.data},e}E.of=E,E.lift=function(t){return t instanceof E?t.data:t},E._apply=E.apply=function(t,e){if(0==e.length)return t();if(1==e.length)return t(e[0]);if(2==e.length)return t(e[0],e[1]);if(3==e.length)return t(e[0],e[1],e[2]);if(4==e.length)return t(e[0],e[1],e[2],e[3]);if(5==e.length)return t(e[0],e[1],e[2],e[3],e[4]);throw new Error("Pipe._apply() does not support arity > 5")},E.maybe=function(t,e,n){return t?E._apply(e,[t].concat(k.call(arguments,2,arguments.length))):t},E.curry=function(t,e,n){return(e=e||[]).length>t.length-1?t.apply(n,e):function(){var r=e.concat(k.call(arguments));return E.curry(t,r,n)}};function C(t,e){if(function(t){switch(t){case"":case"anonymous":case"use-credentials":return!0;default:console.warn("Invalid(crossorigin: %s) must be one of '', 'anonymous', or 'use-credentials'\nhttps://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes",t)}}(e=e||"anonymous"),t.crossOrigin!=e)return t.attr("crossorigin",e),t}function O(t){var e=document.createElement("a");return e.href=t,e.origin}function N(t,e){var n=function(t,e){return t.querySelector("track[src='"+e+"']")}(e,t.src);if(n)return n;"string"!=typeof t.crossorigin&&function(t,e){try{return t.src.indexOf("blob:"),O(t.src)!==O(e)}catch(t){return console.error(t),!0}}(e,t.src)&&(C(e),t.crossorigin=e.attr("crossorigin")),"crossorigin"in t&&C(e,t.crossorigin),"object"==typeof t&&1==t.is_default&&(delete t.is_default,t.default=!0),t.default||delete t.default,t.id=t.id||[t.srclang,t.label,t.lang].filter((function(t){return!!t})).join("-");var r=p("<track>",t);return e.append(r),r}function A(t,e){return{text:t.label,track:t,onclick:T.bind(0,e)}}function T(t,e,n,r,i){[].forEach.call(t.textTracks,(function(e){return"showing"==e.mode&&n.track==e?(i.deactivate(r,!1),t.emit("tracks:text:updated"),e.mode="disabled"):e==n.track?(i.activate(r,!0),t.emit("tracks:text:updated",e),e.mode="showing"):void(e.mode="disabled")}))}var L=["subtitles","captions","descriptions"];function S(t){return t.filter((function(t){return t&&~L.indexOf(t.kind)}))}function j(t){var e=document.createElement("a");return e.href=t,e}function P(t,e){return 1==t.filter((function(t){return n=t.src,r=e,j(n).href==j(r).href;var n,r})).length}function G(t,e,n){E.of(t).fmap(H,A,n).fmap(e.render),t.forEach((function(t,n){"showing"==t.mode&&e.activate(n,!0)}))}function q(t,e){t.toggleClass("fp-color-text",e)}function H(t,e,n,r,i){return t.map((function(t){return e.call(this,t,n,r,i)}))}return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});var 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,(function(t,e,i){var o=p.span("fp-cc fp-menu-container").attr("tabindex","0").txt(i._t("cc.button","CC")),a=w(o,e,{title:i._t("cc.menu_title","Subtitles"),options:[]});i.reaper.put("_tracks",[]),i.reaper.put("_track_elements",[]),o.on("click",(function(t){1===E.of(i._tracks).fmap(r).fmap(S).fmap(E.lift).length&&(t.preventDefault(),a.options().shift().emit("click"))})),i.on("config",(function(){var e=n(t,"subtitles.show");E.of(t).fmap(n,"subtitles.tracks").tap(E.maybe,(function(t){var e=i._track_elements||[];e.slice(0).forEach((function(n,r){P(t,n.src)||(n.remove(),e.splice(r,1))}))})).tap(E.maybe,(function(t){return function(t,e){if(void 0===e)return;var n=null;t.forEach((function(t){if(!e||n)return delete t.default,void delete t.is_default;!t.default&&!t.is_default||n||(n=t)})),e&&!n&&t.length>0&&(t[0].default=!0)}(t,e),i._track_elements=H(t,N,i),i._track_elements.map((function(t){return t.track}))})).tap(E.maybe,(function(){i._tracks=r(i.textTracks)})).tap(E.maybe,(function(t){i.emit("tracks:text:all",i._tracks)}))})),i.one("mount",(function(){if(0!=e.reaper&&(e.controls&&e.controls.append(o),0!=i.textTracks.length)){var t=r(i.textTracks);i.emit("tracks:text:all",t)}})),i.textTracks.addEventListener("addtrack",(function(){i.hls||i.emit("tracks:text:all",r(i.textTracks))})),i.textTracks.addEventListener("removetrack",(function(){i.hls||i.emit("tracks:text:all",r(i.textTracks))})),i.on("tracks:text:all",(function(t){i._tracks=n(t,"data",[]),function(t,e,n,i){setTimeout((function(){E.of(t).fmap(r).fmap(S).tap((function(t){var e=0;t.forEach((function(t){"showing"==t.mode&&(e>0&&(t.mode="disabled"),e=1)})),q(i,e>0)})).tap(G,n,e)}),0)}(i._tracks,i,a,o)})),i.on("tracks:text:change",(function(t){"number"==typeof t.data&&a.activate(t.data)})),i.on("tracks:text:updated",(function(t){var e=n(t,"data",null);q(o,null!=e)}))}))}));
|
|
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.subtitles=e())}(this,(function(){"use strict";function t(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 e(t){const e=document.createElement("div");return e.classList.add("fp-captions"),e.ontouchend=e=>t.emit(e.type),e.onclick=e=>t.emit(e.type),e}function n(t,e){t.innerHTML="",e.forEach((function(e){const n=document.createElement("pre");n.classList.add("fp-cue"),function(t,e){const n=t.style,i=e.size;n.setProperty("--caption-size",i.toString());const o=e.position;o&&"auto"!==o&&e?n.setProperty("--caption-position",o.toString()):n.removeProperty("--caption-position");const s="captions-align-"+e.align;Array.from(t.classList).forEach((function(n){n!=s&&("captions-vertical"==n&&e.vertical||n.startsWith("captions")&&t.classList.remove(n))})),t.classList.add(s),t.classList.toggle("captions-vertical",!!e.vertical)}(t,e),n.appendChild(e.getCueAsHTML()),t.appendChild(n)}))}var i;function o(t,e){if(function(t){return Object.values(i).includes(t)}(e=e||i.Anonymous))return"crossOrigin"in t?t.crossOrigin=e:t.setAttribute("crossorigin",e),t}function s(t){const e=document.createElement("a");return e.href=t,e.origin}function c(t,e){const n=document.createElement("track");n.className="fp-track renderable",n.kind=e.kind||"captions",n.id=["fp",e.lang].join("-");const i=n.track;return"string"!=typeof e.crossorigin&&function(t,e){try{return t.src.startsWith("blob:"),s(t.src)!==s(e)}catch(t){return console.error(t),!0}}(t,e.src)&&(o(t),e.crossorigin=t.getAttribute("crossorigin")),"crossorigin"in e&&o(t,e.crossorigin),Object.keys(e).forEach(t=>{n[t]=e[t]}),i.mode=e.default?"showing":e.mode||"disabled",n.onload=function(){},i.oncuechange=function(e){t.emit(e.type,{track:e.target})},t.appendChild(n),n}!function(t){t.Anonymous="anonymous",t.UseCredentials="use-credentials",t.Empty=""}(i||(i={}));function r(t){(function(){const t="undefined"!=typeof document&&"undefined"!=typeof window,e=t?navigator.userAgent:"",n=/iP(hone|od)/i.test(e)&&!/iPad/.test(e)&&!/IEMobile/i.test(e),i=/Android/.test(e)&&!/Firefox/.test(e),o=/^((?!chrome|android).)*safari/i.test(e),s=/SamsungBrowser/.test(e),c=s&&/SMART-TV/.test(e);return{controls:!n,video:function(e){return t&&document.createElement("video").canPlayType(e)},lang:t&&window.navigator.language,android:i,iphone:n,safari:o,ios:t&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:s,samsung_tv:s&&c}})().ios&&(t.on("fullscreenenter",(function(){t._subtitles.textTracks.forEach((function(t){t.mode="hidden"===t.mode?"showing":"disabled"}))})),t.on("fullscreenexit",(function(){t._subtitles.textTracks.forEach((function(t){t.mode="showing"===t.mode?"hidden":"disabled"}))})))}function a(t){const e=document.createElement("div");return e.setAttribute("class",t.name),t.title&&e.setAttribute("title",t.title),t.title&&e.setAttribute("aria-label",t.title),e.setAttribute("tabindex","0"),e.setAttribute("focusable","true"),e}const l="fp-on",u="fp-invis";function d(t,e){const n=document.createElement("details"),i=document.createElement("summary"),o=document.createElement("ol"),s=document.createElement("div"),c=document.createElement("span");if(n.classList.add("fp-menu-container",u,e.class),n.setAttribute("aria-controls",e.id||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)),n.setAttribute("aria-label",e.menuTitle||""),e.summaryTitle&&(i.textContent=e.summaryTitle),e.summaryIcon){const t=a(e.summaryIcon);t.setAttribute("tabindex",""),i.append(t)}if(e.menuTitle){const t=document.createElement("h3");t.textContent=e.menuTitle,s.append(t)}return e.icons&&s.classList.add("fp-icons"),s.classList.add("fp-menu"),s.append(c),s.append(o),c.classList.add("fp-close"),c.innerHTML="×",n.append(i),n.append(s),n.addEventListener("click",(function(e){e.preventDefault(),!this.open&&document.active_menu&&h(),document.active_menu=this.open?void 0:this,this.open=!this.open,t.classList.toggle("has-menu-opened",this.open)})),e.options&&f(n,e.options),n}function f(t,e){const n=t.querySelector("ol");n&&(n.innerHTML="",e&&e.forEach(p,n),t.classList.toggle(u,0==(null==e?void 0:e.length)),g(n))}function p(t,e){const n=document.createElement("li");n.setAttribute("tabindex","0"),n.setAttribute("role","menuitem"),t.icon&&n.append(t.icon instanceof HTMLElement?t.icon:a(t.icon));const i=document.createElement("span");i.textContent=t.text,n.append(i),n.addEventListener("click",n=>{m(this,e),"function"==typeof t.onclick&&t.onclick(n,t,e,this)}),n.idx=e,this.append(n)}function m(t,e,n){void 0===t.idx||t.idx!==e||n?t.idx=e:delete t.idx,g(t)}function g(t){(function(t){return Array.from(t.querySelectorAll("li"))})(t).forEach(e=>{e.classList.toggle(l,e.idx===t.idx)})}document.addEventListener("click",(function(t){this.active_menu&&!this.active_menu.contains(t.target)&&(h(),this.active_menu=void 0)}));function h(){Array.from(document.querySelectorAll(".fp-engine")).forEach(t=>{const e=t.root.querySelector("details[open].fp-menu-container");e&&(e.open=!1,t.root.classList.toggle("has-menu-opened",!1))})}class y{init(i,o,s){const a=d(o,{class:"fp-cc",summaryTitle:s.i18n("cc.button","CC"),menuTitle:s.i18n("cc.menu_title","Subtitles")}),l=s._subtitles={tracks:[],textTracks:[],activeTracks:[],trackEles:[],view:e(s),menu:a,select:function(t){const e=l.activeTracks.slice(0);l.activeTracks.length=0;const i=a.querySelector("summary");if(~e.indexOf(t))return null==i||i.classList.toggle("fp-color-text",!1),n(l.view,[]);null==i||i.classList.toggle("fp-color-text",!0),l.activeTracks.push(t),t.mode="hidden",s.emit("cuechange",{track:t})}};function u(){var t;null===(t=a.querySelector("li"))||void 0===t||t.click()}s.on("mount",(function(){var t;const e=o.querySelector(".fp-controls");if(!e)return null===(t=o.querySelector(".fp-ui"))||void 0===t?void 0:t.appendChild(l.view);e.insertAdjacentElement("beforebegin",l.view),e.appendChild(a)})),s.on("config",(function(e){var n;if(!(null===(n=e.data)||void 0===n?void 0:n.subtitles))return;const i=t(e,"data.subtitles.tracks",[]);if(l.tracks===i)return;l.tracks=i,l.trackEles.forEach((function(t){t.parentNode&&t.parentNode.removeChild(t)}));const o=l.activeTracks.slice(0);var r;o.length&&l.select(o[0]),f(a,[]),m(r=a.querySelector("ol"),r.idx),l.trackEles=l.tracks.map((function(t){return c(s,t)}))})),s.textTracks.addEventListener("addtrack",()=>{let e;const n=l.textTracks=Array.from(s.textTracks).filter((function(t){return~["captions","subtitles","descriptions"].indexOf(t.kind)})).map((function(t){return"showing"===t.mode&&(e=t,t.mode="disabled"),t.oncuechange=t.oncuechange||function(t){s.emit(t.type,{track:t.target})},t}));f(a,n.map((function(t){return{text:t.label,onclick:l.select.bind(0,t)}}))),1===n.length?a.addEventListener("click",u):a.removeEventListener("click",u);t(i,"subtitles.show")&&e&&a.querySelectorAll("li")[n.indexOf(e)].click()}),s.on("cuechange",(function(e){const i=t(e,"data.track");if(!~l.activeTracks.indexOf(i))return;const o=Array.from(t(i,"activeCues",[]));n(l.view,o)})),r(s)}}return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;"function"==typeof n?n(e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e))}(window,y),y}));
|