@flowplayer/player 3.43.1-rc → 3.43.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.js +1 -1
- package/default.js +1 -1
- package/embed.js +2 -2
- package/package.json +1 -1
- package/plugins/ads.js +2 -2
- package/plugins/airplay.js +1 -1
- package/plugins/analytics.js +1 -1
- package/plugins/asel.js +1 -1
- package/plugins/audio.js +1 -1
- package/plugins/chapters.js +1 -1
- package/plugins/chromecast.js +1 -1
- package/plugins/consent.js +1 -1
- package/plugins/context-menu.js +1 -1
- package/plugins/cuepoints.js +1 -1
- package/plugins/dash.js +2 -2
- package/plugins/drm.js +1 -1
- package/plugins/endscreen.js +1 -1
- package/plugins/fas.js +1 -1
- package/plugins/float-on-scroll.js +1 -1
- package/plugins/hls.d.ts +25 -2
- package/plugins/hls.js +1 -1
- package/plugins/id3.js +1 -1
- package/plugins/iframe.js +1 -1
- package/plugins/keyboard.js +1 -1
- package/plugins/media-session.js +1 -1
- package/plugins/message.js +1 -1
- package/plugins/playlist.js +1 -1
- package/plugins/preview.js +1 -1
- package/plugins/qsel.js +1 -1
- package/plugins/qul.js +1 -1
- package/plugins/rts.js +2 -2
- package/plugins/share.js +1 -1
- package/plugins/speed.js +1 -1
- package/plugins/ssai.js +1 -1
- package/plugins/subtitles.js +1 -1
- package/plugins/thumbnails.js +1 -1
- package/plugins/tizen.js +1 -1
- package/plugins/webos.js +1 -1
package/plugins/drm.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.drm=t())}(this,function(){"use strict";const e="com.widevine.alpha",t="com.microsoft.playready",n="org.w3.clearkey",r="com.apple.fps.1_0",s="license_server",o="http_headers",i="certificate",a="vendor",c="query_params";var d=Object.freeze({__proto__:null,WIDEVINE:e,PLAYREADY:t,CLEARKEY:n,FAIRPLAY:r,LICENSE_SERVER:s,HTTP_HEADERS:o,CERTIFICATE:i,VENDOR:a,REQUEST_MEDIA_KEY_SYSTEM_ACCESS_FUNCTION:"request_media_key_system_access_function",QUERY_PARAMS:c,KEY:"key",KEY_ID:"kid"});function u(){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),r=/Android/.test(t)&&!/Firefox/.test(t),s=/^((?!chrome|android).)*safari/i.test(t),o=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),i=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),a=/edg/i.test(t),c=/opr|opera/i.test(t),d=/SamsungBrowser/.test(t),u=d&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:r,iphone:n,safari:s,edge:a,opera:c,chrome:o,firefox:i,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:d,samsung_tv:d&&u,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window,anyTv:"tizen"in window||"webos"in window}}function f(s){const o={};return Object.keys(s).forEach(function(i){(function(s){const o=u();switch(s){case e:return o.chrome||o.firefox||o.edge||o.opera;case n:return o.chrome||o.firefox;case r:return o.safari;case t:return o.edge}})(i)&&function(e,t,n){Object.assign(n,t),n.emeEnabled=!0,t.request_media_key_system_access_function&&(n.requestMediaKeySystemAccessFunc=t.request_media_key_system_access_function);const s=t.http_headers;s&&(n.licenseXhrSetup=function(e){Object.keys(s).forEach(function(t){e.setRequestHeader(t,s[t])})}),n.drmSystems=n.drmSystems||{},Object.assign(n.drmSystems,{[e===r?"com.apple.fps":e]:{licenseUrl:t.license_server,serverCertificateUrl:t.certificate}})}(i,s[i],o)}),o}function l(r){const i={};return Object.keys(r).forEach(function(a){(function(r){const s=u();switch(r){case e:return s.chrome||s.firefox||s.edge||s.opera;case n:return s.chrome||s.firefox;case t:return s.edge}})(a)&&(i[a]=function(e){return Object.assign({serverURL:e[s],httpRequestHeaders:e[o]},e)}(r[a]))}),i}const y=(e,t)=>fetch(e,t).then(h).then(e=>new Uint8Array(e)),h=e=>{if(e.ok)return e.arrayBuffer();throw m(e)},m=e=>new Error(`http:error status=${e.status} during key retrieval`);var p=Object.freeze({__proto__:null,fairplay_fetch_certificate:(e,t)=>{y(e).then(t)},fairplay_request_license:function(e,t,n){const r=((e,t)=>e.includes(t.assetId)&&Object.keys(t.queryParams||{}).find(t=>e.includes(t))?e:e.includes(t.assetId)?`${e}?${new URLSearchParams(t.queryParams).toString()}`:`${e}/${t.assetId}?${new URLSearchParams(t.queryParams).toString()}`)(e,t);y(r,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:t.message}).then(n)}});var _
|
|
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.drm=t())}(this,function(){"use strict";const e="com.widevine.alpha",t="com.microsoft.playready",n="org.w3.clearkey",r="com.apple.fps.1_0",s="license_server",o="http_headers",i="certificate",a="vendor",c="query_params";var d=Object.freeze({__proto__:null,WIDEVINE:e,PLAYREADY:t,CLEARKEY:n,FAIRPLAY:r,LICENSE_SERVER:s,HTTP_HEADERS:o,CERTIFICATE:i,VENDOR:a,REQUEST_MEDIA_KEY_SYSTEM_ACCESS_FUNCTION:"request_media_key_system_access_function",QUERY_PARAMS:c,KEY:"key",KEY_ID:"kid"});function u(){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),r=/Android/.test(t)&&!/Firefox/.test(t),s=/^((?!chrome|android).)*safari/i.test(t),o=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),i=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),a=/edg/i.test(t),c=/opr|opera/i.test(t),d=/SamsungBrowser/.test(t),u=d&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:r,iphone:n,safari:s,edge:a,opera:c,chrome:o,firefox:i,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:d,samsung_tv:d&&u,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window,anyTv:"tizen"in window||"webos"in window}}function f(s){const o={};return Object.keys(s).forEach(function(i){(function(s){const o=u();switch(s){case e:return o.chrome||o.firefox||o.edge||o.opera;case n:return o.chrome||o.firefox;case r:return o.safari;case t:return o.edge}})(i)&&function(e,t,n){Object.assign(n,t),n.emeEnabled=!0,t.request_media_key_system_access_function&&(n.requestMediaKeySystemAccessFunc=t.request_media_key_system_access_function);const s=t.http_headers;s&&(n.licenseXhrSetup=function(e){Object.keys(s).forEach(function(t){e.setRequestHeader(t,s[t])})}),n.drmSystems=n.drmSystems||{},Object.assign(n.drmSystems,{[e===r?"com.apple.fps":e]:{licenseUrl:t.license_server,serverCertificateUrl:t.certificate}})}(i,s[i],o)}),o}function l(r){const i={};return Object.keys(r).forEach(function(a){(function(r){const s=u();switch(r){case e:return s.chrome||s.firefox||s.edge||s.opera;case n:return s.chrome||s.firefox;case t:return s.edge}})(a)&&(i[a]=function(e){return Object.assign({serverURL:e[s],httpRequestHeaders:e[o]},e)}(r[a]))}),i}const y=(e,t)=>fetch(e,t).then(h).then(e=>new Uint8Array(e)),h=e=>{if(e.ok)return e.arrayBuffer();throw m(e)},m=e=>new Error(`http:error status=${e.status} during key retrieval`);var p=Object.freeze({__proto__:null,fairplay_fetch_certificate:(e,t)=>{y(e).then(t)},fairplay_request_license:function(e,t,n){const r=((e,t)=>e.includes(t.assetId)&&Object.keys(t.queryParams||{}).find(t=>e.includes(t))?e:e.includes(t.assetId)?`${e}?${new URLSearchParams(t.queryParams).toString()}`:`${e}/${t.assetId}?${new URLSearchParams(t.queryParams).toString()}`)(e,t);y(r,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:t.message}).then(n)}});var _=Object.freeze({__proto__:null,fairplay_fetch_certificate:(e,t)=>{y(e).then(t)},fairplay_request_license:function(e,t,n){const r=new FormData;var s;r.set("assetid",t.assetId),r.set("spc",(s=t.message,btoa(Array.prototype.map.call(s,function(e){return String.fromCharCode(e)}).join("")))),fetch(e,{method:"POST",body:r,headers:t.headers}).then(e=>{if(e.ok)return e.text();throw m(e)}).then(e=>function(e){const t=atob(e),n=new Uint8Array(t.length);return Array.prototype.forEach.call(t,function(e,t){n[t]=e.charCodeAt(0)}),n}(e)).then(n)}}),w=Object.freeze({__proto__:null,ezdrm:p,buydrm:_});function g(e,t,n){const d=t[r],u=null==d?void 0:d[i];if(!d||!u)return;if(e.src&&0===e.src.indexOf("blob:"))return;const f=d[a]||"ezdrm",l="string"==typeof f?w[f]:f;l.fairplay_fetch_certificate(u,function(i){e.webkitSetMediaKeys(new window.WebKitMediaKeys(r));const a=n.initData,u=function(e){const t=function(e){const t=new Uint16Array(e);return String.fromCharCode(...t)}(e.buffer);return t.substring(t.indexOf("skd:")+6).split(";").pop()}(a);if(!u)return console.debug("flowplayer::drm::fairplay - unable to extract content id from init data");const f=function(e,t,n){"string"==typeof t&&(t=function(e){const t=new ArrayBuffer(2*e.length),n=new Uint16Array(t);return Array(...Array(e.length)).map((e,t)=>t).forEach(t=>{n[t]=e.charCodeAt(t)}),n}(t));let r=0;const s=new ArrayBuffer(e.byteLength+4+t.byteLength+4+n.byteLength),o=new DataView(s),i=new Uint8Array(s,r,e.byteLength);i.set(e),r+=e.byteLength,o.setUint32(r,t.byteLength,!0),r+=4;const a=new Uint16Array(s,r,t.length);a.set(t),r+=a.byteLength,o.setUint32(r,n.byteLength,!0),r+=4;return new Uint8Array(s,r,n.byteLength).set(n),new Uint8Array(s,0,s.byteLength)}(a,u,i),y=e.webkitKeys.createSession("application/x-mpegurl",f);y.addEventListener("webkitkeyerror",console.debug.bind(console,"webkitkeyerror")),y.addEventListener("webkitkeymessage",function(e){const n={message:e.message,assetId:u,headers:d[o]||{},queryParams:t[r][c]||{}};l.fairplay_request_license(d[s],n,e=>y.update(e))})})}const b=1,v=.001;const A=new WeakMap;function E(e,t,n="used"){var r;const s=`${t}:${n}`,o=null!==(r=A.get(e))&&void 0!==r?r:new Set;if(o.has(s))return;o.add(s),A.set(e,o);const i=()=>function(e,{feature_name:t,behavior:n,sample_rate:r}){t&&(r||(r=b),e.emit("flowplayer:feature",{feature_name:t,behavior:n,sample_rate:r}))}(e,{feature_name:t,behavior:n,sample_rate:v});e.opt("metadata.media_id")?i():e.once("health:ready",i)}var S;const k=((S=class DRM{init(e,t,n){let r;n.on("webkitneedkey",e=>g(n,r.drm||{},e)),n.on("src",t=>{var s;r=t.detail,(null===(s=t.detail)||void 0===s?void 0:s.drm)&&E(n,"drm"),function(e){var t,n,r,s,o;null===(t=e.hls)||void 0===t||delete t.drmSystems,null===(n=e.hls)||void 0===n||delete n.licenseXhrSetup,null===(r=e.hls)||void 0===r||delete r.requestMediaKeySystemAccessFunc,null===(s=e.hls)||void 0===s||delete s.drmSystemOptions,null===(o=e.hls)||void 0===o||delete o.emeEnabled}(e),this.hls_drm(n,e,t.detail.drm),this.dash_drm(n,e,t.detail.drm)})}hls_drm(e,t,n){if(!n)return;const r=f(n);e.setOpts({hls:Object.assign(t.hls||{},r)})}dash_drm(e,t,n){if(!n)return;const r=t.dash||{},s=l(n);e.setOpts({dash:Object.assign(r,{drm:s})})}}).pluginName="drm",S);Object.assign(k,d);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,k)});
|
package/plugins/endscreen.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=t.flowplayer||{},t.flowplayer.endscreen=e())}(this,function(){"use strict";const t="interstitial/end",e="interstitial/cancel",s="interstitial/next_item";function n(t,e){const s=t._customElements.get(e);return s&&t.root.querySelector(s)||void 0}const i=(t,e)=>new(((t,e)=>{const s=t.get(e);if(!s)throw new Error(`no flowplayer component with the name ${e} exists`);const n=window.customElements.get(e);if(!n)throw new Error(`no default flowplayer component with the name ${e} exists`);const i=window.customElements.get(s);return"function"!=typeof i?n:i})(t._customElements,e))(t),r=(t,e,s)=>{window.customElements.get(e)||window.customElements.define(e,s),t.customElements.get(e)||t.customElements.set(e,e)},o="flowplayer-endscreen-interstitial",l="flowplayer-endscreen-up-next",a="flowplayer-endscreen-grid",d="ended",c="recommendations:render",p="recommendations:hide",u="recommendationsready";var h=Object.freeze({__proto__:null,RECOMMENDATIONS_RENDER:c,RECOMMENDATIONS_HIDE:p,RECOMMENDATIONS_READY:u});class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}const m=(t,e)=>{const s=document.createElement("span");return s.classList.add(t),s.textContent=e,s};class InterstitialGrid extends FlowplayerComponent{constructor(t){super(t),this.classList.add("interstitial-grid"),this.addEventListener(InterstitialGrid.events.RENDER,e=>{this.prepare_endscreen(e.detail,t)}),t.on("resize",()=>{t.root.classList.contains("is-grid")&&this.items&&this.prepare_endscreen(this.items,t)}),this.previousButton=document.createElement("div"),this.previousButton.classList.add("fp-previous"),this.nextButton=document.createElement("div"),this.nextButton.classList.add("fp-next"),this.previousButton.addEventListener("click",this.navigation_buttons_listener.bind(this,!0)),this.nextButton.addEventListener("click",this.navigation_buttons_listener.bind(this,!1))}calculate_max_cells_number(t,e){const s=this.parentElement;if(!s)return;const n=window.getComputedStyle(s).padding,i=e.clientWidth-2*parseFloat(n),r=e.clientHeight-2*parseFloat(n);let o=t,l=0,a=0,d=0,c=0;t:for(;o>0;o-=1){if(1===o){l=i,a=Math.min(r,Math.max(l/1.5,l/1.8)),d=c=1;break}let t=1;for(;t<=o;t++){const e=Number.isInteger(o/t)?o/t:parseInt((o/t).toString())+1,s=i/t;let n=1.5;for(;n<=1.8;n+=.1){const i=s/n;if(i>=64&&i*e<=r&&s>=115){l=s,a=i,d=t,c=e;break t}}}}return this.style.setProperty("grid-template-columns",`repeat(${d}, ${l}px)`),this.style.setProperty("grid-template-rows",`repeat(${c}, ${a}px)`),o}prepare_endscreen(t,e){this.items=t,this.rendered_items=this.items.slice(0,this.calculate_max_cells_number(this.items.length,e)),this.populate_cells(this.rendered_items),this.hide_navigation_buttons(this.items.every((t,e)=>{var s;return t===(null===(s=this.rendered_items)||void 0===s?void 0:s[e])}))}populate_cells(t){this.innerHTML="",t.forEach(t=>{var e,s;const n=document.createElement("div");n.classList.add("grid-item"),t.poster&&(n.style.backgroundImage=`url(${t.poster})`);const i=document.createElement("div");i.classList.add("overlay");const r=m("title",null!==(e=t.title)&&void 0!==e?e:""),o=m("description",null!==(s=t.description)&&void 0!==s?s:"");i.append(r,o),n.append(i),n.addEventListener("click",()=>{const e=new CustomEvent(InterstitialGrid.events.SELECTION,{detail:t});this.dispatchEvent(e)}),this.append(n)})}hide_navigation_buttons(t){[this.previousButton,this.nextButton].forEach(e=>e.style.setProperty("display",t?"none":"block"))}connectedCallback(){var t;this.isConnected&&(null===(t=this.parentElement)||void 0===t||t.append(this.previousButton,this.nextButton))}navigation_buttons_listener(t){if(!this.rendered_items)return;const e=[];this.rendered_items.forEach(s=>{if(!this.items)return;const n=this.items.indexOf(s);if(void 0===n||-1===n)return;const i=this.calculate_index(t,n);void 0!==i&&e.push(this.items[i])}),this.rendered_items=e,this.populate_cells(this.rendered_items)}calculate_index(t,e){if(!this.items||!this.rendered_items)return;const s=this.items.length,n=this.rendered_items.length;let i=t?e-n:e+n;return i<0&&t&&(i=s+i),i>s-1&&!t&&(i-=s),i}}InterstitialGrid.events={SELECTION:"interstitial/grid/selection",RENDER:"interstitial/grid/render"};const v=["title","delay","description","poster","src"];class UpNext extends FlowplayerComponent{static get observedAttributes(){return v}constructor(n){super(n),this.classList.add("up-next"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent(t))}),this.addEventListener("animationcancel",()=>{this.classList.add("cancelled"),this.dispatchEvent(new CustomEvent(e))}),this.addEventListener(s,this._setUpNext.bind(this))}getTitle(){return this.getAttribute("title")||""}getDescription(){return this.getAttribute("description")||""}getPoster(){return this.getAttribute("poster")||""}getDelay(){return this.getAttribute("delay")||""}connectedCallback(){this.isConnected&&this._render()}attributeChangedCallback(){this._render()}_render(){var e,s;this.innerHTML="",this.classList.remove("cancelled");const n=document.createDocumentFragment(),i=document.createElement("div");i.classList.add("pane","left");const r=document.createElement("div");r.classList.add("pane","right"),n.append(i,r);const o=document.createElement("div");o.classList.add("poster"),o.style.backgroundImage="url("+this.getPoster()+")",i.append(o),o.addEventListener("click",()=>this.dispatchEvent(new CustomEvent(t)));const l=document.createElement("span");l.classList.add("fp-icon","fp-play"),o.append(l);const a=document.createElement("span");a.classList.add("title"),a.textContent=this.getTitle();const d=document.createElement("span");d.classList.add("description"),d.textContent=this.getDescription();const c=document.createElement("span");c.classList.add("countdown"),this.getDelay()&&(c.style.setProperty("--up-next-delay",this.getDelay()+"s"),c.classList.add("go"));const p=document.createElement("span");p.classList.add("cancel"),p.textContent=null!==(s=null===(e=this.player)||void 0===e?void 0:e.i18n("playlist.cancel"))&&void 0!==s?s:"cancel",p.addEventListener("click",()=>c.classList.remove("go")),r.append(a,d,p,c),this.append(n)}_setUpNext(t){var e,s,n;const i=t.detail.next,r=this.player.opt("playlist.delay",void 0)||10;this.setAttribute("title",null!==(e=i.title)&&void 0!==e?e:""),this.setAttribute("description",null!==(s=i.description)&&void 0!==s?s:""),this.setAttribute("poster",null!==(n=i.poster)&&void 0!==n?n:""),this.setAttribute("delay",r+"")}}const E="is-endscreen",y="is-up-next",_="is-grid";function g(t,e){const s=function(){try{return localStorage.getItem("flowplayer/debug")}catch(t){return""}}(),n=(n,...i)=>{try{const r=(null==e?void 0:e.debug)||s;r&&t.match(r)&&console.log(`flowplayer/${t} -- ${n}`,...i)}catch(t){console.warn(t)}};return n.log=n,n}function f(t,e,s){const n=function(t,e){const s=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(s,"data",{get:()=>e}),s}(e,s);return t.dispatchEvent(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){}}();class EndscreenInterstitial extends FlowplayerComponent{constructor(s){super(s),this.className="fp-endscreen",this.upNextEle=i(s,l),this.gridEle=i(s,a),this.append(this.upNextEle,this.gridEle),this.addEventListener(c,this.on_recommendations_render.bind(this)),this.upNextEle.addEventListener(e,this.on_next_cancel.bind(this)),this.upNextEle.addEventListener(t,this.on_next_end.bind(this)),this.gridEle.addEventListener(InterstitialGrid.events.SELECTION,this.on_grid_selection.bind(this))}on_recommendations_render(t){const e=t.detail;if(this.playlist=e.playlist,this.on_item_selected=e.on_item_selected,this.player.playlist||!1===this.player.opt("endscreen.auto_advance"))return this.gridEle.dispatchEvent(new CustomEvent(InterstitialGrid.events.RENDER,{detail:this.playlist})),this.player.root.classList.add(_);this.gridEle.hide_navigation_buttons(!0),this.player.root.classList.add(y),f(this.upNextEle,s,{next:this._nextVideo(this.playlist)})}on_next_cancel(){this.player.root.classList.contains(E)&&this.playlist&&(this.gridEle.dispatchEvent(new CustomEvent(InterstitialGrid.events.RENDER,{detail:this.playlist})),this.player.root.classList.remove(y),this.player.root.classList.add(_))}on_next_end(){if(!this.playlist||!this.on_item_selected)return;const t=this.current_video=this._nextVideo(this.playlist);this.on_item_selected(t)}on_grid_selection(t){this.on_item_selected&&this.on_item_selected(t.detail),this.current_video=t.detail,this.gridEle.hide_navigation_buttons(!0)}_nextVideo(t){if(!this.current_video)return t[0];const e=t.indexOf(this.current_video);return[-1,t.length-1].includes(e)?t[0]:t[e+1]}}var x;const w=((x=class Endscreen{constructor(t,e){this.logger=g("flowplayer/endscreen"),r(t,o,EndscreenInterstitial),r(t,l,class extends UpNext{}),r(t,a,class extends InterstitialGrid{})}init(t,e,s){const r=i(s,o);var l;s.on("mount",()=>{var t;return null===(t=n(s,"flowplayer-ui"))||void 0===t?void 0:t.prepend(r)}),s.on(u,t=>{const e=t.detail;this.recommendations=e,this.logger.log(`loaded ${e.playlist.length} recommendations`)}),s.on([d,"playlist:ended"],(l=n=>{var i;this.recommendations&&(t.loop||(null===(i=null==t?void 0:t.playlist)||void 0===i?void 0:i.loop)||n.type==d&&s.playlist||(f(r,c,{playlist:this.recommendations.playlist.slice(0,12),on_item_selected:this._setSrc.bind(this,s)}),e.classList.add(E)))},t=>{setTimeout(function(){if(!t.defaultPrevented&&!t.prevented)return l(t)},0)})),s.on(["seeking","loadstart","playing"],()=>{s.root.classList.contains(E)&&this.hide_recommendations(s)})}_setSrc(t,e){var s;if(this.hide_recommendations(t),!t.opts.autoplay&&t.setOpts({autoplay:1}),t.playlist)return t.playlist.push(e),null===(s=t.playlist)||void 0===s?void 0:s.next();t.setSrc(e.src),t.setOpts(e),t.once("canplay",()=>t.togglePlay(!0))}hide_recommendations(t){t.root.classList.remove(E,_,y);const e=n(t,o);e&&f(e,p)}}).pluginName="endscreen",x.events=h,x);return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const s=t.flowplayer;return"function"==typeof s?(s(e),e):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(e)||s.extensions.push(e),e)}(window,w)});
|
|
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.endscreen=e())}(this,function(){"use strict";const t="interstitial/end",e="interstitial/cancel",n="interstitial/next_item";function s(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}const i=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const s=window.customElements.get(e);if(!s)throw new Error(`no default flowplayer component with the name ${e} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(t._customElements,e))(t),r=(t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)},o="flowplayer-endscreen-interstitial",l="flowplayer-endscreen-up-next",a="flowplayer-endscreen-grid",d="ended",c="recommendations:render",p="recommendations:hide",u="recommendationsready";var h=Object.freeze({__proto__:null,RECOMMENDATIONS_RENDER:c,RECOMMENDATIONS_HIDE:p,RECOMMENDATIONS_READY:u});class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}const m=(t,e)=>{const n=document.createElement("span");return n.classList.add(t),n.textContent=e,n};class InterstitialGrid extends FlowplayerComponent{constructor(t){super(t),this.classList.add("interstitial-grid"),this.addEventListener(InterstitialGrid.events.RENDER,e=>{this.prepare_endscreen(e.detail,t)}),t.on("resize",()=>{t.root.classList.contains("is-grid")&&this.items&&this.prepare_endscreen(this.items,t)}),this.previousButton=document.createElement("div"),this.previousButton.classList.add("fp-previous"),this.nextButton=document.createElement("div"),this.nextButton.classList.add("fp-next"),this.previousButton.addEventListener("click",this.navigation_buttons_listener.bind(this,!0)),this.nextButton.addEventListener("click",this.navigation_buttons_listener.bind(this,!1))}calculate_max_cells_number(t,e){const n=this.parentElement;if(!n)return;const s=window.getComputedStyle(n).padding,i=e.clientWidth-2*parseFloat(s),r=e.clientHeight-2*parseFloat(s);let o=t,l=0,a=0,d=0,c=0;t:for(;o>0;o-=1){if(1===o){l=i,a=Math.min(r,Math.max(l/1.5,l/1.8)),d=c=1;break}let t=1;for(;t<=o;t++){const e=Number.isInteger(o/t)?o/t:parseInt((o/t).toString())+1,n=i/t;let s=1.5;for(;s<=1.8;s+=.1){const i=n/s;if(i>=64&&i*e<=r&&n>=115){l=n,a=i,d=t,c=e;break t}}}}return this.style.setProperty("grid-template-columns",`repeat(${d}, ${l}px)`),this.style.setProperty("grid-template-rows",`repeat(${c}, ${a}px)`),o}prepare_endscreen(t,e){this.items=t,this.rendered_items=this.items.slice(0,this.calculate_max_cells_number(this.items.length,e)),this.populate_cells(this.rendered_items),this.hide_navigation_buttons(this.items.every((t,e)=>{var n;return t===(null===(n=this.rendered_items)||void 0===n?void 0:n[e])}))}populate_cells(t){this.innerHTML="",t.forEach(t=>{var e,n;const s=document.createElement("div");s.classList.add("grid-item"),t.poster&&(s.style.backgroundImage=`url(${t.poster})`);const i=document.createElement("div");i.classList.add("overlay");const r=m("title",null!==(e=t.title)&&void 0!==e?e:""),o=m("description",null!==(n=t.description)&&void 0!==n?n:"");i.append(r,o),s.append(i),s.addEventListener("click",()=>{const e=new CustomEvent(InterstitialGrid.events.SELECTION,{detail:t});this.dispatchEvent(e)}),this.append(s)})}hide_navigation_buttons(t){[this.previousButton,this.nextButton].forEach(e=>e.style.setProperty("display",t?"none":"block"))}connectedCallback(){var t;this.isConnected&&(null===(t=this.parentElement)||void 0===t||t.append(this.previousButton,this.nextButton))}navigation_buttons_listener(t){if(!this.rendered_items)return;const e=[];this.rendered_items.forEach(n=>{if(!this.items)return;const s=this.items.indexOf(n);if(void 0===s||-1===s)return;const i=this.calculate_index(t,s);void 0!==i&&e.push(this.items[i])}),this.rendered_items=e,this.populate_cells(this.rendered_items)}calculate_index(t,e){if(!this.items||!this.rendered_items)return;const n=this.items.length,s=this.rendered_items.length;let i=t?e-s:e+s;return i<0&&t&&(i=n+i),i>n-1&&!t&&(i-=n),i}}InterstitialGrid.events={SELECTION:"interstitial/grid/selection",RENDER:"interstitial/grid/render"};const v=["title","delay","description","poster","src"];class UpNext extends FlowplayerComponent{static get observedAttributes(){return v}constructor(s){super(s),this.classList.add("up-next"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent(t))}),this.addEventListener("animationcancel",()=>{this.classList.add("cancelled"),this.dispatchEvent(new CustomEvent(e))}),this.addEventListener(n,this._setUpNext.bind(this))}getTitle(){return this.getAttribute("title")||""}getDescription(){return this.getAttribute("description")||""}getPoster(){return this.getAttribute("poster")||""}getDelay(){return this.getAttribute("delay")||""}connectedCallback(){this.isConnected&&this._render()}attributeChangedCallback(){this._render()}_render(){var e,n;this.innerHTML="",this.classList.remove("cancelled");const s=document.createDocumentFragment(),i=document.createElement("div");i.classList.add("pane","left");const r=document.createElement("div");r.classList.add("pane","right"),s.append(i,r);const o=document.createElement("div");o.classList.add("poster"),o.style.backgroundImage="url("+this.getPoster()+")",i.append(o),o.addEventListener("click",()=>this.dispatchEvent(new CustomEvent(t)));const l=document.createElement("span");l.classList.add("fp-icon","fp-play"),o.append(l);const a=document.createElement("span");a.classList.add("title"),a.textContent=this.getTitle();const d=document.createElement("span");d.classList.add("description"),d.textContent=this.getDescription();const c=document.createElement("span");c.classList.add("countdown"),this.getDelay()&&(c.style.setProperty("--up-next-delay",this.getDelay()+"s"),c.classList.add("go"));const p=document.createElement("span");p.classList.add("cancel"),p.textContent=null!==(n=null===(e=this.player)||void 0===e?void 0:e.i18n("playlist.cancel"))&&void 0!==n?n:"cancel",p.addEventListener("click",()=>c.classList.remove("go")),r.append(a,d,p,c),this.append(s)}_setUpNext(t){var e,n,s;const i=t.detail.next,r=this.player.opt("playlist.delay",void 0)||10;this.setAttribute("title",null!==(e=i.title)&&void 0!==e?e:""),this.setAttribute("description",null!==(n=i.description)&&void 0!==n?n:""),this.setAttribute("poster",null!==(s=i.poster)&&void 0!==s?s:""),this.setAttribute("delay",r+"")}}const _="is-endscreen",y="is-up-next",E="is-grid";function f(t,e){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(t){return""}}(),s=(s,...i)=>{try{const r=(null==e?void 0:e.debug)||n;r&&t.match(r)&&console.log(`flowplayer/${t} -- ${s}`,...i)}catch(t){console.warn(t)}};return s.log=s,s}function g(t,e,n){const s=function(t,e){const n=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(n,"data",{get:()=>e}),n}(e,n);return t.dispatchEvent(s),t}!function(){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){}}();class EndscreenInterstitial extends FlowplayerComponent{constructor(n){super(n),this.className="fp-endscreen",this.upNextEle=i(n,l),this.gridEle=i(n,a),this.append(this.upNextEle,this.gridEle),this.addEventListener(c,this.on_recommendations_render.bind(this)),this.upNextEle.addEventListener(e,this.on_next_cancel.bind(this)),this.upNextEle.addEventListener(t,this.on_next_end.bind(this)),this.gridEle.addEventListener(InterstitialGrid.events.SELECTION,this.on_grid_selection.bind(this))}on_recommendations_render(t){const e=t.detail;if(this.playlist=e.playlist,this.on_item_selected=e.on_item_selected,this.player.playlist||!1===this.player.opt("endscreen.auto_advance"))return this.gridEle.dispatchEvent(new CustomEvent(InterstitialGrid.events.RENDER,{detail:this.playlist})),this.player.root.classList.add(E);this.gridEle.hide_navigation_buttons(!0),this.player.root.classList.add(y),g(this.upNextEle,n,{next:this._nextVideo(this.playlist)})}on_next_cancel(){this.player.root.classList.contains(_)&&this.playlist&&(this.gridEle.dispatchEvent(new CustomEvent(InterstitialGrid.events.RENDER,{detail:this.playlist})),this.player.root.classList.remove(y),this.player.root.classList.add(E))}on_next_end(){if(!this.playlist||!this.on_item_selected)return;const t=this.current_video=this._nextVideo(this.playlist);this.on_item_selected(t)}on_grid_selection(t){this.on_item_selected&&this.on_item_selected(t.detail),this.current_video=t.detail,this.gridEle.hide_navigation_buttons(!0)}_nextVideo(t){if(!this.current_video)return t[0];const e=t.indexOf(this.current_video);return[-1,t.length-1].includes(e)?t[0]:t[e+1]}}const x=1,w=.001;const b=new WeakMap;function L(t,e,n="used"){var s;const i=`${e}:${n}`,r=null!==(s=b.get(t))&&void 0!==s?s:new Set;if(r.has(i))return;r.add(i),b.set(t,r);const o=()=>function(t,{feature_name:e,behavior:n,sample_rate:s}){e&&(s||(s=x),t.emit("flowplayer:feature",{feature_name:e,behavior:n,sample_rate:s}))}(t,{feature_name:e,behavior:n,sample_rate:w});t.opt("metadata.media_id")?o():t.once("health:ready",o)}var C;const N=((C=class Endscreen{constructor(t,e){this.logger=f("flowplayer/endscreen"),r(t,o,EndscreenInterstitial),r(t,l,class extends UpNext{}),r(t,a,class extends InterstitialGrid{})}init(t,e,n){const r=i(n,o);var l;n.on("mount",()=>{var t;return null===(t=s(n,"flowplayer-ui"))||void 0===t?void 0:t.prepend(r)}),n.on(u,t=>{const e=t.detail;this.recommendations=e,this.logger.log(`loaded ${e.playlist.length} recommendations`)}),n.on([d,"playlist:ended"],(l=s=>{var i;this.recommendations&&(t.loop||(null===(i=null==t?void 0:t.playlist)||void 0===i?void 0:i.loop)||s.type==d&&n.playlist||(L(n,"endscreen"),g(r,c,{playlist:this.recommendations.playlist.slice(0,12),on_item_selected:this._setSrc.bind(this,n)}),e.classList.add(_)))},t=>{setTimeout(function(){if(!t.defaultPrevented&&!t.prevented)return l(t)},0)})),n.on(["seeking","loadstart","playing"],()=>{n.root.classList.contains(_)&&this.hide_recommendations(n)})}_setSrc(t,e){var n;if(this.hide_recommendations(t),!t.opts.autoplay&&t.setOpts({autoplay:1}),t.playlist)return t.playlist.push(e),null===(n=t.playlist)||void 0===n?void 0:n.next();t.setSrc(e.src),t.setOpts(e),t.once("canplay",()=>t.togglePlay(!0))}hide_recommendations(t){t.root.classList.remove(_,E,y);const e=s(t,o);e&&g(e,p)}}).pluginName="endscreen",C.events=h,C);return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;return"function"==typeof n?(n(e),e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e),e)}(window,N)});
|
package/plugins/fas.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.fas=t())}(this,function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e){var t={exports:{}};return e(t,t.exports),t.exports}(function(t,r){var o,s;o=e,(s=function(e,t,r){if(!(this instanceof s))return new s(e,t,r);if(void 0===t)this.frameRate=29.97;else{if(!("number"==typeof t&&t>0))throw new Error("Number expected as framerate");this.frameRate=t}if(23.976!==this.frameRate&&24!==this.frameRate&&25!==this.frameRate&&29.97!==this.frameRate&&30!==this.frameRate&&50!==this.frameRate&&59.94!==this.frameRate&&60!==this.frameRate)throw new Error("Unsupported framerate");if(this.dropFrame="boolean"==typeof r?r:29.97===this.frameRate||59.94===this.frameRate,"number"==typeof e)this.frameCount=Math.round(e),this._frameCountToTimeCode();else if("string"==typeof e){var o=e.match("^([012]\\d):(\\d\\d):(\\d\\d)(:|;|\\.)(\\d\\d)$");if(!o)throw new Error("Timecode string expected as HH:MM:SS:FF or HH:MM:SS;FF");this.hours=parseInt(o[1]),this.minutes=parseInt(o[2]),this.seconds=parseInt(o[3]),"boolean"!=typeof r&&(this.dropFrame=":"!==o[4]),this.frames=parseInt(o[5]),this._timeCodeToFrameCount()}else if("object"==typeof e&&e instanceof Date){var i=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0),a=60*i.getTimezoneOffset()*1e3,n=60*e.getTimezoneOffset()*1e3;this.frameCount=Math.round((e-i+(a-n))*this.frameRate/1e3),this._frameCountToTimeCode()}else if("object"==typeof e&&e.hours>=0)this.hours=e.hours,this.minutes=e.minutes,this.seconds=e.seconds,this.frames=e.frames,this._timeCodeToFrameCount();else{if(void 0!==e)throw new Error("Timecode() constructor expects a number, timecode string, or Date()");this.frameCount=0}return this._validate(e),this}).prototype._validate=function(e){if(this.dropFrame&&29.97!==this.frameRate&&59.94!==this.frameRate)throw new Error("Drop frame is only supported for 29.97 and 59.94 fps");if(this.hours>23||this.minutes>59||this.seconds>59||this.frames>=this.frameRate||this.dropFrame&&0===this.seconds&&this.minutes%10&&this.frames<this.frameRate/29.97*2)throw new Error("Invalid timecode"+JSON.stringify(e))},s.prototype._frameCountToTimeCode=function(){var e=this.frameCount;if(this.dropFrame){var t=29.97===this.frameRate?2:4,r=Math.floor(this.frameCount/(17982*t/2)),o=this.frameCount%(17982*t/2);o<t&&(o+=t),e+=9*t*r+t*Math.floor((o-t)/(1798*t/2))}var s=Math.round(this.frameRate);this.frames=e%s,this.seconds=Math.floor(e/s)%60,this.minutes=Math.floor(e/(60*s))%60,this.hours=Math.floor(e/(3600*s))%24},s.prototype._timeCodeToFrameCount=function(){if(this.frameCount=(3600*this.hours+60*this.minutes+this.seconds)*Math.round(this.frameRate)+this.frames,this.dropFrame){var e=60*this.hours+this.minutes,t=29.97===this.frameRate?2:4;this.frameCount-=t*(e-Math.floor(e/10))}},s.prototype.toString=function(e){var t=this.frames,r="";if("string"==typeof e){if("field"!==e)throw new Error("Unsupported string format");this.frameRate<=30?r=".0":(t=Math.floor(t/2),r=".".concat((this.frameCount%2).toString()))}return"".concat(this.hours<10?"0":"",this.hours.toString(),":",this.minutes<10?"0":"",this.minutes.toString(),":",this.seconds<10?"0":"",this.seconds.toString(),this.dropFrame?";":":",t<10?"0":"",t.toString(),r)},s.prototype.valueOf=function(){return this.frameCount},s.prototype.add=function(e,t,r){if("number"!=typeof e)return e instanceof s||(e=new s(e,this.frameRate,this.dropFrame)),this.add(e.frameCount,t,r);var o=this.frameCount+Math.round(e)*(t?-1:1);if(o<0&&r>0&&(o=Math.round(86400*this.frameRate)+o)/this.frameRate/3600>r)throw new Error("Rollover arithmetic exceeds max permitted");if(o<0)throw new Error("Negative timecodes not supported");return this.frameCount=o,this.frameCount=this.frameCount%Math.round(86400*this.frameRate),this._frameCountToTimeCode(),this},s.prototype.subtract=function(e,t){return this.add(e,!0,t)},s.prototype.toDate=function(){var e=this.frameCount/this.frameRate*1e3,t=new Date;t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0);var r=new Date(t.valueOf()+e),o=60*t.getTimezoneOffset()*1e3,s=60*r.getTimezoneOffset()*1e3;return new Date(t.valueOf()+e+(s-o))},"string"!=typeof r.nodeName?t.exports=s:o&&(o.Timecode=s)});function r(e,r,o){o=o||0;const s=new Date;s.setHours(0),s.setMinutes(0),s.setSeconds(0),e=Math.max(parseFloat(e.toFixed(3))+.001+1*o/r,0),s.setMilliseconds(1e3*e);return new t(s,r).toString()}
|
|
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.fas=t())}(this,function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e){var t={exports:{}};return e(t,t.exports),t.exports}(function(t,r){var o,s;o=e,(s=function(e,t,r){if(!(this instanceof s))return new s(e,t,r);if(void 0===t)this.frameRate=29.97;else{if(!("number"==typeof t&&t>0))throw new Error("Number expected as framerate");this.frameRate=t}if(23.976!==this.frameRate&&24!==this.frameRate&&25!==this.frameRate&&29.97!==this.frameRate&&30!==this.frameRate&&50!==this.frameRate&&59.94!==this.frameRate&&60!==this.frameRate)throw new Error("Unsupported framerate");if(this.dropFrame="boolean"==typeof r?r:29.97===this.frameRate||59.94===this.frameRate,"number"==typeof e)this.frameCount=Math.round(e),this._frameCountToTimeCode();else if("string"==typeof e){var o=e.match("^([012]\\d):(\\d\\d):(\\d\\d)(:|;|\\.)(\\d\\d)$");if(!o)throw new Error("Timecode string expected as HH:MM:SS:FF or HH:MM:SS;FF");this.hours=parseInt(o[1]),this.minutes=parseInt(o[2]),this.seconds=parseInt(o[3]),"boolean"!=typeof r&&(this.dropFrame=":"!==o[4]),this.frames=parseInt(o[5]),this._timeCodeToFrameCount()}else if("object"==typeof e&&e instanceof Date){var i=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0),a=60*i.getTimezoneOffset()*1e3,n=60*e.getTimezoneOffset()*1e3;this.frameCount=Math.round((e-i+(a-n))*this.frameRate/1e3),this._frameCountToTimeCode()}else if("object"==typeof e&&e.hours>=0)this.hours=e.hours,this.minutes=e.minutes,this.seconds=e.seconds,this.frames=e.frames,this._timeCodeToFrameCount();else{if(void 0!==e)throw new Error("Timecode() constructor expects a number, timecode string, or Date()");this.frameCount=0}return this._validate(e),this}).prototype._validate=function(e){if(this.dropFrame&&29.97!==this.frameRate&&59.94!==this.frameRate)throw new Error("Drop frame is only supported for 29.97 and 59.94 fps");if(this.hours>23||this.minutes>59||this.seconds>59||this.frames>=this.frameRate||this.dropFrame&&0===this.seconds&&this.minutes%10&&this.frames<this.frameRate/29.97*2)throw new Error("Invalid timecode"+JSON.stringify(e))},s.prototype._frameCountToTimeCode=function(){var e=this.frameCount;if(this.dropFrame){var t=29.97===this.frameRate?2:4,r=Math.floor(this.frameCount/(17982*t/2)),o=this.frameCount%(17982*t/2);o<t&&(o+=t),e+=9*t*r+t*Math.floor((o-t)/(1798*t/2))}var s=Math.round(this.frameRate);this.frames=e%s,this.seconds=Math.floor(e/s)%60,this.minutes=Math.floor(e/(60*s))%60,this.hours=Math.floor(e/(3600*s))%24},s.prototype._timeCodeToFrameCount=function(){if(this.frameCount=(3600*this.hours+60*this.minutes+this.seconds)*Math.round(this.frameRate)+this.frames,this.dropFrame){var e=60*this.hours+this.minutes,t=29.97===this.frameRate?2:4;this.frameCount-=t*(e-Math.floor(e/10))}},s.prototype.toString=function(e){var t=this.frames,r="";if("string"==typeof e){if("field"!==e)throw new Error("Unsupported string format");this.frameRate<=30?r=".0":(t=Math.floor(t/2),r=".".concat((this.frameCount%2).toString()))}return"".concat(this.hours<10?"0":"",this.hours.toString(),":",this.minutes<10?"0":"",this.minutes.toString(),":",this.seconds<10?"0":"",this.seconds.toString(),this.dropFrame?";":":",t<10?"0":"",t.toString(),r)},s.prototype.valueOf=function(){return this.frameCount},s.prototype.add=function(e,t,r){if("number"!=typeof e)return e instanceof s||(e=new s(e,this.frameRate,this.dropFrame)),this.add(e.frameCount,t,r);var o=this.frameCount+Math.round(e)*(t?-1:1);if(o<0&&r>0&&(o=Math.round(86400*this.frameRate)+o)/this.frameRate/3600>r)throw new Error("Rollover arithmetic exceeds max permitted");if(o<0)throw new Error("Negative timecodes not supported");return this.frameCount=o,this.frameCount=this.frameCount%Math.round(86400*this.frameRate),this._frameCountToTimeCode(),this},s.prototype.subtract=function(e,t){return this.add(e,!0,t)},s.prototype.toDate=function(){var e=this.frameCount/this.frameRate*1e3,t=new Date;t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0);var r=new Date(t.valueOf()+e),o=60*t.getTimezoneOffset()*1e3,s=60*r.getTimezoneOffset()*1e3;return new Date(t.valueOf()+e+(s-o))},"string"!=typeof r.nodeName?t.exports=s:o&&(o.Timecode=s)});function r(e,r,o){o=o||0;const s=new Date;s.setHours(0),s.setMinutes(0),s.setSeconds(0),e=Math.max(parseFloat(e.toFixed(3))+.001+1*o/r,0),s.setMilliseconds(1e3*e);return new t(s,r).toString()}const o=1,s=.001;const i=new WeakMap;function a(e,t,r="used"){var a;const n=`${t}:${r}`,f=null!==(a=i.get(e))&&void 0!==a?a:new Set;if(f.has(n))return;f.add(n),i.set(e,f);const h=()=>function(e,{feature_name:t,behavior:r,sample_rate:s}){t&&(s||(s=o),e.emit("flowplayer:feature",{feature_name:t,behavior:r,sample_rate:s}))}(e,{feature_name:t,behavior:r,sample_rate:s});e.opt("metadata.media_id")?h():e.once("health:ready",h)}var n;const f=30,h=0,m=((n=class FAS{constructor(e,t){this.player=t,this.frame_rate=f,this.frame_offset=h}init(e,t,r){0!=r.reaper&&(r.on("loadstart",function(){r.hls&&r.setOpts({fas:{frame_offset:-1}})}),r.on("config",e=>{var t,r,o,s;this.frame_rate=(null===(r=null===(t=e.data)||void 0===t?void 0:t.fas)||void 0===r?void 0:r.frame_rate)||this.frame_rate,this.frame_offset=(null===(s=null===(o=e.data)||void 0===o?void 0:o.fas)||void 0===s?void 0:s.frame_offset)||this.frame_offset}),r.fas=this)}current_frame(){return e=r(this.player.currentTime,this.frame_rate,this.frame_offset),o=this.frame_rate,new t(e,o).frameCount;var e,o}seek_to(e){a(this.player,"fas"),this.player.currentTime=function(e,r,o){o=o||0;const s=1*(new t(e,r).frameCount+o)/r;return Number((s+.001).toFixed(5))}(e,this.frame_rate,-this.frame_offset)}current_timecode(){return r(this.player.currentTime,this.frame_rate,this.frame_offset)}jump(e){this.seek_to(this.current_frame()+e)}}).pluginName="fas",n);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const r=e.flowplayer;return"function"==typeof r?(r(t),t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t),t)}(window,m)});
|
|
@@ -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.float_on_scroll=e())}(this,function(){"use strict";const t="resize";const e="float:pop:in",n="float:pop:out",o="float:exit";var l=Object.freeze({__proto__:null,POP_IN:e,POP_OUT:n,EXT_BTN_CLICK:o});const i=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const o=window.customElements.get(e);if(!o)throw new Error(`no default flowplayer component with the name ${e} exists`);const l=window.customElements.get(n);return"function"!=typeof l?o:l})(t._customElements,e))(t),
|
|
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.float_on_scroll=e())}(this,function(){"use strict";const t="resize";const e="float:pop:in",n="float:pop:out",o="float:exit";var l=Object.freeze({__proto__:null,POP_IN:e,POP_OUT:n,EXT_BTN_CLICK:o});const i=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const o=window.customElements.get(e);if(!o)throw new Error(`no default flowplayer component with the name ${e} exists`);const l=window.customElements.get(n);return"function"!=typeof l?o:l})(t._customElements,e))(t),a=(t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)},s="flowplayer-mute-icon",r="flowplayer-unmute-icon",c="flowplayer-close-icon";function u(t){return function(t){const e=t.getBoundingClientRect(),n=window.innerHeight,o=e.y;return o>n||o+e.height<0?0:e.y<0?(e.height+o)/e.height:n-e.y>e.height?1:Math.abs((n-e.y)/e.height)}(t)>.8}function f(t,e){0==e.reaper||e.floating||w(e,t,n)}function d(t,n){0!=n.reaper&&n.floating&&w(n,t,e)}function p(t,e,n){const l=document.createElement("div");return l.classList.add("fp-exit-float"),l.append(Object.assign(i(t,c),{role:"button"})),l.addEventListener("click",()=>{if(n.was_user_toggled=!0,!t.opts.float_default)return t.emit(o);t.togglePlay(!1),d(e,t)}),l}function w(n,o,l){l&&n.emit(l),setTimeout(function(){const i=o.querySelector(".fp-float-wrapper"),a=o.clientWidth/o.clientHeight;if(!i)return;i.style.height=l===e?"auto":i.clientWidth/a+"px";const s=i.querySelector(".fp-ad-container > div");s&&(s.style.position=l==e?"absolute":"static"),n.emit(t,{contentRect:{height:l===e?o.clientHeight:i.clientHeight,width:i.clientWidth}})})}const m="is-popped-out";class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}class FlowplayerIcon extends FlowplayerComponent{constructor(t,e){super(t),this.classList.add("fp-icon",e.name),e.title&&this.setAttribute("title",e.title),e.title&&this.setAttribute("aria-label",e.title),e.translation_key&&this.setAttribute("aria-label",t.i18n(e.translation_key)),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}const h={translation_key:"core.mute",name:"fp-mute"},y={translation_key:"core.mute",name:"fp-unmute"},_={translation_key:"core.close",name:"fp-close"},g=1,v=.001;const b=new WeakMap;function E(t,e,n="used"){var o;const l=`${e}:${n}`,i=null!==(o=b.get(t))&&void 0!==o?o:new Set;if(i.has(l))return;i.add(l),b.set(t,i);const a=()=>function(t,{feature_name:e,behavior:n,sample_rate:o}){e&&(o||(o=g),t.emit("flowplayer:feature",{feature_name:e,behavior:n,sample_rate:o}))}(t,{feature_name:e,behavior:n,sample_rate:v});t.opt("metadata.media_id")?a():t.once("health:ready",a)}var x;const L=((x=class FloatOnScroll{constructor(t){this.flowplayer=t,a(this.flowplayer,s,class extends FlowplayerIcon{constructor(t){super(t,h)}}),a(this.flowplayer,r,class extends FlowplayerIcon{constructor(t){super(t,y)}}),a(this.flowplayer,c,class extends FlowplayerIcon{constructor(t){super(t,_)}})}init(o,l,a){if(!1===o.float_on_scroll)return;if(function(){try{return window.self!==window.top}catch(t){return!0}}())return console.warn("iframe detected - floating player not supported in iframe");void 0===o.float_default&&(o.float_default=!0);const c=this.flowplayer.instances.find(t=>t.root.classList.contains(x.SINGLETON_CLASS));if(c)return o.float_on_scroll=!1,console.warn("disabling float on scroll for player index=%s as it is a singleton behavior\n\tto disable this warning manually configure float_on_scroll: false",this.flowplayer.instances.indexOf(a));l.classList.add(x.SINGLETON_CLASS),o.autopause&&a.setOpts({autopause:!1});const h={pop_out_container:void 0,was_user_toggled:!1};a.popIn=d.bind(this,l,a),a.popOut=f.bind(this,l,a);const y=window.scrollY;a.on("mount",function(){h.pop_out_container=function(t,e){const n=document.createElement("div");return n.classList.add("fp-float-wrapper"),t.appendChild(n),Array.from(t.childNodes).forEach(function(t){t instanceof Element&&(t===n||t.classList.contains("fp-ratio"))||n.appendChild(t)}),e.getFullsceenTarget=()=>n,n}(l,a)}),a.on("renderplugin",function(t){var e;t.preventDefault(),t.detail&&(null===(e=h.pop_out_container)||void 0===e||e.append(t.detail));const n=t.detail.querySelector("flowplayer-ad-controls");n&&n.append(p(a,l,h))});const _=function(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}(a,"flowplayer-header");_&&function(t,e,n,o){const l=document.createElement("div");l.classList.add("fp-mute-float"),l.append(Object.assign(i(o,s),{role:"button"}),Object.assign(i(o,r),{role:"button"})),l.addEventListener("click",function(){o.toggleMute()}),t.append(p(o,n,e),l)}(_,h,l,a);const g=function(t,e){const n=t||60,o=Math.ceil(1e3/n);let l=Date.now(),i=-1;return function(...t){return i>-1||Date.now()<l||(i=requestAnimationFrame(function(){i=-1,e(),l=Date.now()+o})),i}}(0,function(){var t;if(u(l)){if(a.hasState("is-fullscreen"))return;null===(t=a.popIn)||void 0===t||t.call(a)}}),v=function(){w(a,l)};a.on("viewleave",t=>{var e;o.float_default&&window.scrollY!==y&&!h.was_user_toggled&&function(t){return!(Array.from(document.querySelectorAll(".fp-engine")).find(t=>t.hasState(m))||t.paused&&(!t.ads||!t.ads.adPlaying))}(a)&&(t.preventDefault(),null===(e=a.popOut)||void 0===e||e.call(a))}),a.on("viewenter",function(){h.was_user_toggled=!1}),a.on(n,function(){E(a,"float-on-scroll"),a.floating=!0,a.setState(m,!0),o.float_default&&(window.addEventListener("scroll",g),window.addEventListener(t,v))}),a.on(e,function(){a.floating=!1,a.setState(m,!1),o.float_default&&(window.removeEventListener("scroll",g),window.removeEventListener(t,v))})}}).pluginName="float-on-scroll",x.events=l,x.SINGLETON_CLASS="float-on-scroll-enabled",x);return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;return"function"==typeof n?(n(e),e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e),e)}(window,L)});
|
package/plugins/hls.d.ts
CHANGED
|
@@ -945,7 +945,23 @@ export declare type HLSAttachedEvent = FPEvent<{
|
|
|
945
945
|
hls: Hls;
|
|
946
946
|
}>;
|
|
947
947
|
|
|
948
|
-
|
|
948
|
+
/**
|
|
949
|
+
* Options for {@link HLSConfig.hls.adaptive_buffer_control}.
|
|
950
|
+
* @public
|
|
951
|
+
*/
|
|
952
|
+
export declare type HLSBufferControl = {
|
|
953
|
+
/**
|
|
954
|
+
* Initial buffer length at startup, in seconds.
|
|
955
|
+
* @defaultValue 10
|
|
956
|
+
*/
|
|
957
|
+
initial_buffer_length?: number;
|
|
958
|
+
/**
|
|
959
|
+
* Threshold in seconds. Once playback passes this point,
|
|
960
|
+
* the buffer length is restored to the configured `maxBufferLength` value or to hls.js default.
|
|
961
|
+
* @defaultValue 10
|
|
962
|
+
*/
|
|
963
|
+
restore_buffer_player_time_threshold?: number;
|
|
964
|
+
};
|
|
949
965
|
|
|
950
966
|
/**
|
|
951
967
|
* @public
|
|
@@ -958,7 +974,14 @@ export declare type HLSConfig = ConfigWith<{
|
|
|
958
974
|
* @defaultValue false
|
|
959
975
|
*/
|
|
960
976
|
native?: boolean;
|
|
961
|
-
/* Excluded from this release type:
|
|
977
|
+
/* Excluded from this release type: use_ambient */
|
|
978
|
+
/**
|
|
979
|
+
* Reduces network usage by starting playback with a smaller buffer length.
|
|
980
|
+
* Once playback passes the threshold, the buffer length is restored to the default.
|
|
981
|
+
* Pass `true` for the defaults or an {@link HLSBufferControl} object to tune them.
|
|
982
|
+
* @defaultValue false
|
|
983
|
+
*/
|
|
984
|
+
adaptive_buffer_control?: boolean | HLSBufferControl;
|
|
962
985
|
};
|
|
963
986
|
}>;
|
|
964
987
|
|