@flowplayer/player 3.0.1-canary.8 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/core/autoplay-enum.d.ts +5 -0
  2. package/core/autoplay-enum.js +9 -0
  3. package/core/events.d.ts +12 -0
  4. package/core/events.js +9 -0
  5. package/core/quality-enum.d.ts +5 -0
  6. package/core/quality-enum.js +9 -0
  7. package/core.js +2 -2
  8. package/default.js +2 -2
  9. package/drm/constants.d.ts +12 -0
  10. package/drm/constants.js +15 -0
  11. package/drm/types.d.ts +46 -0
  12. package/drm/types.js +3 -0
  13. package/embed.js +93 -93
  14. package/flowplayer.css +1 -1
  15. package/index.d.ts +53 -4
  16. package/package.json +15 -2
  17. package/plugins/ads.js +2 -2
  18. package/plugins/airplay.js +1 -1
  19. package/plugins/analytics.js +1 -1
  20. package/plugins/asel.js +1 -1
  21. package/plugins/audio.js +1 -1
  22. package/plugins/chapters.js +1 -1
  23. package/plugins/chromecast.js +1 -1
  24. package/plugins/context-menu.js +1 -1
  25. package/plugins/cuepoints.js +1 -1
  26. package/plugins/dash.js +2 -2
  27. package/plugins/drm.js +1 -1
  28. package/plugins/endscreen.js +1 -1
  29. package/plugins/fas.js +1 -1
  30. package/plugins/float-on-scroll.js +1 -1
  31. package/plugins/gemius.js +1 -1
  32. package/plugins/google-analytics.js +1 -1
  33. package/plugins/health.js +1 -1
  34. package/plugins/hls.js +2 -2
  35. package/plugins/id3.js +1 -1
  36. package/plugins/iframe.js +1 -1
  37. package/plugins/keyboard.js +1 -1
  38. package/plugins/media-session.js +1 -1
  39. package/plugins/message.js +1 -1
  40. package/plugins/ovp.js +1 -1
  41. package/plugins/playlist.js +1 -1
  42. package/plugins/preview.js +1 -1
  43. package/plugins/qsel.js +1 -1
  44. package/plugins/qul.js +1 -1
  45. package/plugins/share.js +1 -1
  46. package/plugins/speed.js +1 -1
  47. package/plugins/ssai.js +1 -0
  48. package/plugins/subtitles.js +1 -1
  49. package/plugins/thumbnails.js +1 -1
  50. package/util/loader.d.ts +8 -0
  51. package/util/loader.js +43 -0
@@ -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";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}));
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 l=n.sort||s,r=null!==(i=n.mode)&&void 0!==i?i:e.FIFO;return t=l(t.slice(0),r),{mode:r,sort:l,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 s(t,n){return(n&e.SHUFFLE)==e.SHUFFLE?t.sort((function(){return Math.random()-Math.random()})):t.slice(0)}function l(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 r={PLAYLIST_NEXT:"playlist:next",PLAYLIST_PREVIOUS:"playlist:previous",PLAYLIST_SELECTION:"playlist:selection",PLAYLIST_LOOP:"playlist:loop",PLAYLIST_ENDED:"playlist:ended",PLAYLIST_READY:"playlist:ready",PLAYLIST_ADD:"playlist:add",PLAYLIST_REMOVE:"playlist:remove",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(Object.assign(Object.assign({},e),{playlist:n}));u(t,{should_play:n.should_play},e)}(t,i,n),o&&n.autoplay?t.togglePlay(!0):o?t.setState("is-starting",!0):!o&&n.advance?function(t,e,n){var i;const o=setTimeout(n,e.delay||0);null!==(i=e.delay)&&void 0!==i&&i&&t.emit(r.PLAYLIST_INTERSTITIAL,{timer:o,config:e})}(t,n,(function(){t.paused&&(t.setState("is-seamless",!0),t.togglePlay(!0))})):void t.emit(r.PLAYLIST_INTERSTITIAL,{config:n})}function u(t,e,n){var i,o;const s=null===(i=t.playlist)||void 0===i?void 0:i.queue;if(s&&(s.idx=s.members.indexOf(n)),n.src&&t.setSrc(n.src),t.emit(r.PLAYLIST_NEXT,n),null!==(o=e.should_play)&&void 0!==o&&o)return t.togglePlay(!0)}function c(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}function p(t,e){const n=t.style;return Object.keys(e).forEach(t=>n[t]=e[t]),t}function d(t,e,n){return t.setAttribute(e,n),t}function f(t,e){return t.classList.add(...e.split(" ")),t}function y(t,e,n){return e.split(" ").forEach(e=>t.classList.toggle(e,n)),t}function m(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}const h=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const i=window.customElements.get(e);if(!i)throw new Error(`no default flowplayer component with the name ${e} exists`);const o=window.customElements.get(n);return"function"!=typeof o?i:o})(t._customElements,e))(t),L=(t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)};function v(t,e){if(!e[t])return;const n=document.createElement("span");n.innerText=e[t];const i=m(t);return i.append(n),i}function w(t){return Math.min(100*t,100)+"%"}function E(t){const e=m("fp-interstitial"),n=c(t,"flowplayer-middle");null==n||n.append(e),t.on(r.PLAYLIST_INTERSTITIAL,(function(i){const s=i.data;t.setState("is-interstitial",!0);const l=t.playlist&&o(t.playlist.queue);if(!l)return;s&&n&&e.append(...function(t,e,n,i){const o=m("left");o.append(h(t,"flowplayer-play-icon")),e.poster&&(o.style.backgroundImage=["url(",e.poster,")"].join(""));const s=m("right"),l=m("up-next"),r=document.createElement("span");r.innerText=t.i18n("playlist.up_next");const a=m("fp-color","countdown");l.append(r,a),s.append(l);const u=v("title",e);u&&s.append(u);const c=v("description",e);if(c&&s.append(c),i.timer){const e=m("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),s.append(e)}return[o,s]}(t,l,0,s)),t.once("play",t=>{e.innerHTML=""});t.opt("playlist",{}).advance&&s&&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,s=Date.now()+o;let l=Date.now();const r=Math.ceil(1e3/60);!function i(){const a=Date.now();if(a>s||!t.paused)return;if(!e.timer)return p(n,{width:w(0)});requestAnimationFrame(i),a-l<r||(l=a,p(n,{width:w(1-(s-a)/o)}))}()}(t,s,e.querySelector(".countdown"))})),t.on(["src","playing","waiting"],(function(){t.emit(r.PLAYLIST_INTERSTITIAL_END)})),t.on(r.PLAYLIST_INTERSTITIAL_END,(function(){t.setState("is-interstitial",!1)}))}const I={translation_key:"core.skip-next",name:"fp-skip-next"},T={translation_key:"core.skip-prev",name:"fp-skip-prev"};class Pipe{constructor(t){this.data=t}static of(t){return new Pipe(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 Pipe(this.data)}fmap(t,...e){const n=t.apply(this,[this.data,...e]);return new Pipe(n)}unwrap(){return this.data}}function x(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 A(e,n){Pipe.of(e).fmap(x).fmap(t,n)}function b(t){return void 0!==t}function P(t){return"string"==typeof t}function g(t){return"object"==typeof t}function S(t){return t instanceof HTMLElement}function _(t){var e;A("Config must be an Object",b(t)&&g(t)),A("property `playlist` is required",b(t.playlist)),A("property `playlist` was not a String(MediaId)",P(t.playlist)||(e=t.playlist,A("playlist property was not of type PlaylistId|Array(MediaId|PlayConfig)",Array.isArray(e)),A("playlist property cannot be an empty Array",e.length>0),!e.forEach((function(t,e){A("item at playlist["+e+"] was not valid",P(t)||g(t))})))),"loop shuffle".split(" ").forEach((function(e){b(t[e])&&A(e+" must be a boolean value if present","boolean"==typeof t[e])})),b(t.delay)&&A("property `delay` must be a Number (Milliseconds)","number"==typeof t.delay)}function O(t){try{_(t)}catch(t){return!1}return!0}class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}class FlowplayerIcon extends FlowplayerComponent{constructor(t,e){super(t),this.classList.add("fp-icon",e.name),e.title&&this.setAttribute("title",e.title),e.title&&this.setAttribute("aria-label",e.title),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}function q(t,e){return{queue:e,events:r,play:function(e){this.queue.idx=e,u(t,{should_play:!0},o(this.queue))},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){const n=this.queue;return n.members[e]?n.idx===e?console.warn("operation failed: you cannot remove current playlist item"):(n.members.splice(e,1),n.last_idx=n.members.length-1,e<n.idx&&--n.idx,void t.emit(r.PLAYLIST_REMOVE,{index:e})):console.warn("there is no playlist item at this index")},push:function(...e){const n=t.root;if(0==this.queue.idx&&n.classList.contains("is-interstitial"))return console.warn("new items cannot be added when playlist has ended.");const i=this.queue.members;i.push(...e),this.queue.last_idx=i.length-1,t.emit(r.PLAYLIST_ADD,{members:e})},clear:function(){this.queue.members=[],this.queue.plays--,function(t,e){t.playlist&&(e=t.playlist.queue=l(e),t.emit(r.PLAYLIST_READY,{queue:e,should_play:!1}))}(t,this.queue)}}}function Y(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(){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 F=["touchstart","touchmove"];function k(t,e,n){const i=function(t,e){const n=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(n,"data",{get:()=>e}),n}(e,n);return t.dispatchEvent(i),t}function N(t,e,n,i){Array.isArray(e)?e.forEach(e=>D(t,e,n,i)):D(t,e,n,i)}function D(t,e,n,i){if(o=e,!~F.indexOf(o))return t.addEventListener(e,n,i),t;var o;const s=Object.assign(i||{},{passive:!0});return t.addEventListener(e,n,s),t}class FlowplayerPlaylistControls extends FlowplayerComponent{constructor(t){super(t),t.on(r.PLAYLIST_READY,e=>{const n=Y(e,"data.queue",Y(t,"playlist.queue"));n&&this.list(n,t)}),t.on(r.PLAYLIST_NEXT,e=>{var n;e.data&&(null===(n=t.playlist)||void 0===n?void 0:n.queue)&&Array.from(this.querySelectorAll("li")).forEach((e,n)=>{var i;n===(null===(i=t.playlist)||void 0===i?void 0:i.queue.idx)?e.className="is-current":e.className="is-queued"})}),t.on(["playing","pause"],t=>{const e=this.querySelector(".is-current");e&&(e.classList.toggle("is-playing","playing"===t.type),e.classList.toggle("is-paused","flowplayer-pause-icon"===t.type))}),t.on(r.PLAYLIST_ADD,e=>{var n;const i=null===(n=t.playlist)||void 0===n?void 0:n.queue;if(!e.data||!i)return;e.data.members.forEach(e=>{const n=this.videoRow(e,t);n&&this.append(n)})}),t.on(r.PLAYLIST_REMOVE,t=>{if(!t.data)return;const e=Array.from(this.querySelectorAll("li"))[t.data.index];e&&this.removeChild(e)})}list(t,e){this.innerHTML="",f(this,"fp-playlist"),t.members.forEach(t=>{const n=this.videoRow(t,e);n&&this.append(n)})}videoRow(t,e){if(!t.title)return;const n=document.createElement("li");var i,o;return n.classList.add("is-queued"),n.onclick=this.videoRow_onclick.bind(this,n,t,e),i=n,o=[m("fp-color"),this.videoInfo(t),this.buttons(t,e)],i.append(...o),n}videoRow_onclick(t,e,n){if(t.classList.contains("is-current"))return n.togglePlay(!n.playerState["is-playing"]);k(this,r.PLAYLIST_SELECTION,{video:e})}videoInfo(t){const e=m("video-info"),n=v("title",t);n&&e.append(n);const i=v("description",t);return i&&e.append(i),e}buttons(t,e){const n=m("video-buttons"),i=h(e,"flowplayer-play-icon"),o=h(e,"flowplayer-pause-icon");return n.append(i,o),t.poster&&(n.style.backgroundImage=["url(",t.poster,")"].join("")),n}}function R(t){const n=h(t,"flowplayer-skip-previous-icon");d(n,"role","button"),N(n,"click",(function(){t.playlist&&t.playlist.prev()}));const o=h(t,"flowplayer-skip-next-icon");d(o,"role","button"),N(o,"click",(function(){t.playlist&&t.playlist.next()}));const s=m("fp-playlist-prev-preview"),l=m("fp-playlist-next-preview"),a=c(t,"flowplayer-control-buttons");return a&&(a.prepend(n),a.append(o),a.append(s),a.append(l)),t.on("reap",(function(){t.skip_controls=void 0})),"flowplayer-skip-previous-icon"===n.localName&&"flowplayer-skip-next-icon"===o.localName&&t.on([r.PLAYLIST_NEXT,r.PLAYLIST_ADD,r.PLAYLIST_REMOVE],(function(n){const o=Y(n,"data.queue",Y(t,"playlist.queue"));if(!o)return;a&&(y(a,"is-prev-button-disabled",!o.idx),y(a,"is-next-button-disabled",o.idx===o.last_idx));const r=o.idx<o.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)]}(o):null,u=o.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)]}(o):null;l.style.backgroundImage=["url(",r?r.poster:null,")"].join(""),s.style.backgroundImage=["url(",u?u.poster:null,")"].join("")})),{prevButton:n,nextButton:o,prevPreview:s,nextPreview:l}}class Playlist{constructor(t){L(t,"flowplayer-playlist-controls",FlowplayerPlaylistControls),L(t,"flowplayer-skip-next-icon",class extends FlowplayerIcon{constructor(t){super(t,I)}}),L(t,"flowplayer-skip-previous-icon",class extends FlowplayerIcon{constructor(t){super(t,T)}})}init(e,n,o){const s=e.playlist||{};s.delay="number"==typeof s.delay?1e3*s.delay:1e4,o.setOpts(Object.assign(Object.assign({},e),{playlist:s})),function(e,n){if(!n)return;n.skip_controls&&(e.skip_controls=R(e));const i=function(e){let n=null;if(i=e.controls,!P(i)&&!S(i))return;var i;S(e.controls)?n=e.controls:P(e.controls)&&(n=document.querySelector(e.controls));return t("Could not find controls by Selector["+e.controls+"]",S(n)),n}(n);if(!i)return;const o=h(e,"flowplayer-playlist-controls");if(i.append(o),o.addEventListener(r.PLAYLIST_SELECTION,t=>{var n;const i=null===(n=t.detail)||void 0===n?void 0:n.video;i&&u(e,{should_play:!0},i)}),!(o instanceof FlowplayerPlaylistControls))return;const s=e.opt("playlist",{});f(i,"fp-playlist-controls "+(s.theme||"fp-dark"));const l=e.root.className.split(" ").filter((function(t){return t.match(/^use-play/)})).pop();l&&f(i,l)}(o,e.playlist),E(o),function(t){t.on(r.PLAYLIST_READY,(function(e){var n,i;const o=t.opt("playlist",{}),s=null===(n=e.data)||void 0===n?void 0:n.queue,l=null===(i=e.data)||void 0===i?void 0:i.should_play;s&&o&&(t.playlist=q(t,s),l&&a(t,s,o))})),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(r.PLAYLIST_ENDED),!e.loop)return;if(!t.playlist)return;const n=t.playlist.queue=l(t.playlist.queue);t.emit(r.PLAYLIST_LOOP),a(t,n,e)}(t,n):void(0!=n.advance&&a(t,t.playlist.queue,n))}),0)}))}(o)}onload(t,i,o,s){!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")}(t.playlist||{},s.items,(function(t){o.setState("is-playlist",!0),o.emit(r.PLAYLIST_READY,{queue:t,should_play:0===o.currentSrc.length})}))}wants(t,e,n){return"flowplayer/playlist"==e.type&&!!e.items&&O(Object.assign(Object.assign({},n),{playlist:e.items}))}}return Playlist.events=r,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,Playlist),Playlist}));
@@ -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.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)}));
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,t=2;var i=Object.freeze({__proto__:null,MOUSEOVER:e,MOBILE_VIEWPORT_VISIBLE:t,VIEWPORT_VISIBLE:4});function n(e,t,i){const n=function(e,t){const i=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(i,"data",{get:()=>t}),i}(t,i);return e.dispatchEvent(n),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){}}();const o=[];function r(e){const t=e.getBoundingClientRect(),i=window.innerHeight,n=t.height,o=t.bottom,r=n/5;return t.top<=r&&t.top+n>i-r||o-n+r>=0&&o<i+r}function s(e){const t=r(e.root);return e.in_viewport===t||(e.in_viewport=t,n(e,t?"viewenter":"viewleave")),e}window.addEventListener("scroll",(function(){o.forEach(s)}));class PreviewPlugin{constructor(){this.disablePreview=this.disablePreview.bind(this),this.enablePreview=this.enablePreview.bind(this)}init(e,t,i){i.on("config",({data:e})=>{e&&this.configure(e)}),this.configure(e),this.root=t,this.player=i}configure(i){var n,o,s,l;if(!1===i.preview||!i.poster)return this.shutdown();if(void 0===i.preview)return;this.shutdown(),this.config=i;const{type:a="image/gif",trigger:u=e|t,src:d}=i.preview;if(!/^image/.test(a))return console.warn("flowplayer[preview] - only image/* supported");this.previewSource=d,e&u&&(null===(n=this.root)||void 0===n||n.addEventListener("mouseenter",this.enablePreview),null===(o=this.root)||void 0===o||o.addEventListener("mouseleave",this.disablePreview)),(4&u||function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",i=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),n=/Android/.test(t)&&!/Firefox/.test(t),o=/^((?!chrome|android).)*safari/i.test(t),r=/SamsungBrowser/.test(t),s=r&&/SMART-TV/.test(t);return{controls:!i,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:n,iphone:i,safari:o,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:r,samsung_tv:r&&s,touch:!!("ontouchstart"in window)}}().touch&&t&u)&&(null===(s=this.player)||void 0===s||s.on("viewenter",this.enablePreview),null===(l=this.player)||void 0===l||l.on("viewleave",this.disablePreview),this.root&&r(this.root)&&this.enablePreview())}shutdown(){var e,t,i,n;null===(e=this.root)||void 0===e||e.removeEventListener("mouseenter",this.enablePreview),null===(t=this.root)||void 0===t||t.removeEventListener("mouseleave",this.disablePreview),null===(i=this.player)||void 0===i||i.off("viewenter",this.enablePreview),null===(n=this.player)||void 0===n||n.off("viewleave",this.disablePreview)}enablePreview(){this.root&&(this.root.style.backgroundImage=`url('${this.previewSource}')`)}disablePreview(){this.root&&this.config&&(this.root.style.backgroundImage=`url('${this.config.poster}')`)}}return PreviewPlugin.trigger=i,function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const i=e.flowplayer;return"function"==typeof i?(i(t),t):(Array.isArray(i.extensions)||(i.extensions=[]),~i.extensions.indexOf(t)||i.extensions.push(t),t)}(window,PreviewPlugin)}));
package/plugins/qsel.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.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="&times;",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)})}})}));
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,t,n){const s=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;s.length;){if(null==e)return n;const t=s.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}const t=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const s=window.customElements.get(t);if(!s)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const n="fp-on",s="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.olEle=document.createElement("ol"),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menu.classList.add("fp-menu"),this.menu.append(this.closeEle,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.innerHTML="&times;",this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",(function(t){t.preventDefault();const n=this.open;n||(i(),document.active_menu=this),this.open=!n,e.root.classList.toggle("has-menu-opened",!n)})),this.append(this.menuContainer)}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.className=`${e.class} ${s}`,this.menuContainer.classList.add("fp-menu-container"),this.menuContainer.setAttribute("aria-controls",e.id||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)),this.menuContainer.setAttribute("aria-label",e.menuTitle||""),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const n=t(this.player,e.summaryIcon);n.setAttribute("tabindex",""),this.summaryEle.append(n)}if(e.menuTitle){const t=document.createElement("h3");t.textContent=e.menuTitle,this.menu.prepend(t)}this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.classList.toggle(s,!(null==e?void 0:e.length)))}menuOption(e,t){const n=document.createElement("li");n.setAttribute("tabindex","0"),n.setAttribute("role","menuitem"),e.icon&&n.append(e.icon);const s=document.createElement("span");s.textContent=e.text,n.append(s),n.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(n)}select_item(e){this.options.forEach((t,s)=>{t.classList.toggle(n,s===e&&("flowplayer-subtitles-menu"!==this.localName||!t.classList.contains(n)))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(n)})}}function i(){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 o(e,t,n){const s=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(s),e}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(i(),this.active_menu=void 0)})),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){}}();class Qsel{constructor(e){this.quality_options=[],((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,"flowplayer-quality-menu",FlowplayerMenu)}init(n,s,i){if(!1===n.qsel)return;const r=t(i,"flowplayer-quality-menu");r instanceof FlowplayerMenu&&r.setMenuAttrs({summaryTitle:"HD",menuTitle:i.i18n("qsel.menu_title"),class:"<fp-qsel",options_event:Qsel.events.TRACKS,item_selected_event:Qsel.events.SWITCH}),i.on("mount",(function(){var e;null===(e=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(i,"flowplayer-control"))||void 0===e||e.append(r)})),i.on("qualities",t=>{if(!Array.isArray(t.data))return;const s=t.data,a=e(n,"qsel.labels",[]);this.quality_options=s.filter((e,t)=>!("boolean"==typeof a[t]&&!a[t])),o(r,Qsel.events.TRACKS,this.quality_options.map((e,t)=>{let n=e.height?e.height+"p":e.text;return"number"==typeof e.height&&e.height>719&&(n+=" HD"),{text:a[t]||n,onclick:l.bind(0,i,e)}}))}),i.on("quality:set",e=>{var t;if("number"!=typeof(null===(t=e.data)||void 0===t?void 0:t.level))return;const n=this.quality_options.length,s=-1===e.data.level?n-1:n-2-e.data.level;o(r,Qsel.events.SWITCH,{selected_index:s})})}}function l(e,t){e.emit("quality:set",t)}return Qsel.events={TRACKS:"quality:tracks",SWITCH:"quality:update"},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,Qsel)}));
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="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);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)}));
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";var e;!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(e||(e={}));const n="application/vnd.apple.mpegURL";document.createElement("video").canPlayType(n);function t(e){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,touch:!!("ontouchstart"in window)}}().video(n)&&(null===(t=null==e?void 0:e.hls)||void 0===t?void 0:t.native)}function o(e,n){n.id&&clearInterval(n.id)}function i(e,n){r(e.original_src,(t,i,r)=>{if(200!=i)return o(0,n),t?e.emit("error",t):e.emit("error",{code:i,resp:r})})}function r(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 d(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(s(o.pathname,0),i+"/"+s(o.pathname,0))].join("")}class QULPlugin{init(e,n,s){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)||s.deviceId();let f,p=null===(c=e.qul)||void 0===c?void 0:c.token;const m={};s.on("src",(function(n){var r;n.data&&(f=null===(r=n.data)||void 0===r?void 0:r.src,o(0,m),"string"==typeof f&&f.match(/\.m3u8$/)&&p&&(n.data.src=d(f,p,v),t(e)&&Object.assign(m,function(e,n){var t;const r=(null===(t=null==n?void 0:n.qul)||void 0===t?void 0:t.interval)||2e4,d={interval:Math.min(2e4,r)};return e.once("reap",(function(){o(0,d)})),d.id=setInterval(i,d.interval,e,d),setTimeout(i,0,e,d),d}(s,s.opts))))})),s.on("config",(function(e){var n,t,o,i,r,a;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===(a=null===(r=e.data)||void 0===r?void 0:r.qul)||void 0===a?void 0:a.dId);u&&u!==p&&function(e,n){p=e,s.setSrc({type:"application/x-mpegurl",src:d(f,p,n)})}(u,l)})),s.on("error",(function(e){var n,t;const i=((null===(n=e.data)||void 0===n?void 0:n.code)||"").toString();if(!i.match(/^(qul|http)/))return;o(0,m),e.preventDefault(),s.setState("is-error",!0);const d=null===(t=e.data)||void 0===t?void 0:t.resp,u=function(e,n){const t=e._customElements.get(n);return t&&e.root.querySelector(t)||void 0}(s,"flowplayer-ui");if(d)return a(s,u,d,i);r(s.original_src,(e,n,t)=>{if(e)return s.emit("error",e);!isNaN(Number(n))&&Number(n)<400||a(s,u,t,null==n?void 0:n.toString())})}))}}function a(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 CustomEvent(e,{detail:n,cancelable:!0});return n&&Object.defineProperty(t,"data",{get:()=>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 s(e,n){return e.split("/").reverse().slice(0,n+1).reverse().join("/")}return QULPlugin.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,QULPlugin)}));
package/plugins/share.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.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="&times;",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}));
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"},s={name:"fp-twitter"};function i(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 l(e){if("string"==typeof e.link)return e.link;const t=document.querySelector("link[rel=canonical]");return t?t.href:window.location.toString()}class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class FlowplayerIcon extends FlowplayerComponent{constructor(e,t){super(e),this.classList.add("fp-icon",t.name),t.title&&this.setAttribute("title",t.title),t.title&&this.setAttribute("aria-label",t.title),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}const a=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const o=window.customElements.get(t);if(!o)throw new Error(`no default flowplayer component with the name ${t} exists`);const s=window.customElements.get(n);return"function"!=typeof s?o:s})(e._customElements,t))(e),c=(e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)},u="flowplayer-share-menu",p="fp-on",d="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.olEle=document.createElement("ol"),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menu.classList.add("fp-menu"),this.menu.append(this.closeEle,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.innerHTML="&times;",this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",(function(t){t.preventDefault();const n=this.open;n||(m(),document.active_menu=this),this.open=!n,e.root.classList.toggle("has-menu-opened",!n)})),this.append(this.menuContainer)}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.className=`${e.class} ${d}`,this.menuContainer.classList.add("fp-menu-container"),this.menuContainer.setAttribute("aria-controls",e.id||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)),this.menuContainer.setAttribute("aria-label",e.menuTitle||""),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=a(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}if(e.menuTitle){const t=document.createElement("h3");t.textContent=e.menuTitle,this.menu.prepend(t)}this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.classList.toggle(d,!(null==e?void 0:e.length)))}menuOption(e,t){const n=document.createElement("li");n.setAttribute("tabindex","0"),n.setAttribute("role","menuitem"),e.icon&&n.append(e.icon);const o=document.createElement("span");o.textContent=e.text,n.append(o),n.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(n)}select_item(e){this.options.forEach((t,n)=>{t.classList.toggle(p,n===e&&("flowplayer-subtitles-menu"!==this.localName||!t.classList.contains(p)))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(p)})}}function m(){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 h(e,t,n){const o=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(o),e}function f(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(m(),this.active_menu=void 0)})),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){}}();class Share{constructor(i){this.umd=i,this.share_options=[],c(i,u,FlowplayerMenu),c(this.umd,"flowplayer-facebook-icon",class extends FlowplayerIcon{constructor(t){super(t,e)}}),c(this.umd,"flowplayer-twitter-icon",class extends FlowplayerIcon{constructor(e){super(e,s)}}),c(this.umd,"flowplayer-link-icon",class extends FlowplayerIcon{constructor(e){super(e,t)}}),c(this.umd,"flowplayer-embed-icon",class extends FlowplayerIcon{constructor(e){super(e,o)}}),c(this.umd,"flowplayer-share-icon",class extends FlowplayerIcon{constructor(e){super(e,n)}})}init(e,t,n){const o=a(n,u);o instanceof FlowplayerMenu&&o.setMenuAttrs({menuTitle:n.i18n("share.menu_title"),class:"fp-share-menu fp-togglable",summaryIcon:"flowplayer-share-icon",icons:!0,options_event:Share.events.OPTIONS});const s={prev_config:0,webshare_listener:0};n.on("mount",(function(){var e;null===(e=f(n,t.classList.contains("logo-on-right")?"flowplayer-header-right-zone":"flowplayer-header-left-zone"))||void 0===e||e.append(o),o instanceof FlowplayerMenu&&o.menuContainer.addEventListener("toggle",(function(){t.classList.toggle("is-share-menu",this.open);const e=f(n,"flowplayer-control");this.open&&(t.classList.contains("is-small")?n.pause():e&&function(e,t){if(!t)return;e.menu.style.maxHeight=t.getBoundingClientRect().top+parseFloat(window.getComputedStyle(t).getPropertyValue("padding"))-e.menuContainer.getBoundingClientRect().bottom+"px"}(o,e))}))})),n.on("config",t=>{const c=i(t,"data.share",{});if(!1===c)return o instanceof FlowplayerMenu&&void o.classList.remove("webshare-enabled");if(s.prev_config===c)return;if(s.prev_config=c,o instanceof FlowplayerMenu&&function(){try{return"https:"===window.location.protocol&&"function"==typeof navigator.share}catch(e){return!1}}()&&i(c,"web_share",!0))return function(e){e.classList.add("webshare-enabled")}(o),s.webshare_listener||function(e,t,n){n.webshare_listener=!0,t.addEventListener("click",(function(){if(!t.classList.contains("webshare-enabled"))return;t.menuContainer.open=!1;navigator.share({title:i(e,"share.title",document.title),text:i(e,"share.text",r()),url:l(i(e,"share",{}))}).catch((function(){}))}))}(e,o,s);this.share_options=[];const u="string"==typeof c.link?c.link:window.location.toString();if(c.iframe){const e="string"==typeof c.iframe?c.iframe:u;this.share_options.push(y(n,o,"share.embed",b.bind(null,e,n),a(n,"flowplayer-embed-icon")))}c.link&&this.share_options.push(y(n,o,"share.link",_.bind(null,u),a(n,"flowplayer-link-icon"))),c.facebook&&this.share_options.push(y(n,o,"Facebook",E.bind(null,u),a(n,"flowplayer-facebook-icon"))),c.twitter&&this.share_options.push(y(n,o,"Twitter",v.bind(null,u),a(n,"flowplayer-twitter-icon"))),h(o,Share.events.OPTIONS,this.share_options)})}add_options(e,...t){const n=e.root.querySelector(u);n&&t.forEach(t=>{const o=y(e,n,t.text,t.onclick,t.icon);n.menuOption(o,n.options.length)})}}function y(e,t,n,o,s){return{text:w(e,n),icon:s,onclick:g.bind(null,e,t,o)}}function w(e,t){return 0===t.indexOf("share.")?e.i18n(t):t}function g(e,t,n){t instanceof FlowplayerMenu&&t.unselect_item();const o=n();o.success&&o.message&&e.message&&e.emit(e.message.events.SHOW_MESSAGE,{message:o.message})}function b(e,t){const n=t.videoHeight/t.videoWidth;return _('<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 _(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 E(e){return x("https://www.facebook.com/sharer.php?u="+encodeURIComponent(e)),{success:!0}}function v(e){return x("https://twitter.com/intent/tweet?url="+encodeURIComponent(e)),{success:!0}}function x(e){let t;const n=screen.height,o=screen.width,s=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="+s+",top="+t)}return Share.events={OPTIONS:"share:options"},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,Share),Share}));
package/plugins/speed.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.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="&times;",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)}));
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,t,n){const s=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;s.length;){if(null==e)return n;const t=s.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const t="flowplayer-speed-menu",n=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const s=window.customElements.get(t);if(!s)throw new Error(`no default flowplayer component with the name ${t} exists`);const o=window.customElements.get(n);return"function"!=typeof o?s:o})(e._customElements,t))(e),s="fp-on",o="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.olEle=document.createElement("ol"),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menu.classList.add("fp-menu"),this.menu.append(this.closeEle,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.innerHTML="&times;",this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",(function(t){t.preventDefault();const n=this.open;n||(i(),document.active_menu=this),this.open=!n,e.root.classList.toggle("has-menu-opened",!n)})),this.append(this.menuContainer)}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.className=`${e.class} ${o}`,this.menuContainer.classList.add("fp-menu-container"),this.menuContainer.setAttribute("aria-controls",e.id||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)),this.menuContainer.setAttribute("aria-label",e.menuTitle||""),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=n(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}if(e.menuTitle){const t=document.createElement("h3");t.textContent=e.menuTitle,this.menu.prepend(t)}this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.classList.toggle(o,!(null==e?void 0:e.length)))}menuOption(e,t){const n=document.createElement("li");n.setAttribute("tabindex","0"),n.setAttribute("role","menuitem"),e.icon&&n.append(e.icon);const s=document.createElement("span");s.textContent=e.text,n.append(s),n.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(n)}select_item(e){this.options.forEach((t,n)=>{t.classList.toggle(s,n===e&&("flowplayer-subtitles-menu"!==this.localName||!t.classList.contains(s)))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(s)})}}function i(){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 l(e,t,n){const s=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(s),e}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(i(),this.active_menu=void 0)})),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){}}();class Speed{constructor(e){((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,t,FlowplayerMenu)}init(s,o,i){let c=void 0;const a=n(i,t);a instanceof FlowplayerMenu&&a.setMenuAttrs({menuTitle:i.i18n("speed.menu_title"),summaryTitle:"1x",class:"fp-speed",options_event:Speed.events.OPTIONS}),i.on("config",()=>{const t=e(s,"speed",!0);if(t===c)return;if(c=t,0==t)return l(a,Speed.events.OPTIONS,[]);const n=e(s,"speed.options",Speed.DEFAULT_SPEED_OPTIONS),o=e(s,"speed.labels",[]);l(a,Speed.events.OPTIONS,Array.from({length:n.length}).map((e,t)=>{const s=n[t];return{text:o[t]||s+"x",onclick:r.bind(0,i,s)}}))}),i.on("mount",(function(){var e;null===(e=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(i,"flowplayer-control"))||void 0===e||e.append(a)}))}}function r(e,n){var s;const o=null===(s=e.root.querySelector(t))||void 0===s?void 0:s.summaryEle;o&&(o.textContent=n+"x"),isNaN(n)||(e.playbackRate=n)}return Speed.DEFAULT_SPEED_OPTIONS=[.2,.5,1,2,10],Speed.events={OPTIONS:"speed:options"},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,Speed)}));
@@ -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.ssai=t())}(this,(function(){"use strict";function e(e,t){const n=document.createElement("div");n.classList.add("ad-ui","ssai");const i=function(e){const t=document.createElement("div");return t.classList.add("skippable-button","disabled"),e.append(t),t}(n),r=function(e){const t=document.createElement("div");return t.classList.add("timeline"),e.append(t),t}(n),s=function(e,t){const n=document.createElement("div");return n.classList.add("resume"),e.append(n),n.addEventListener("click",e=>t.togglePlay(!0)),n}(n,t);return e.append(n),{container:n,timeline:r,resume:s,skippable:i}}const t="function"==typeof HTMLMediaElement&&Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"currentTime");function n(e){var n;if(t)return null===(n=null==t?void 0:t.get)||void 0===n?void 0:n.call(e)}function i(e,n){var i;if(t)return null===(i=null==t?void 0:t.set)||void 0===i?void 0:i.call(e,n)}const r="function"==typeof HTMLMediaElement&&Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"duration");function s(e){var t;if(r)return null===(t=null==r?void 0:r.get)||void 0===t?void 0:t.call(e)}var a;function o(e,t){var n;const i=null===(n=e.ssai)||void 0===n?void 0:n.state;return i?{ok:t(i)}:{err:a.NotAvailable}}!function(e){e[e.NotAvailable=0]="NotAvailable"}(a||(a={}));var c=Object.freeze({__proto__:null,SSAI_AD_START:"ssai:ad:start",SSAI_AD_END:"ssai:ad:end",SSAI_AD_PROGRESS:"ssai:ad:progress"});function u(e,t){e.setState("ssai-ad-active",!0),e.emit("ssai:ad:start"),o(e,e=>e.adProgress={currentTime:0,duration:t}),p(e)}function d(e,t){e.ssai&&(o(e,e=>e.adProgress=t),function(e,{currentTime:t,duration:n}){if(void 0===n)return;const{timeline:i}=e,r=t/n*100,s=i.style.getPropertyValue("--ssai-percent-complete");i.classList.remove("go"),i.style.setProperty("--ssai-percent-previous",s),i.style.setProperty("--ssai-percent-complete",r.toFixed(3)),i.classList.add("go")}(e.ssai.ui,t),e.emit("ssai:ad:progress",t))}function l(e){if(!e.ssai)return;const{state:t,ui:n}=e.ssai;e.setState("ssai-ad-active",!1),function(e){const{timeline:t}=e;t.classList.remove("go"),"--ssai-percent-complete --ssai-percent-previous".split(" ").forEach(e=>t.style.setProperty(e,"0"))}(n),o(e,e=>delete e.adProgress),e.emit("ssai:ad:end"),p(e),"number"==typeof t.snapbackTime&&(i(e,t.snapbackTime),delete t.snapbackTime)}function p(e){e.videoHeight&&e.videoWidth&&e.setOpts({ratio:e.videoHeight/e.videoWidth})}function f(e){const t=e.ssai.ui,r=new google.ima.dai.api.StreamManager(function(e){const t=document.createElement("video");return Object.defineProperty(t,"currentTime",{get:function(){return n(e)},set:function(t){return i(e,t)}}),Object.defineProperty(t,"duration",{get:function(){return s(e)},set:function(){}}),t.addEventListener=function(t,n){e.addEventListener(t,n)},t}(e),t.container);return r.addEventListener([google.ima.dai.api.StreamEvent.Type.LOADED,google.ima.dai.api.StreamEvent.Type.ERROR,google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED,google.ima.dai.api.StreamEvent.Type.AD_PROGRESS,google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED,google.ima.dai.api.StreamEvent.Type.CLICK],t=>{!function(e,t,n,i){switch(i.type){case google.ima.dai.api.StreamEvent.Type.LOADED:return function(e,t){const n=t.getStreamData();if(e.setOpts({dvr:!1}),n.url)return e.setSrc(n.url);if(n.errorMessage)return e.emit("error",{message:n.errorMessage});return e.emit("error",{message:"dai content was unavailable"})}(e,i);case google.ima.dai.api.StreamEvent.Type.ERROR:return function(e,t,n){if(n)return e.setSrc(n);e.emit("error",{message:"error loading stream"})}(e,0,e.opt("dai.backup"));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED:return u(e);case google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED:return l(e);case google.ima.dai.api.StreamEvent.Type.AD_PROGRESS:{const t=i.getStreamData();return t.adProgressData&&d(e,t.adProgressData)}case google.ima.dai.api.StreamEvent.Type.CLICK:return function(e,t,n){if(e.paused)return e.play();e.pause()}(e);default:console.warn("[flowplayer.dai] unhandled event=%s\n%o",i.type,i)}}(e,0,0,t)},!1),e.on("ID3",({data:e})=>{e&&Array.isArray(e.cues)&&e.cues.forEach(e=>{const t={},n=e.value;t[n.key]=n.data,r.onTimedMetadata(t)})}),{streamManager:r}}function m(e,t){return"string"==typeof t.assetKey?function(e,t){const n=new google.ima.dai.api.LiveStreamRequest;n.assetKey=t.assetKey||"",n.apiKey=t.apiKey||"",e.requestStream(n)}(e,t):function(e,t){const n=new google.ima.dai.api.VODStreamRequest;n.contentSourceId=t.contentSrcId||"",n.videoId=t.videoId||"",n.apiKey=t.apiKey||"",e.requestStream(n)}(e,t)}var g=Object.freeze({__proto__:null,exists:function(){var e,t;return!!(null===(t=null===(e=window.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.dai)},init:function(e,t){t.ssai&&Object.assign(t.ssai,f(t))},srcIsValid:function(e){return"google/dai"==e.type&&!!(e.videoId||e.contentSrcId||e.assetKey)},onload:function(e,t){var n;(null===(n=e.ssai)||void 0===n?void 0:n.streamManager)&&m(e.ssai.streamManager,t)},getContentCurrentTime:function(e){const t=e.ssai.streamManager,i=n(e);return t?t.contentTimeForStreamTime(i):i},setContentCurrentTime:function(e,t){if(.1==t)return;const n=e.ssai.streamManager;return i(e,n?n.streamTimeForContentTime(t):t)},getContentDuration:function(e){const t=e.ssai.streamManager,n=s(e);return t?t.contentTimeForStreamTime(n):n},getPreviousActiveAdStart:function(e,t){const n=e.ssai.streamManager.previousCuePointForStreamTime(t);if(n&&!n.played)return n.start}});const v=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends v.AnalyticEventObserver{constructor(e){super(),this.video=e}onAdvertBreakStart(e){const t=e.getDuration();if(!e.isActive()&&t){const e=n(this.video);i(this.video,e+t/1e3)}u(this.video,e.getStart())}onAdvertBreakEnd(){l(this.video)}onAdvertStart(e){}onAdvertEnd(){}onTrackingEvent(e){}}function y(e,t){YospaceAdManagement.SessionVOD.create(e,t.ssai.properties,e=>{const i=e.getPayload();if(i.getSessionResult()===YospaceAdManagement.SessionResult.INITIALISED){t.ssai.session=i;const e=new EventObserver(t);i.addAnalyticObserver(e),t.setSrc({src:i.getPlaybackUrl()}),setInterval(()=>{const e=1e3*n(t);i.onPlayheadUpdate(e),function(e,t,n){const i=e.getCurrentAdBreak();if(!i)return;const r={currentTime:n-i.getStart(),duration:i.getDuration()};d(t,r)}(i,t,e)},250)}else console.warn("YoSpace Failed to initialise session. ResultCode = "+i.getResultCode())})}const S=[g,Object.freeze({__proto__:null,exists:function(){return!!window.YospaceAdManagement},init:function(e,t){t.ssai&&Object.assign(t.ssai,function(){const e=new YospaceAdManagement.SessionProperties;return e.setUserAgent(navigator.userAgent),{properties:e}}())},srcIsValid:function(e){return"yospace"==e.type},onload:function(e,t){t&&t.src&&y(t.src,e)},getContentCurrentTime:function(e){const t=n(e),i=e.ssai.session;return i?i.getContentPositionForPlayhead(1e3*t)/1e3:t},setContentCurrentTime:function(e,t){const n=e.ssai.session;return i(e,n?n.getPlayheadForContentPosition(1e3*t)/1e3:t)},getContentDuration:function(e){const t=e.ssai.session,n=s(e);return t?t.getContentPositionForPlayhead(t.getDuration())/1e3:n},getPreviousActiveAdStart:function(e,t){const n=e.ssai.session;if(!n)return;const i=n.getAdBreaks();let r;const s=1e3*t;return i.forEach(e=>{void 0===r&&e.getStart()<s&&e.isActive()&&(r=e)}),void 0!==r?r.getStart()/1e3:void 0}})];class Ssai{init(t,r,a){S.forEach(t=>{!a.ssai&&t.exists()&&(a.ssai={provider:t,ui:e(r,a),state:{snapback:!1}},t.init(r,a),function(e){Object.defineProperty(e,"currentTime",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.currentTime:e.ssai.provider.getContentCurrentTime(e)}return n(e)},set:function(t){if(e.ssai){if(e.ssai.state.adProgress)return;return e.ssai.provider.setContentCurrentTime(e,t)}}}),Object.defineProperty(e,"duration",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.duration:e.ssai.provider.getContentDuration(e)}return s(e)},set:function(){}})}(a),a.on("seeked",()=>function(e){if(e.opt("live"))return;if(!e.ssai)return;const{provider:t,state:r}=e.ssai;if(r.snapback)return r.snapback=!1;const s=n(e),a=t.getPreviousActiveAdStart(e,s);void 0!==a&&(r.snapback=!0,r.snapbackTime=s,i(e,a))}(a)))})}onload(e,t,n,i){var r;(null===(r=n.ssai)||void 0===r?void 0:r.provider)&&n.ssai.provider.onload(n,i)}wants(e,t,n){let i=!1;return S.forEach(e=>{if(!i&&e.exists()&&e.srcIsValid(t))return i=!0}),i}}return Ssai.events=c,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,Ssai),Ssai}));
@@ -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";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="&times;",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}));
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.subtitles=t())}(this,(function(){"use strict";function e(e,t,n){const o=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;o.length;){if(null==e)return n;const t=o.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}function t(e,t){e.innerHTML="",t.forEach((function(t){const n=document.createElement("pre");n.classList.add("fp-cue"),function(e,t){const n=e.style,o=t.size;n.setProperty("--caption-size",o.toString());const i=t.position;i&&"auto"!==i&&t?n.setProperty("--caption-position",i.toString()):n.removeProperty("--caption-position");const s="captions-align-"+t.align;Array.from(e.classList).forEach((function(n){n!=s&&("captions-vertical"==n&&t.vertical||n.startsWith("captions")&&e.classList.remove(n))})),e.classList.add(s),e.classList.toggle("captions-vertical",!!t.vertical)}(e,t),n.appendChild(t.getCueAsHTML()),e.appendChild(n)}))}var n;function o(e,t){if(function(e){return Object.values(n).includes(e)}(t=t||n.Anonymous))return"crossOrigin"in e?e.crossOrigin=t:e.setAttribute("crossorigin",t),e}function i(e){const t=document.createElement("a");return t.href=e,t.origin}function s(e,t){const n=document.createElement("track");n.className="fp-track renderable",n.kind=t.kind||"captions",n.id=["fp",t.lang].join("-");const s=n.track;return"string"!=typeof t.crossorigin&&function(e,t){try{return e.src.startsWith("blob:"),i(e.src)!==i(t)}catch(e){return console.error(e),!0}}(e,t.src)&&(o(e),t.crossorigin=e.getAttribute("crossorigin")),"crossorigin"in t&&o(e,t.crossorigin),Object.keys(t).forEach(e=>{n[e]=t[e]}),s.mode=t.default?"showing":t.mode||"disabled",n.onload=function(){},s.oncuechange=function(t){e.emit(t.type,{track:t.target})},e.appendChild(n),n}!function(e){e.Anonymous="anonymous",e.UseCredentials="use-credentials",e.Empty=""}(n||(n={}));function r(e){(function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",n=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),o=/Android/.test(t)&&!/Firefox/.test(t),i=/^((?!chrome|android).)*safari/i.test(t),s=/SamsungBrowser/.test(t),r=s&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:o,iphone:n,safari:i,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:s,samsung_tv:s&&r,touch:!!("ontouchstart"in window)}})().ios&&(e.on("fullscreenenter",(function(){Array.from(e.textTracks).forEach((function(e){e.mode="hidden"===e.mode?"showing":"disabled"}))})),e.on("fullscreenexit",(function(){Array.from(e.textTracks).forEach((function(e){e.mode="showing"===e.mode?"hidden":"disabled"}))})))}const c=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const o=window.customElements.get(t);if(!o)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(n);return"function"!=typeof i?o:i})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const l="flowplayer-subtitles-menu",a="fp-on",u="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.olEle=document.createElement("ol"),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menu.classList.add("fp-menu"),this.menu.append(this.closeEle,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.innerHTML="&times;",this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",(function(t){t.preventDefault();const n=this.open;n||(d(),document.active_menu=this),this.open=!n,e.root.classList.toggle("has-menu-opened",!n)})),this.append(this.menuContainer)}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.className=`${e.class} ${u}`,this.menuContainer.classList.add("fp-menu-container"),this.menuContainer.setAttribute("aria-controls",e.id||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)),this.menuContainer.setAttribute("aria-label",e.menuTitle||""),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=c(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}if(e.menuTitle){const t=document.createElement("h3");t.textContent=e.menuTitle,this.menu.prepend(t)}this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.classList.toggle(u,!(null==e?void 0:e.length)))}menuOption(e,t){const n=document.createElement("li");n.setAttribute("tabindex","0"),n.setAttribute("role","menuitem"),e.icon&&n.append(e.icon);const o=document.createElement("span");o.textContent=e.text,n.append(o),n.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(n)}select_item(e){this.options.forEach((t,n)=>{t.classList.toggle(a,n===e&&(this.localName!==l||!t.classList.contains(a)))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(a)})}}function d(){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 m(e,t,n){const o=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(o),e}function f(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(d(),this.active_menu=void 0)})),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){}}();class Subtitles{constructor(e){((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,l,FlowplayerMenu)}init(n,o,i){const a=c(i,l);a instanceof FlowplayerMenu&&a.setMenuAttrs({class:"fp-cc",summaryTitle:i.i18n("cc.button","CC"),menuTitle:i.i18n("cc.menu_title","Subtitles"),options_event:Subtitles.events.TRACKS,item_selected_event:Subtitles.events.SWITCH});const u=function(e){const t=document.createElement("div");return t.classList.add("fp-captions"),t.ontouchend=t=>e.emit(t.type),t.onclick=t=>e.emit(t.type),t}(i);let d,p=[],h=[];function y(e){var t;if(e==d)return v();v(),null===(t=i.root.querySelector(l))||void 0===t||t.summaryEle.classList.add("fp-color-text"),e.mode="hidden",d=e,i.emit("cuechange",{track:e})}function v(){var e;d&&(null===(e=i.root.querySelector(l))||void 0===e||e.summaryEle.classList.remove("fp-color-text"),d.mode="disabled",d=void 0,t(u,[]))}i.on("mount",(function(){var e;const t=f(i,"flowplayer-control");if(!t)return null===(e=f(i,"flowplayer-ui"))||void 0===e?void 0:e.appendChild(u);t.insertAdjacentElement("beforebegin",u),t.append(a),a instanceof FlowplayerMenu&&a.menuContainer.addEventListener("click",()=>{var e;1===h.length&&(null===(e=a.querySelector("li"))||void 0===e||e.click())})})),i.on("config",(function(e){var t,n;const o=null===(n=null===(t=e.data)||void 0===t?void 0:t.subtitles)||void 0===n?void 0:n.tracks;o&&p!==o&&(p=o,0===p.length&&(m(a,Subtitles.events.TRACKS,[]),v(),h=[]),Array.from(i.querySelectorAll(".fp-track")).forEach(e=>{i.removeChild(e)}),p.forEach(e=>s(i,e)))})),i.textTracks.addEventListener("addtrack",()=>{const t=Array.from(i.textTracks);if(h.length===t.length&&h.every((e,n)=>e===t[n]))return;let o;const s=t.filter((function(e){return~["captions","subtitles","descriptions"].indexOf(e.kind)})).map((function(e){return~["showing","hidden"].indexOf(e.mode)&&(o=e,e.mode="disabled"),e.oncuechange=e.oncuechange||function(e){i.emit(e.type,{track:e.target})},e}));m(a,Subtitles.events.TRACKS,s.map((function(e){return{text:e.label,onclick:y.bind(0,e)}}))),h=s;const r=e(n,"subtitles.show");if(o=(!1!==r?o:void 0)||h.find(e=>e.label===(null==d?void 0:d.label)),!o)return v();y(o),m(a,Subtitles.events.SWITCH,{selected_index:h.indexOf(o)})}),i.on("cuechange",(function(n){var o;const i=null===(o=n.data)||void 0===o?void 0:o.track,s=Array.from(e(i,"activeCues",[])).filter((e,t,n)=>t===n.findIndex(t=>e.id===t.id)).sort((e,t)=>"number"!=typeof e.line||"number"!=typeof t.line?0:e.line-t.line);t(u,s)})),r(i)}}return Subtitles.events={TRACKS:"subs:tracks",SWITCH:"subs:change"},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,Subtitles),Subtitles}));
@@ -1 +1 @@
1
- !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=t.flowplayer||{},t.flowplayer.thumbnails=n())}(this,(function(){"use strict";var t;function n(n,e){if(function(n){return Object.values(t).includes(n)}(e=e||t.Anonymous))return"crossOrigin"in n?n.crossOrigin=e:n.setAttribute("crossorigin",e),n}function e(t){const n=document.createElement("a");return n.href=t,n.origin}!function(t){t.Anonymous="anonymous",t.UseCredentials="use-credentials",t.Empty=""}(t||(t={}));function r(t,n){return t.querySelector("track[id='"+n+"']")}function i(t,r){const i=document.createElement("track");return i.src=r,function(t,n){try{return t.src.startsWith("blob:"),e(t.src)!==e(n)}catch(t){return console.error(t),!0}}(t,r)&&(t.setAttribute("poster","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),n(t),n(i)),i}function o(t,n){if(function(t,n){return t.querySelector("track[src='"+n+"']")}(t,n))return;!function(t){const n=r(t,"thumbnails");n&&n.remove()}(t);const e=i(t,n);return e.kind="metadata",e.id="thumbnails",e.src=n,t.append(e),e}function u(t){const n=document.createElement("a");return n.href=t,n}const s=/#xywh=(\d+),(\d+),(\d+),(\d+)$/,c=/^(https:|https:|\/)/;function a(t,n){const e=u(t.src),r=u(n),[i,o,c,a,f]=(r.hash.match(s)||[]).map(t=>parseInt(t,10));return{x:o,y:c,w:a,h:f,url:l(n,e)}}function l(t,n){if(t.match(c))return t;try{return new URL(t,n.href).toString()}catch(t){return""}}var f=Object.freeze({__proto__:null,THUMBNAILS_RENDER:"thumbnails:render"});class d{constructor(t){this.data=t}static of(t){return new d(t)}static maybe(t,n,...e){return null==t?t:n.apply(t,[t,...e])}tap(t,...n){return t.apply(this,[this.data,...n]),new d(this.data)}fmap(t,...n){const e=t.apply(this,[this.data,...n]);return new d(e)}unwrap(){return this.data}}function m(t,n){const e=document.createElement("div");return e.classList.add("thumbnail",n),t.append(e),e}function p(t,n){const e=t.style;e.backgroundImage=`url("${n.url}")`,e.backgroundPositionX="-"+n.x+"px ",e.backgroundPositionY="-"+n.y+"px",e.height=n.h+"px",e.width=n.w+"px"}class h{init(t,n,e){if(!e.reaper)return;const i=function(t){const n=t.querySelector(".fp-ui"),e=t.querySelector(".fp-controls");if(!n||!e)return;const r=document.createElement("div");return r.classList.add("fp-thumbnail-carousel"),n.insertBefore(r,e),{container:r,previous:m(r,"previous"),current:m(r,"current"),next:m(r,"next")}}(n);i&&(e.once("mount",(function(){!function(t,n){n.querySelector(".fp-timeline")&&(t.on("timeline/gesture/move",({data:n})=>{const e=null==n?void 0:n.percent;if("number"!=typeof e)return;if(!Number.isFinite(t.duration))return;const r=d.of(t.duration*(e/100)).fmap(Math.min,t.duration).fmap(Math.max,0).unwrap();requestAnimationFrame(()=>{t.emit("thumbnails:render",{timestamp:r})})}),t.on("timeline/gesture/end",()=>{n.classList.remove("with-thumbnails")}))}(e,n)})),e.on("thumbnails:render",(function({data:t}){if(!e.reaper)return;const o=null==t?void 0:t.timestamp;if("number"!=typeof o)return;const u=r(e,"thumbnails");if(!u)return;const s=function(t,n){var e,r;const i=Array.from(t.track.cues||{length:0}),o=i.find(t=>t.startTime<=n&&n<=t.endTime);if(!o)return{};const u=i.indexOf(o);return{previous:a(t,(null===(e=i[u-1])||void 0===e?void 0:e.text)||""),current:a(t,(null==o?void 0:o.text)||""),next:a(t,(null===(r=i[u+1])||void 0===r?void 0:r.text)||"")}}(u,o);!function(t,n,{previous:e,current:r,next:i}){t.classList.add("with-thumbnails"),e&&p(n.previous,e),r&&p(n.current,r),i&&p(n.next,i)}(n,i,s)})),e.textTracks.addEventListener("addtrack",(function(t){const n=t.track;"thumbnails"===(null==n?void 0:n.id)&&(n.mode="hidden")})),e.on("config",(function(){var n;const r=null===(n=null==t?void 0:t.thumbnails)||void 0===n?void 0:n.src;if("string"==typeof r)return o(e,r)})))}}return h.events=f,function(t,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;"flowplayer"in t||(t.flowplayer={extensions:[]});const e=t.flowplayer;"function"==typeof e?e(n):(Array.isArray(e.extensions)||(e.extensions=[]),~e.extensions.indexOf(n)||e.extensions.push(n))}(window,h),h}));
1
+ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=t.flowplayer||{},t.flowplayer.thumbnails=n())}(this,(function(){"use strict";var t;function n(n,e){if(function(n){return Object.values(t).includes(n)}(e=e||t.Anonymous))return"crossOrigin"in n?n.crossOrigin=e:n.setAttribute("crossorigin",e),n}function e(t){const n=document.createElement("a");return n.href=t,n.origin}!function(t){t.Anonymous="anonymous",t.UseCredentials="use-credentials",t.Empty=""}(t||(t={}));function r(t,n){return t.querySelector("track[id='"+n+"']")}function i(t,r){const i=document.createElement("track");return i.src=r,function(t,n){try{return t.src.startsWith("blob:"),e(t.src)!==e(n)}catch(t){return console.error(t),!0}}(t,r)&&(t.setAttribute("poster","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),n(t),n(i)),i}function o(t,n){if(function(t,n){return t.querySelector("track[src='"+n+"']")}(t,n))return;!function(t){const n=r(t,"thumbnails");n&&n.remove()}(t);const e=i(t,n);return e.kind="metadata",e.id="thumbnails",e.src=n,t.append(e),e}function u(t){const n=document.createElement("a");return n.href=t,n}const s=/#xywh=(\d+),(\d+),(\d+),(\d+)$/,a=/^(https:|https:|\/)/;function c(t,n){const e=u(t.src),r=u(n),[i,o,a,c,f]=(r.hash.match(s)||[]).map(t=>parseInt(t,10));return{x:o,y:a,w:c,h:f,url:l(n,e)}}function l(t,n){if(t.match(a))return t;try{return new URL(t,n.href).toString()}catch(t){return""}}var f=Object.freeze({__proto__:null,THUMBNAILS_RENDER:"thumbnails:render"});class Pipe{constructor(t){this.data=t}static of(t){return new Pipe(t)}static maybe(t,n,...e){return null==t?t:n.apply(t,[t,...e])}tap(t,...n){return t.apply(this,[this.data,...n]),new Pipe(this.data)}fmap(t,...n){const e=t.apply(this,[this.data,...n]);return new Pipe(e)}unwrap(){return this.data}}function d(t,n){const e=t._customElements.get(n);return e&&t.root.querySelector(e)||void 0}function m(t,n){const e=document.createElement("div");return e.classList.add("thumbnail",n),t.append(e),e}function p(t,n){const e=t.style;e.backgroundImage=`url("${n.url}")`,e.backgroundPositionX="-"+n.x+"px ",e.backgroundPositionY="-"+n.y+"px",e.height=n.h+"px",e.width=n.w+"px"}class Thumbnails{init(t,n,e){if(!e.reaper)return;const i=function(t){const n=d(t,"flowplayer-ui"),e=d(t,"flowplayer-control");if(!n||!e)return;const r=document.createElement("div");return r.classList.add("fp-thumbnail-carousel"),n.insertBefore(r,e),{container:r,previous:m(r,"previous"),current:m(r,"current"),next:m(r,"next")}}(e);i&&(e.once("mount",(function(){!function(t,n){d(t,"flowplayer-timeline-bar")&&(t.on("timeline/gesture/move",({data:n})=>{const e=null==n?void 0:n.percent;if("number"!=typeof e)return;if(!Number.isFinite(t.duration))return;const r=Pipe.of(t.duration*(e/100)).fmap(Math.min,t.duration).fmap(Math.max,0).unwrap();requestAnimationFrame(()=>{t.emit("thumbnails:render",{timestamp:r})})}),t.on("timeline/gesture/end",()=>{n.classList.remove("with-thumbnails")}))}(e,n)})),e.on("thumbnails:render",(function({data:t}){if(!e.reaper)return;const o=null==t?void 0:t.timestamp;if("number"!=typeof o)return;const u=r(e,"thumbnails");if(!u)return;const s=function(t,n){var e,r;const i=Array.from(t.track.cues||{length:0}),o=i.find(t=>t.startTime<=n&&n<=t.endTime);if(!o)return{};const u=i.indexOf(o);return{previous:c(t,(null===(e=i[u-1])||void 0===e?void 0:e.text)||""),current:c(t,(null==o?void 0:o.text)||""),next:c(t,(null===(r=i[u+1])||void 0===r?void 0:r.text)||"")}}(u,o);!function(t,n,{previous:e,current:r,next:i}){t.classList.add("with-thumbnails"),e&&p(n.previous,e),r&&p(n.current,r),i&&p(n.next,i)}(n,i,s)})),e.textTracks.addEventListener("addtrack",(function(t){const n=t.track;"thumbnails"===(null==n?void 0:n.id)&&(n.mode="hidden")})),e.on("config",(function(){var n;const r=null===(n=null==t?void 0:t.thumbnails)||void 0===n?void 0:n.src;if("string"==typeof r)return o(e,r)})))}}return Thumbnails.events=f,function(t,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;"flowplayer"in t||(t.flowplayer={extensions:[]});const e=t.flowplayer;"function"==typeof e?e(n):(Array.isArray(e.extensions)||(e.extensions=[]),~e.extensions.indexOf(n)||e.extensions.push(n))}(window,Thumbnails),Thumbnails}));
@@ -0,0 +1,8 @@
1
+ import { PluginCtor } from "../types/plugin";
2
+ /**
3
+ * adds support for asynchronous plugin loading`
4
+ * issue/127
5
+ */
6
+ export declare function define(root: any, plugin: PluginCtor): new (umd: import("../types").Flowplayer.FlowplayerUMD, player: import("../types").Flowplayer.Player) => import("../types/plugin").AnyPlugin;
7
+ export declare function root(): {};
8
+ export declare function modules(): any;
package/util/loader.js ADDED
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modules = exports.root = exports.define = void 0;
4
+ /**
5
+ * adds support for asynchronous plugin loading`
6
+ * issue/127
7
+ */
8
+ function define(root, plugin) {
9
+ // handle cjs setups
10
+ if (typeof exports === "object" && typeof module !== "undefined")
11
+ return plugin;
12
+ if (!("flowplayer" in root))
13
+ root.flowplayer = { extensions: [] };
14
+ var self = root.flowplayer;
15
+ if (typeof self === "function") {
16
+ self(plugin);
17
+ return plugin;
18
+ }
19
+ if (!Array.isArray(self.extensions))
20
+ self.extensions = [];
21
+ if (!~self.extensions.indexOf(plugin))
22
+ self.extensions.push(plugin);
23
+ return plugin;
24
+ }
25
+ exports.define = define;
26
+ function root() {
27
+ if (typeof window !== "undefined")
28
+ return window;
29
+ // eslint-disable-next-line no-undef
30
+ if (typeof global !== "undefined")
31
+ return global;
32
+ return {};
33
+ }
34
+ exports.root = root;
35
+ function modules() {
36
+ var self = root();
37
+ // naively check for existance of flowplayer umd
38
+ var mod = self.flowplayer ? self.flowplayer : { extensions: [] };
39
+ if (!Array.isArray(mod.extensions))
40
+ mod.extensions = [];
41
+ return mod;
42
+ }
43
+ exports.modules = modules;