@flowplayer/player 3.11.1 → 3.11.2-rc.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/index.d.ts +14 -71
- package/package.json +39 -1
- package/plugins/ads.d.ts +719 -0
- package/plugins/ads.js +1 -1
- package/plugins/airplay.d.ts +321 -0
- package/plugins/analytics.d.ts +242 -0
- package/plugins/analytics.js +1 -1
- package/plugins/asel.d.ts +304 -0
- package/plugins/audio.d.ts +281 -0
- package/plugins/chapters.d.ts +335 -0
- package/plugins/chromecast.d.ts +366 -0
- package/plugins/consent.d.ts +305 -0
- package/plugins/context-menu.d.ts +212 -0
- package/plugins/cuepoints.d.ts +13 -84
- package/plugins/dash.d.ts +235 -0
- package/plugins/drm.d.ts +248 -0
- package/plugins/endscreen.d.ts +351 -0
- package/plugins/fas.d.ts +308 -0
- package/plugins/float-on-scroll.d.ts +301 -0
- package/plugins/ga4.d.ts +398 -0
- package/plugins/gemius.d.ts +319 -0
- package/plugins/google-analytics.d.ts +400 -0
- package/plugins/health.d.ts +307 -0
- package/plugins/health.js +1 -1
- package/plugins/hls.d.ts +229 -0
- package/plugins/id3.d.ts +198 -0
- package/plugins/iframe.d.ts +278 -0
- package/plugins/keyboard.d.ts +189 -0
- package/plugins/media-session.d.ts +189 -0
- package/plugins/message.d.ts +193 -0
- package/plugins/ovp.d.ts +343 -0
- package/plugins/playlist.d.ts +326 -0
- package/plugins/preview.d.ts +243 -0
- package/plugins/qsel.d.ts +284 -0
- package/plugins/qul.d.ts +220 -0
- package/plugins/rts.d.ts +273 -0
- package/plugins/share.d.ts +295 -0
- package/plugins/speed.d.ts +268 -0
- package/plugins/ssai.d.ts +346 -0
- package/plugins/ssai.js +1 -1
- package/plugins/subtitles.d.ts +294 -0
- package/plugins/thumbnails.d.ts +307 -0
- package/plugins/tizen.d.ts +374 -0
- package/plugins/vtsel.d.ts +282 -0
- package/plugins/webos.d.ts +374 -0
- package/util/loader.d.ts +14 -95
package/plugins/ssai.js
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* https://github.com/lancedikson/bowser
|
|
5
5
|
* MIT License | (c) Dustin Diaz 2012-2015
|
|
6
6
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
7
|
-
*/const S=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return u}static get ENGINE_MAP(){return g}static get OS_MAP(){return m}static get PLATFORMS_MAP(){return p}}.parse(window.navigator.userAgent),{platform:w,os:_,browser:M}=S,A=e=>e&&e.toLowerCase();var E={rnd:Math.random().toString(36).substr(2,32),os:A(_.name+(_.versionName?" "+_.versionName:"")),device:A(w.type),browser:A(M.name),browser_version:(M&&M.version?M.version:"unknown").split(".").shift(),plugin_version:"3.11.1"};const k="https://fp-eu-w1-aai.flowplayer.com/in",U="POST",T=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],R=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],P=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],O=d("ads/analytics"),F=RequestQueue.of(),q=(...e)=>Object.assign({},...e);class Analytics{constructor(e,t={}){this.emitter=e,this.metadata=q(E,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),O(this),this.wireup()}static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,q(e.metadata,t,{player_version:"3.11.1"})),e}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,r=q(this.metadata,{event_type:e},s),i=Analytics.pluck_valid_keys(this,r),n=Analytics.ensure_required_keys(this,i);if(O(`Event[${e}]`,{payload:i,observation:s}),n.length)return O(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${n}`,i);RequestQueue.rpush(F,[k,U,i])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}var B;function C(e,t){var s;switch(t){case B.Preroll:return 0;case B.Postroll:return-1;default:return null===(s=e.ssai)||void 0===s?void 0:s.provider.getContentCurrentTime(e)}}function D(e,t,s){var r,i,n,a;const o=null===(r=t.ssai)||void 0===r?void 0:r.provider.getAdType(),d=null===(a=null===(n=null===(i=t.ssai)||void 0===i?void 0:i.provider)||void 0===n?void 0:n.src)||void 0===a?void 0:a.analyticsId,c={ad_break_time:C(t,o),ad_muted:t.muted,event_type:e};o&&Object.assign(c,{ad_type:o}),d&&Object.assign(c,{ad_tag_id:d}),s&&"duration"in s&&Object.assign(c,{ad_remaining_seconds:s.duration-s.currentTime,ad_duration_seconds:s.duration}),s&&"getAdId"in s&&Object.assign(c,{vast_ad_id:s.getAdId()}),t.emit("health:record",{event:"ads/"+e,detail:c}),t.emit(e,Object.assign(c,{data:s}))}function N(e,t){var s;e.setState("ssai-ad-active",!0);const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress={currentTime:0,duration:t},L(e,r))}function I(e,t){var s;const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress=t,L(e,r))}function x(e){if(!e.ssai)return;const t=e.ssai.state;e.setState("ssai-ad-active",!1),delete t.adProgress,void 0!==t.rate&&(e.playbackRate=t.rate,delete t.rate),"number"==typeof t.snapbackTime&&(r(e,t.snapbackTime),delete t.snapbackTime)}function L(e,t){const s=e.playbackRate;1!==s&&(t.rate=s,e.playbackRate=1)}!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(B||(B={}));const Q=navigator.languages||[navigator.language];function j(e){const t=e.ssai.ui,s=new google.ima.dai.api.UiSettings,r=e.opt("lang")||function(){try{return Q.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().find(e=>!e.includes("-"))||"en";s.setLocale(r);const i=new google.ima.dai.api.StreamManager(e,t,s);return i.addEventListener([google.ima.dai.api.StreamEvent.Type.LOADED,google.ima.dai.api.StreamEvent.Type.ERROR,google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED,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.RESUMED,google.ima.dai.api.StreamEvent.Type.PAUSED,google.ima.dai.api.StreamEvent.Type.STARTED,google.ima.dai.api.StreamEvent.Type.COMPLETE,google.ima.dai.api.StreamEvent.Type.SKIPPED,google.ima.dai.api.StreamEvent.Type.CLICK],t=>{!function(e,t,s){switch(s.type){case google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED:return function(e,t){var s,r;const i=t.getStreamData().streamId,n=e.ssai.provider;if(!i||!n.isPod)return;if(!n.isVod){const t=null===(s=n.src)||void 0===s?void 0:s.streamUrl;return t?(n.daiStream=n.buildPodStreamURL(t,i),e.setSrc(n.daiStream)):console.error("streamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#create_a_simple_video_player_2")}const a=null===(r=n.src)||void 0===r?void 0:r.requestStreamUrl;if(!a)return console.error("requestStreamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#vod-pod-serving_1");a(e.ssai.streamManager,i)}(e,s);case google.ima.dai.api.StreamEvent.Type.RESUMED:return D("ad-resumed",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.PAUSED:return D("ad-paused",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.COMPLETE:return D("ad-completed",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.SKIPPED:return D("ad-skipped",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.LOADED:return function(e,t){const s=t.getStreamData().url,r=e.ssai.provider;if(!s||r.isPod&&!r.isVod)return;r.daiStream=s,e.setSrc(s)}(e,s);case google.ima.dai.api.StreamEvent.Type.STARTED:return e.ssai.provider.currentAd=s.getAd(),D("ad-started",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED:return N(e),D("ad-break-started",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED:return D(a,e,V(e,s)),x(e),e.ssai.provider.currentAd=void 0;case google.ima.dai.api.StreamEvent.Type.ERROR:return function(e,t){var s;const r=e.ssai.provider;if(null===(s=r.src)||void 0===s?void 0:s.backupStream)return e.setSrc(r.src.backupStream);e.emit("error",{message:t.getStreamData().errorMessage||"error loading stream"})}(e,s);case google.ima.dai.api.StreamEvent.Type.AD_PROGRESS:{const t=V(e,s);return I(e,t.stream_data.adProgressData),D("ad-progress",e,t)}case google.ima.dai.api.StreamEvent.Type.CLICK:(function(e,t){if(!e.paused)e.togglePlay(!1)})(e)}}(e,0,t)},!1),e.on("ID3",({data:e})=>{const t=null==e?void 0:e.cue;if(!t)return;const s={},r=t.value;s[r.key]=r.data,i.onTimedMetadata(s)}),e.on("ssai:hls:metadata",e=>{var t;null===(t=e.detail)||void 0===t||t.samples.forEach(e=>i.processMetadata("ID3",e.data,e.pts))}),e.on("ssai:dash:metadata",e=>{const t=e.detail;if(!t)return;const s=t.event.messageData,r=t.event.calculatedPresentationTime;i.processMetadata("urn:google:dai:2018",s,r)}),i}function V(e,t){return{stream_data:t.getStreamData(),ad:e.ssai.provider.currentAd}}const z=d("ads/ima/sdk");var W;async function G(e,t){var s;const r=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(t?null==r?void 0:r.dai:r)return void z(":noop");const i=t?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":e._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(e){return new Promise((t,s)=>{let r=document.querySelector(`script[src='${e}']`);if(r)return K(r,t,s);r=document.createElement("script"),r.setAttribute("state",W.LOADING),K(r,t,s),r.src=e,document.head.appendChild(r)})}(i),void z(":loaded")}catch(e){z(":error "+e.message,e)}}function K(e,t,s){const r=e.getAttribute("state");if(r&&[W.ERROR,W.LOADED].includes(r))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",W.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",W.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(W||(W={}));const H=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends H.AnalyticEventObserver{constructor(e){super(),this.video=e}onAdvertBreakStart(e){const t=e.getDuration();if(!e.isActive()&&t){const e=s(this.video);r(this.video,e+t/1e3)}N(this.video,e.getStart()),D("ad-break-started",this.video)}onAdvertBreakEnd(){x(this.video),D(a,this.video)}onAdvertStart(e){}onAdvertEnd(){}onTrackingEvent(e){}}function $(e,t){YospaceAdManagement.SessionVOD.create(e,t.ssai.properties,e=>{const r=e.getPayload();if(r.getSessionResult()===YospaceAdManagement.SessionResult.INITIALISED){t.ssai.session=r;const e=new EventObserver(t);r.addAnalyticObserver(e),t.setSrc({src:r.getPlaybackUrl()}),setInterval(()=>{const e=1e3*s(t);r.onPlayheadUpdate(e),function(e,t,s){const r=e.getCurrentAdBreak();if(!r)return;const i={currentTime:s-r.getStart(),duration:r.getDuration()};I(t,i),D("ad-progress",t,{stream_data:i})}(r,t,e)},250)}else console.warn("YoSpace Failed to initialise session. ResultCode = "+r.getResultCode())})}var Z=Object.freeze({__proto__:null,exists:function(){return!!window.YospaceAdManagement},init:function(e,t){t.ssai&&(!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 s(e)},set:function(t){var s;if(e.ssai){if(e.ssai.state.adProgress)return;return null===(s=e.ssai.provider)||void 0===s?void 0:s.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 n(e)},set:function(){}})}(t),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&&$(t.src,e)},getContentCurrentTime:function(e){const t=s(e),r=e.ssai.session;return r?r.getContentPositionForPlayhead(1e3*t)/1e3:t},setContentCurrentTime:function(e,t){const s=e.ssai.session;return r(e,s?s.getPlayheadForContentPosition(1e3*t)/1e3:t)},onNewSrc:function(e){},getContentDuration:function(e){const t=e.ssai.session,s=n(e);return t?t.getContentPositionForPlayhead(t.getDuration())/1e3:s},getAdType:function(){},getPreviousActiveAdStart:function(e,t){const s=e.ssai.session;if(!s)return;const r=s.getAdBreaks();let i;const n=1e3*t;return r.forEach(e=>{void 0===i&&e.getStart()<n&&e.isActive()&&(i=e)}),void 0!==i?i.getStart()/1e3:void 0}});const X=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?r:i})(e._customElements,t))(e),Y=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class SSAIAdUi extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-ui",this.append(...this.player.createComponents("flowplayer-ssai-indicator","flowplayer-ssai-timeline","flowplayer-ssai-controls"))}}class SSAITimeline extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-timeline";const t=document.createElement("div");t.className="fp-ssai-progress",this.append(t),this.player.on(a,()=>{t.classList.remove("go"),"--ssai-percent-complete --ssai-percent-previous".split(" ").forEach(e=>this.style.setProperty(e,"0"))}),this.player.on("ad-progress",e=>{var s,r,i;const n=null===(i=null===(r=null===(s=e.detail)||void 0===s?void 0:s.data)||void 0===r?void 0:r.stream_data)||void 0===i?void 0:i.adProgressData;if(!n)return;const a=n.currentTime/n.duration*100,o=t.style.getPropertyValue("--ssai-percent-complete");t.classList.remove("go"),t.style.setProperty("--ssai-percent-previous",o),t.style.setProperty("--ssai-percent-complete",a.toFixed(3)),t.classList.add("go")})}}function J(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}class SSAIControls extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-controls",this.createLeftZone(),this.createRightZone()}createRightZone(){const e=document.createElement("div");e.className="fp-ssai-right-zone",e.append(...this.player.createComponents("flowplayer-volume-control"),...this.fsIcons()),this.append(e)}createLeftZone(){const e=document.createElement("div");e.className="fp-ssai-left-zone",e.append(...this.player.createComponents("flowplayer-control-buttons"),this.remainingTimeComponent()),this.append(e)}fsIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(e=>(e.onclick=()=>this.player.toggleFullScreen(),e))}remainingTimeComponent(){const e=document.createElement("div");return e.className="fp-ssai-remaining",this.player.on("ad-progress",t=>{var s,r;const i=null===(r=null===(s=t.detail.data)||void 0===s?void 0:s.stream_data)||void 0===r?void 0:r.adProgressData;i&&(e.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let r=Math.floor(e/60);return e-=60*r,s>=1?(r-=60*s,t+s+":"+J(r)+":"+J(e)):t+J(r)+":"+J(e)}(i.duration-i.currentTime))}),e}}class SSAIAdIndicator extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-indicator",this.player.on("ad-started",e=>{var t,s,r;const i=null===(r=null===(s=null===(t=e.detail)||void 0===t?void 0:t.data)||void 0===s?void 0:s.ad)||void 0===r?void 0:r.getAdPodInfo();i&&(this.textContent=`${this.player.i18n("ads.indicator","ADS")} ${i.getAdPosition()} / ${i.getTotalAds()}`)})}}const ee=[Z,new class Dai{async init(e,t){var s,r;if(t.ssai)return this.make_analytics(t),await G(t,!0),(null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai)?void 0:console.warn("google.ima.dai unavailable")}async onload(e,t){var s,r,i;if(await G(e,!0),null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai){if((null===(i=e.ssai)||void 0===i?void 0:i.streamManager)||(e.ssai.streamManager=j(e)),this.src=t,this.isPod=!!t.networkCode,this.isVod=!(t.assetKey||t.customAssetKey),this.isPod)return this.requestPodStream(e.ssai.streamManager,t);this.requestStream(e.ssai.streamManager,t)}else t.backupStream&&e.setSrc(t.backupStream)}onNewSrc(e,t){var s;t.src!==this.daiStream&&(null===(s=e.ssai.streamManager)||void 0===s||s.reset())}make_analytics(e){const t=Analytics.of(e,{required_keys:R,events:T,optional_keys:P});e.on("config",()=>{var s;return Analytics.mergeMetadata(t,null===(s=e.opts)||void 0===s?void 0:s.metadata)})}exists(){return!0}getAdType(){if(this.currentAd)switch(this.currentAd.getAdPodInfo().getPodIndex()){case 0:return B.Preroll;case-1:return B.Postroll;case-2:return;default:return B.Midroll}}getContentCurrentTime(e){const t=e.ssai.streamManager,s=e.currentTime;return t?t.contentTimeForStreamTime(s):s}setContentCurrentTime(e,t){}getContentDuration(e){const t=e.ssai.streamManager,s=e.duration;return t?t.contentTimeForStreamTime(s):s}getPreviousActiveAdStart(e,t){var s,r;const i=null===(r=null===(s=e.ssai)||void 0===s?void 0:s.streamManager)||void 0===r?void 0:r.previousCuePointForStreamTime(t);if(i&&!i.played)return i.start}srcIsValid(e){return"google/dai"==e.type&&!!(e.videoId&&e.contentSourceId||e.assetKey||e.networkCode)}requestStream(e,t){const s=this.isVod?new google.ima.dai.api.VODStreamRequest:new google.ima.dai.api.LiveStreamRequest;e.requestStream(Object.assign(s,t))}requestPodStream(e,t){const s=this.isVod?new google.ima.dai.api.PodVodStreamRequest:new google.ima.dai.api.PodStreamRequest;e.requestStream(Object.assign(s,t))}buildPodStreamURL(e,t){return e.replace("[[STREAMID]]",t)}}];class Ssai{constructor(e){this.umd=e,Y(e,"flowplayer-ssai-ui",SSAIAdUi),Y(e,"flowplayer-ssai-timeline",SSAITimeline),Y(e,"flowplayer-ssai-controls",SSAIControls),Y(e,"flowplayer-ssai-indicator",SSAIAdIndicator)}init(e,t,i){ee.forEach(e=>{if(i.ssai||!e.exists())return;const n=X(i,"flowplayer-ssai-ui");t.append(n),i.ssai={provider:e,ui:n,state:{snapback:!1}},e.init(t,i),i.on("seeked",()=>function(e){if(e.opt("live"))return;if(!e.ssai)return;const{provider:t,state:i}=e.ssai;if(i.snapback)return i.snapback=!1;const n=s(e),a=t.getPreviousActiveAdStart(e,n);void 0!==a&&(i.snapback=!0,i.snapbackTime=n,r(e,a))}(i)),i.on("src",t=>{i.setState("ssai-ad-active",!1),i.ssai&&(i.ssai.state={snapback:!1},e.onNewSrc(i,t.detail))})})}onload(e,t,s,r){var i;(null===(i=s.ssai)||void 0===i?void 0:i.provider)&&s.ssai.provider.onload(s,r)}wants(e,t,s){let r=!1;return ee.forEach(e=>{if(!r&&e.exists()&&e.srcIsValid(t))return r=!0}),r}}return Ssai.events=o,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 s=e.flowplayer;"function"==typeof s?s(t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t))}(window,Ssai),Ssai}));
|
|
7
|
+
*/const S=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return u}static get ENGINE_MAP(){return g}static get OS_MAP(){return m}static get PLATFORMS_MAP(){return p}}.parse(window.navigator.userAgent),{platform:w,os:_,browser:M}=S,A=e=>e&&e.toLowerCase();var E={rnd:Math.random().toString(36).substr(2,32),os:A(_.name+(_.versionName?" "+_.versionName:"")),device:A(w.type),browser:A(M.name),browser_version:(M&&M.version?M.version:"unknown").split(".").shift(),plugin_version:"3.11.2-rc.1"};const k="https://fp-eu-w1-aai.flowplayer.com/in",U="POST",T=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],R=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],P=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],O=d("ads/analytics"),F=RequestQueue.of(),q=(...e)=>Object.assign({},...e);class Analytics{constructor(e,t={}){this.emitter=e,this.metadata=q(E,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),O(this),this.wireup()}static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,q(e.metadata,t,{player_version:"3.11.2-rc.1"})),e}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,r=q(this.metadata,{event_type:e},s),i=Analytics.pluck_valid_keys(this,r),n=Analytics.ensure_required_keys(this,i);if(O(`Event[${e}]`,{payload:i,observation:s}),n.length)return O(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${n}`,i);RequestQueue.rpush(F,[k,U,i])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}var B;function C(e,t){var s;switch(t){case B.Preroll:return 0;case B.Postroll:return-1;default:return null===(s=e.ssai)||void 0===s?void 0:s.provider.getContentCurrentTime(e)}}function D(e,t,s){var r,i,n,a;const o=null===(r=t.ssai)||void 0===r?void 0:r.provider.getAdType(),d=null===(a=null===(n=null===(i=t.ssai)||void 0===i?void 0:i.provider)||void 0===n?void 0:n.src)||void 0===a?void 0:a.analyticsId,c={ad_break_time:C(t,o),ad_muted:t.muted,event_type:e};o&&Object.assign(c,{ad_type:o}),d&&Object.assign(c,{ad_tag_id:d}),s&&"duration"in s&&Object.assign(c,{ad_remaining_seconds:s.duration-s.currentTime,ad_duration_seconds:s.duration}),s&&"getAdId"in s&&Object.assign(c,{vast_ad_id:s.getAdId()}),t.emit("health:record",{event:"ads/"+e,detail:c}),t.emit(e,Object.assign(c,{data:s}))}function N(e,t){var s;e.setState("ssai-ad-active",!0);const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress={currentTime:0,duration:t},L(e,r))}function I(e,t){var s;const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress=t,L(e,r))}function x(e){if(!e.ssai)return;const t=e.ssai.state;e.setState("ssai-ad-active",!1),delete t.adProgress,void 0!==t.rate&&(e.playbackRate=t.rate,delete t.rate),"number"==typeof t.snapbackTime&&(r(e,t.snapbackTime),delete t.snapbackTime)}function L(e,t){const s=e.playbackRate;1!==s&&(t.rate=s,e.playbackRate=1)}!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(B||(B={}));const Q=navigator.languages||[navigator.language];function j(e){const t=e.ssai.ui,s=new google.ima.dai.api.UiSettings,r=e.opt("lang")||function(){try{return Q.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().find(e=>!e.includes("-"))||"en";s.setLocale(r);const i=new google.ima.dai.api.StreamManager(e,t,s);return i.addEventListener([google.ima.dai.api.StreamEvent.Type.LOADED,google.ima.dai.api.StreamEvent.Type.ERROR,google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED,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.RESUMED,google.ima.dai.api.StreamEvent.Type.PAUSED,google.ima.dai.api.StreamEvent.Type.STARTED,google.ima.dai.api.StreamEvent.Type.COMPLETE,google.ima.dai.api.StreamEvent.Type.SKIPPED,google.ima.dai.api.StreamEvent.Type.CLICK],t=>{!function(e,t,s){switch(s.type){case google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED:return function(e,t){var s,r;const i=t.getStreamData().streamId,n=e.ssai.provider;if(!i||!n.isPod)return;if(!n.isVod){const t=null===(s=n.src)||void 0===s?void 0:s.streamUrl;return t?(n.daiStream=n.buildPodStreamURL(t,i),e.setSrc(n.daiStream)):console.error("streamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#create_a_simple_video_player_2")}const a=null===(r=n.src)||void 0===r?void 0:r.requestStreamUrl;if(!a)return console.error("requestStreamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#vod-pod-serving_1");a(e.ssai.streamManager,i)}(e,s);case google.ima.dai.api.StreamEvent.Type.RESUMED:return D("ad-resumed",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.PAUSED:return D("ad-paused",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.COMPLETE:return D("ad-completed",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.SKIPPED:return D("ad-skipped",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.LOADED:return function(e,t){const s=t.getStreamData().url,r=e.ssai.provider;if(!s||r.isPod&&!r.isVod)return;r.daiStream=s,e.setSrc(s)}(e,s);case google.ima.dai.api.StreamEvent.Type.STARTED:return e.ssai.provider.currentAd=s.getAd(),D("ad-started",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED:return N(e),D("ad-break-started",e,V(e,s));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED:return D(a,e,V(e,s)),x(e),e.ssai.provider.currentAd=void 0;case google.ima.dai.api.StreamEvent.Type.ERROR:return function(e,t){var s;const r=e.ssai.provider;if(null===(s=r.src)||void 0===s?void 0:s.backupStream)return e.setSrc(r.src.backupStream);e.emit("error",{message:t.getStreamData().errorMessage||"error loading stream"})}(e,s);case google.ima.dai.api.StreamEvent.Type.AD_PROGRESS:{const t=V(e,s);return I(e,t.stream_data.adProgressData),D("ad-progress",e,t)}case google.ima.dai.api.StreamEvent.Type.CLICK:(function(e,t){if(!e.paused)e.togglePlay(!1)})(e)}}(e,0,t)},!1),e.on("ID3",({data:e})=>{const t=null==e?void 0:e.cue;if(!t)return;const s={},r=t.value;s[r.key]=r.data,i.onTimedMetadata(s)}),e.on("ssai:hls:metadata",e=>{var t;null===(t=e.detail)||void 0===t||t.samples.forEach(e=>i.processMetadata("ID3",e.data,e.pts))}),e.on("ssai:dash:metadata",e=>{const t=e.detail;if(!t)return;const s=t.event.messageData,r=t.event.calculatedPresentationTime;i.processMetadata("urn:google:dai:2018",s,r)}),i}function V(e,t){return{stream_data:t.getStreamData(),ad:e.ssai.provider.currentAd}}const z=d("ads/ima/sdk");var W;async function G(e,t){var s;const r=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(t?null==r?void 0:r.dai:r)return void z(":noop");const i=t?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":e._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(e){return new Promise((t,s)=>{let r=document.querySelector(`script[src='${e}']`);if(r)return K(r,t,s);r=document.createElement("script"),r.setAttribute("state",W.LOADING),K(r,t,s),r.src=e,document.head.appendChild(r)})}(i),void z(":loaded")}catch(e){z(":error "+e.message,e)}}function K(e,t,s){const r=e.getAttribute("state");if(r&&[W.ERROR,W.LOADED].includes(r))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",W.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",W.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(W||(W={}));const H=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends H.AnalyticEventObserver{constructor(e){super(),this.video=e}onAdvertBreakStart(e){const t=e.getDuration();if(!e.isActive()&&t){const e=s(this.video);r(this.video,e+t/1e3)}N(this.video,e.getStart()),D("ad-break-started",this.video)}onAdvertBreakEnd(){x(this.video),D(a,this.video)}onAdvertStart(e){}onAdvertEnd(){}onTrackingEvent(e){}}function $(e,t){YospaceAdManagement.SessionVOD.create(e,t.ssai.properties,e=>{const r=e.getPayload();if(r.getSessionResult()===YospaceAdManagement.SessionResult.INITIALISED){t.ssai.session=r;const e=new EventObserver(t);r.addAnalyticObserver(e),t.setSrc({src:r.getPlaybackUrl()}),setInterval(()=>{const e=1e3*s(t);r.onPlayheadUpdate(e),function(e,t,s){const r=e.getCurrentAdBreak();if(!r)return;const i={currentTime:s-r.getStart(),duration:r.getDuration()};I(t,i),D("ad-progress",t,{stream_data:i})}(r,t,e)},250)}else console.warn("YoSpace Failed to initialise session. ResultCode = "+r.getResultCode())})}var Z=Object.freeze({__proto__:null,exists:function(){return!!window.YospaceAdManagement},init:function(e,t){t.ssai&&(!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 s(e)},set:function(t){var s;if(e.ssai){if(e.ssai.state.adProgress)return;return null===(s=e.ssai.provider)||void 0===s?void 0:s.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 n(e)},set:function(){}})}(t),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&&$(t.src,e)},getContentCurrentTime:function(e){const t=s(e),r=e.ssai.session;return r?r.getContentPositionForPlayhead(1e3*t)/1e3:t},setContentCurrentTime:function(e,t){const s=e.ssai.session;return r(e,s?s.getPlayheadForContentPosition(1e3*t)/1e3:t)},onNewSrc:function(e){},getContentDuration:function(e){const t=e.ssai.session,s=n(e);return t?t.getContentPositionForPlayhead(t.getDuration())/1e3:s},getAdType:function(){},getPreviousActiveAdStart:function(e,t){const s=e.ssai.session;if(!s)return;const r=s.getAdBreaks();let i;const n=1e3*t;return r.forEach(e=>{void 0===i&&e.getStart()<n&&e.isActive()&&(i=e)}),void 0!==i?i.getStart()/1e3:void 0}});const X=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?r:i})(e._customElements,t))(e),Y=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class SSAIAdUi extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-ui",this.append(...this.player.createComponents("flowplayer-ssai-indicator","flowplayer-ssai-timeline","flowplayer-ssai-controls"))}}class SSAITimeline extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-timeline";const t=document.createElement("div");t.className="fp-ssai-progress",this.append(t),this.player.on(a,()=>{t.classList.remove("go"),"--ssai-percent-complete --ssai-percent-previous".split(" ").forEach(e=>this.style.setProperty(e,"0"))}),this.player.on("ad-progress",e=>{var s,r,i;const n=null===(i=null===(r=null===(s=e.detail)||void 0===s?void 0:s.data)||void 0===r?void 0:r.stream_data)||void 0===i?void 0:i.adProgressData;if(!n)return;const a=n.currentTime/n.duration*100,o=t.style.getPropertyValue("--ssai-percent-complete");t.classList.remove("go"),t.style.setProperty("--ssai-percent-previous",o),t.style.setProperty("--ssai-percent-complete",a.toFixed(3)),t.classList.add("go")})}}function J(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}class SSAIControls extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-controls",this.createLeftZone(),this.createRightZone()}createRightZone(){const e=document.createElement("div");e.className="fp-ssai-right-zone",e.append(...this.player.createComponents("flowplayer-volume-control"),...this.fsIcons()),this.append(e)}createLeftZone(){const e=document.createElement("div");e.className="fp-ssai-left-zone",e.append(...this.player.createComponents("flowplayer-control-buttons"),this.remainingTimeComponent()),this.append(e)}fsIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(e=>(e.onclick=()=>this.player.toggleFullScreen(),e))}remainingTimeComponent(){const e=document.createElement("div");return e.className="fp-ssai-remaining",this.player.on("ad-progress",t=>{var s,r;const i=null===(r=null===(s=t.detail.data)||void 0===s?void 0:s.stream_data)||void 0===r?void 0:r.adProgressData;i&&(e.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let r=Math.floor(e/60);return e-=60*r,s>=1?(r-=60*s,t+s+":"+J(r)+":"+J(e)):t+J(r)+":"+J(e)}(i.duration-i.currentTime))}),e}}class SSAIAdIndicator extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-indicator",this.player.on("ad-started",e=>{var t,s,r;const i=null===(r=null===(s=null===(t=e.detail)||void 0===t?void 0:t.data)||void 0===s?void 0:s.ad)||void 0===r?void 0:r.getAdPodInfo();i&&(this.textContent=`${this.player.i18n("ads.indicator","ADS")} ${i.getAdPosition()} / ${i.getTotalAds()}`)})}}const ee=[Z,new class Dai{async init(e,t){var s,r;if(t.ssai)return this.make_analytics(t),await G(t,!0),(null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai)?void 0:console.warn("google.ima.dai unavailable")}async onload(e,t){var s,r,i;if(await G(e,!0),null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai){if((null===(i=e.ssai)||void 0===i?void 0:i.streamManager)||(e.ssai.streamManager=j(e)),this.src=t,this.isPod=!!t.networkCode,this.isVod=!(t.assetKey||t.customAssetKey),this.isPod)return this.requestPodStream(e.ssai.streamManager,t);this.requestStream(e.ssai.streamManager,t)}else t.backupStream&&e.setSrc(t.backupStream)}onNewSrc(e,t){var s;t.src!==this.daiStream&&(null===(s=e.ssai.streamManager)||void 0===s||s.reset())}make_analytics(e){const t=Analytics.of(e,{required_keys:R,events:T,optional_keys:P});e.on("config",()=>{var s;return Analytics.mergeMetadata(t,null===(s=e.opts)||void 0===s?void 0:s.metadata)})}exists(){return!0}getAdType(){if(this.currentAd)switch(this.currentAd.getAdPodInfo().getPodIndex()){case 0:return B.Preroll;case-1:return B.Postroll;case-2:return;default:return B.Midroll}}getContentCurrentTime(e){const t=e.ssai.streamManager,s=e.currentTime;return t?t.contentTimeForStreamTime(s):s}setContentCurrentTime(e,t){}getContentDuration(e){const t=e.ssai.streamManager,s=e.duration;return t?t.contentTimeForStreamTime(s):s}getPreviousActiveAdStart(e,t){var s,r;const i=null===(r=null===(s=e.ssai)||void 0===s?void 0:s.streamManager)||void 0===r?void 0:r.previousCuePointForStreamTime(t);if(i&&!i.played)return i.start}srcIsValid(e){return"google/dai"==e.type&&!!(e.videoId&&e.contentSourceId||e.assetKey||e.networkCode)}requestStream(e,t){const s=this.isVod?new google.ima.dai.api.VODStreamRequest:new google.ima.dai.api.LiveStreamRequest;e.requestStream(Object.assign(s,t))}requestPodStream(e,t){const s=this.isVod?new google.ima.dai.api.PodVodStreamRequest:new google.ima.dai.api.PodStreamRequest;e.requestStream(Object.assign(s,t))}buildPodStreamURL(e,t){return e.replace("[[STREAMID]]",t)}}];class Ssai{constructor(e){this.umd=e,Y(e,"flowplayer-ssai-ui",SSAIAdUi),Y(e,"flowplayer-ssai-timeline",SSAITimeline),Y(e,"flowplayer-ssai-controls",SSAIControls),Y(e,"flowplayer-ssai-indicator",SSAIAdIndicator)}init(e,t,i){ee.forEach(e=>{if(i.ssai||!e.exists())return;const n=X(i,"flowplayer-ssai-ui");t.append(n),i.ssai={provider:e,ui:n,state:{snapback:!1}},e.init(t,i),i.on("seeked",()=>function(e){if(e.opt("live"))return;if(!e.ssai)return;const{provider:t,state:i}=e.ssai;if(i.snapback)return i.snapback=!1;const n=s(e),a=t.getPreviousActiveAdStart(e,n);void 0!==a&&(i.snapback=!0,i.snapbackTime=n,r(e,a))}(i)),i.on("src",t=>{i.setState("ssai-ad-active",!1),i.ssai&&(i.ssai.state={snapback:!1},e.onNewSrc(i,t.detail))})})}onload(e,t,s,r){var i;(null===(i=s.ssai)||void 0===i?void 0:i.provider)&&s.ssai.provider.onload(s,r)}wants(e,t,s){let r=!1;return ee.forEach(e=>{if(!r&&e.exists()&&e.srcIsValid(t))return r=!0}),r}}return Ssai.events=o,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 s=e.flowplayer;"function"==typeof s?s(t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t))}(window,Ssai),Ssai}));
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { LevelAttributes } from 'hls.js';
|
|
2
|
+
import type { MediaKeyFunc } from 'hls.js';
|
|
3
|
+
|
|
4
|
+
declare type AnyPlugin<PluginOwnConfig extends KeyValue> = Plugin_2<PluginOwnConfig> | Loader<PluginOwnConfig>;
|
|
5
|
+
|
|
6
|
+
declare type ArrayToIntersection<T extends Array<unknown>> = T extends [infer Current, ...infer Remaining] ? Current & ArrayToIntersection<Remaining> : unknown;
|
|
7
|
+
|
|
8
|
+
declare enum AutoplayOpts {
|
|
9
|
+
OFF = 0,
|
|
10
|
+
ON = 1,
|
|
11
|
+
AUDIO_REQUIRED = 2
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare type BitOpts = number;
|
|
15
|
+
|
|
16
|
+
declare type Component = {
|
|
17
|
+
onrender?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
18
|
+
onremove?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
declare interface Components {
|
|
22
|
+
render(key: string, args: any[]): void;
|
|
23
|
+
remove(key: string, args: any[]): void;
|
|
24
|
+
put(key: string, args: Component): void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare interface Config {
|
|
28
|
+
src?: UnsafeSource;
|
|
29
|
+
preload?: "none" | "metadata" | "auto";
|
|
30
|
+
controls?: boolean;
|
|
31
|
+
lang?: string;
|
|
32
|
+
start_time?: number;
|
|
33
|
+
autopause?: boolean;
|
|
34
|
+
rewind?: boolean;
|
|
35
|
+
loop?: boolean;
|
|
36
|
+
seamless?: boolean;
|
|
37
|
+
retry?: boolean;
|
|
38
|
+
autoplay?: BitOpts;
|
|
39
|
+
start_quality?: BitOpts;
|
|
40
|
+
live?: boolean;
|
|
41
|
+
poster?: string;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
muted?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* is src handled by one of plugins loaders
|
|
46
|
+
*/
|
|
47
|
+
is_native?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* bitflags for UI options
|
|
50
|
+
*/
|
|
51
|
+
ui?: BitOpts;
|
|
52
|
+
/**
|
|
53
|
+
* your user access token
|
|
54
|
+
*/
|
|
55
|
+
token?: string;
|
|
56
|
+
/**
|
|
57
|
+
* manually configured duration for pre-rendering usually
|
|
58
|
+
*/
|
|
59
|
+
duration?: number;
|
|
60
|
+
/**
|
|
61
|
+
* can the content be seeked to any position
|
|
62
|
+
*/
|
|
63
|
+
seekable?: boolean;
|
|
64
|
+
multiplay?: boolean;
|
|
65
|
+
ratio?: number | string;
|
|
66
|
+
logo?: string;
|
|
67
|
+
logo_href?: string;
|
|
68
|
+
logo_alt_text?: string;
|
|
69
|
+
title?: string;
|
|
70
|
+
description?: string;
|
|
71
|
+
/**
|
|
72
|
+
* the number of seconds to have in the buffer before dvr is activated
|
|
73
|
+
*/
|
|
74
|
+
seconds_to_dvr?: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare namespace Configs {
|
|
78
|
+
export {
|
|
79
|
+
BitOpts,
|
|
80
|
+
FlowplayerCustomElementRegistry,
|
|
81
|
+
Config,
|
|
82
|
+
CustomConfig,
|
|
83
|
+
PluginConfig
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare type ConfigWith<T> = Configs.Config & T;
|
|
88
|
+
|
|
89
|
+
declare type CustomConfig<T> = Config & T;
|
|
90
|
+
|
|
91
|
+
declare type DeviceId = string;
|
|
92
|
+
|
|
93
|
+
declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
|
|
94
|
+
|
|
95
|
+
declare type DRMConfiguration = {
|
|
96
|
+
license_server: string;
|
|
97
|
+
http_headers?: Record<string, string>;
|
|
98
|
+
certificate?: string;
|
|
99
|
+
vendor?: string | DRMVendorImplementation;
|
|
100
|
+
request_media_key_system_access_function?: MediaKeyFunc;
|
|
101
|
+
query_params?: Record<string, string>;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
declare type DRMSourceConfiguration = {
|
|
105
|
+
[keysystem in DRM_KEYSYSTEM]?: DRMConfiguration;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
declare type DRMVendorImplementation = {
|
|
109
|
+
fairplay_fetch_certificate: (url: string, cb: (certificate_data: Uint8Array) => void) => void;
|
|
110
|
+
fairplay_request_license: (url: string, params: {
|
|
111
|
+
message: any;
|
|
112
|
+
assetId: string;
|
|
113
|
+
}, cb: (license_data: Uint8Array) => void) => void;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
declare type FlowplayerCustomElementRegistry = Map<string, string>;
|
|
117
|
+
|
|
118
|
+
declare interface FlowplayerUMD extends FlowplayerUMDBase {
|
|
119
|
+
(selector: string, config?: Config): Player;
|
|
120
|
+
(element: HTMLElement, config?: Config): Player;
|
|
121
|
+
<T>(selector: string, config?: CustomConfig<T>): Player;
|
|
122
|
+
<T>(element: HTMLElement, config?: CustomConfig<T>): Player;
|
|
123
|
+
<PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<CustomConfig<MergeConfigs<PluginCtors>>>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare interface FlowplayerUMDBase {
|
|
127
|
+
instances: Player[];
|
|
128
|
+
extensions: PluginCtor[];
|
|
129
|
+
events: Record<string, string>;
|
|
130
|
+
ads?: {
|
|
131
|
+
events: Record<string, string>;
|
|
132
|
+
};
|
|
133
|
+
states: Record<string, string>;
|
|
134
|
+
quality: typeof QualityOpts;
|
|
135
|
+
commit: string;
|
|
136
|
+
version: string;
|
|
137
|
+
customElements: FlowplayerCustomElementRegistry;
|
|
138
|
+
defaultElements: Record<string, string>;
|
|
139
|
+
components: Components;
|
|
140
|
+
support: any;
|
|
141
|
+
autoplay: typeof AutoplayOpts;
|
|
142
|
+
jwt: any;
|
|
143
|
+
loaders: any;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config> extends FlowplayerUMDBase {
|
|
147
|
+
(selector: string, config?: ConfigWithPlugins): Player;
|
|
148
|
+
(element: HTMLElement, config?: ConfigWithPlugins): Player;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
declare interface FPEvent<T> extends CustomEvent<T> {
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated
|
|
154
|
+
the data attribute has been migrated to details to match the CustomEvent spec
|
|
155
|
+
more info: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
|
|
156
|
+
*/
|
|
157
|
+
data?: T;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
declare type HTMLTrackAttributes = {
|
|
161
|
+
src: string;
|
|
162
|
+
lang?: string;
|
|
163
|
+
label?: string;
|
|
164
|
+
crossorigin?: string | null;
|
|
165
|
+
default?: boolean;
|
|
166
|
+
kind?: "captions" | "chapters" | "subtitles";
|
|
167
|
+
mode?: "hidden" | "showing" | "disabled";
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
declare type JSONPlayer = any;
|
|
171
|
+
|
|
172
|
+
declare type KeyValue = Record<string, any>;
|
|
173
|
+
|
|
174
|
+
declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Plugin_2<PluginOwnConfig> {
|
|
175
|
+
onload<T = KeyValue>(config: PluginConfig<T>, root: PlayerRoot, video: Player, src?: SourceObj): void;
|
|
176
|
+
wants<S = SourceObj, T = KeyValue>(srcString: SourceStr, srcObj: S, config: PluginConfig<T>): boolean;
|
|
177
|
+
wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
declare type MapToConfigs<Arr extends PluginCtor[]> = {
|
|
181
|
+
[PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
|
|
185
|
+
|
|
186
|
+
declare interface Player extends HTMLVideoElement {
|
|
187
|
+
renderPlugin: (pluginContainer: HTMLElement) => void;
|
|
188
|
+
toggleDisable: (flag: boolean) => void;
|
|
189
|
+
original_src: string;
|
|
190
|
+
root: PlayerRoot;
|
|
191
|
+
playerState: Record<string, boolean>;
|
|
192
|
+
reaper: Map<string, any> | 0;
|
|
193
|
+
hasState(state: PlayerState): boolean;
|
|
194
|
+
transitionState(to: PlayerState, from: PlayerState, timer?: number): void;
|
|
195
|
+
togglePlay(on?: boolean): Promise<void>;
|
|
196
|
+
toggleFullScreen(on?: boolean, state_only?: boolean): void;
|
|
197
|
+
toggleMute(on?: boolean): void;
|
|
198
|
+
destroy(): void;
|
|
199
|
+
render(): void;
|
|
200
|
+
render(component: string, args: any[]): void;
|
|
201
|
+
createComponents(...args: string[]): HTMLElement[];
|
|
202
|
+
setOpts(config: Config): void;
|
|
203
|
+
setSrc(sources: UnsafeSource): Player;
|
|
204
|
+
on<T>(event: string | string[], handler: (e: FPEvent<T>) => void): Player;
|
|
205
|
+
once<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
|
|
206
|
+
off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
|
|
207
|
+
poll<T>(event: string, data?: T): FPEvent<T>;
|
|
208
|
+
emit<T>(event: string, data?: T): Player;
|
|
209
|
+
setAttrs(attrs: Config): Player;
|
|
210
|
+
opt<T>(key: string, fallback?: T): T;
|
|
211
|
+
enqueueSeek(offset: number): any;
|
|
212
|
+
setState(state: string, flag: boolean): Player;
|
|
213
|
+
toJSON(): JSONPlayer;
|
|
214
|
+
i18n(k: string, fallback?: string): string;
|
|
215
|
+
deviceId(): DeviceId;
|
|
216
|
+
live_state: {
|
|
217
|
+
dvr?: boolean;
|
|
218
|
+
dvr_window?: number;
|
|
219
|
+
};
|
|
220
|
+
opts: Config;
|
|
221
|
+
plugins: Array<Plugin_2 | Loader>;
|
|
222
|
+
dvr_offset?: number;
|
|
223
|
+
message?: {
|
|
224
|
+
events: Record<string, string>;
|
|
225
|
+
};
|
|
226
|
+
disabled: boolean;
|
|
227
|
+
started?: boolean;
|
|
228
|
+
token: string;
|
|
229
|
+
tracks?: VideoTrack[];
|
|
230
|
+
_customElements: FlowplayerCustomElementRegistry;
|
|
231
|
+
_storage: Storage;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare type PlayerRoot = HTMLElement & {
|
|
235
|
+
prevWidth?: number;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
declare type PlayerState = string;
|
|
239
|
+
|
|
240
|
+
declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
241
|
+
/**
|
|
242
|
+
* a plugin must always implement the init method so a player instance knows how to initialize it
|
|
243
|
+
*/
|
|
244
|
+
init<T>(config: PluginConfig<T>, container: PlayerRoot, player: Player): void;
|
|
245
|
+
init(config: PluginConfig<PluginOwnConfig>, container: PlayerRoot, player: Player): void;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
declare type PluginConfig<T> = Config & T;
|
|
249
|
+
|
|
250
|
+
declare interface PluginCtor<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
251
|
+
new (umd: FlowplayerUMD, player: Player): AnyPlugin<PluginOwnConfig>;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
declare enum QualityOpts {
|
|
255
|
+
LOW = 1,
|
|
256
|
+
MEDIUM = 2,
|
|
257
|
+
HIGH = 4
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
declare type SourceObj = {
|
|
261
|
+
src?: SourceStr;
|
|
262
|
+
type?: string;
|
|
263
|
+
drm?: DRMSourceConfiguration;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
declare type SourceStr = string;
|
|
267
|
+
|
|
268
|
+
declare type SourceWith<T> = SourceObj & T;
|
|
269
|
+
|
|
270
|
+
/* Excluded from this release type: SubsConfig */
|
|
271
|
+
|
|
272
|
+
declare class Subtitles implements Plugin_2 {
|
|
273
|
+
static events: {
|
|
274
|
+
TRACKS: string;
|
|
275
|
+
SWITCH: string;
|
|
276
|
+
TRACK_UPDATED: string;
|
|
277
|
+
};
|
|
278
|
+
constructor(umd: FlowplayerUMD);
|
|
279
|
+
init(config: SubsConfig, root: PlayerRoot, player: Player): void;
|
|
280
|
+
}
|
|
281
|
+
export default Subtitles;
|
|
282
|
+
|
|
283
|
+
/* Excluded from this release type: TextTrackWithAttributes */
|
|
284
|
+
|
|
285
|
+
declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
|
|
286
|
+
|
|
287
|
+
declare interface VideoTrack {
|
|
288
|
+
name: string;
|
|
289
|
+
data: any;
|
|
290
|
+
default: boolean;
|
|
291
|
+
selected: boolean;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export { }
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import type { MediaKeyFunc } from 'hls.js';
|
|
2
|
+
|
|
3
|
+
declare type AnyPlugin<PluginOwnConfig extends KeyValue> = Plugin_2<PluginOwnConfig> | Loader<PluginOwnConfig>;
|
|
4
|
+
|
|
5
|
+
declare type ArrayToIntersection<T extends Array<unknown>> = T extends [infer Current, ...infer Remaining] ? Current & ArrayToIntersection<Remaining> : unknown;
|
|
6
|
+
|
|
7
|
+
declare enum AutoplayOpts {
|
|
8
|
+
OFF = 0,
|
|
9
|
+
ON = 1,
|
|
10
|
+
AUDIO_REQUIRED = 2
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare type BitOpts = number;
|
|
14
|
+
|
|
15
|
+
declare type Component = {
|
|
16
|
+
onrender?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
17
|
+
onremove?: (config: Config, root: PlayerRoot, player: Player) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
declare interface Components {
|
|
21
|
+
render(key: string, args: any[]): void;
|
|
22
|
+
remove(key: string, args: any[]): void;
|
|
23
|
+
put(key: string, args: Component): void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare interface Config {
|
|
27
|
+
src?: UnsafeSource;
|
|
28
|
+
preload?: "none" | "metadata" | "auto";
|
|
29
|
+
controls?: boolean;
|
|
30
|
+
lang?: string;
|
|
31
|
+
start_time?: number;
|
|
32
|
+
autopause?: boolean;
|
|
33
|
+
rewind?: boolean;
|
|
34
|
+
loop?: boolean;
|
|
35
|
+
seamless?: boolean;
|
|
36
|
+
retry?: boolean;
|
|
37
|
+
autoplay?: BitOpts;
|
|
38
|
+
start_quality?: BitOpts;
|
|
39
|
+
live?: boolean;
|
|
40
|
+
poster?: string;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
muted?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* is src handled by one of plugins loaders
|
|
45
|
+
*/
|
|
46
|
+
is_native?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* bitflags for UI options
|
|
49
|
+
*/
|
|
50
|
+
ui?: BitOpts;
|
|
51
|
+
/**
|
|
52
|
+
* your user access token
|
|
53
|
+
*/
|
|
54
|
+
token?: string;
|
|
55
|
+
/**
|
|
56
|
+
* manually configured duration for pre-rendering usually
|
|
57
|
+
*/
|
|
58
|
+
duration?: number;
|
|
59
|
+
/**
|
|
60
|
+
* can the content be seeked to any position
|
|
61
|
+
*/
|
|
62
|
+
seekable?: boolean;
|
|
63
|
+
multiplay?: boolean;
|
|
64
|
+
ratio?: number | string;
|
|
65
|
+
logo?: string;
|
|
66
|
+
logo_href?: string;
|
|
67
|
+
logo_alt_text?: string;
|
|
68
|
+
title?: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
/**
|
|
71
|
+
* the number of seconds to have in the buffer before dvr is activated
|
|
72
|
+
*/
|
|
73
|
+
seconds_to_dvr?: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare namespace Configs {
|
|
77
|
+
export {
|
|
78
|
+
BitOpts,
|
|
79
|
+
FlowplayerCustomElementRegistry,
|
|
80
|
+
Config,
|
|
81
|
+
CustomConfig,
|
|
82
|
+
PluginConfig
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare type ConfigWith<T> = Configs.Config & T;
|
|
87
|
+
|
|
88
|
+
declare type CustomConfig<T> = Config & T;
|
|
89
|
+
|
|
90
|
+
declare type DeviceId = string;
|
|
91
|
+
|
|
92
|
+
declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
|
|
93
|
+
|
|
94
|
+
declare type DRMConfiguration = {
|
|
95
|
+
license_server: string;
|
|
96
|
+
http_headers?: Record<string, string>;
|
|
97
|
+
certificate?: string;
|
|
98
|
+
vendor?: string | DRMVendorImplementation;
|
|
99
|
+
request_media_key_system_access_function?: MediaKeyFunc;
|
|
100
|
+
query_params?: Record<string, string>;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
declare type DRMSourceConfiguration = {
|
|
104
|
+
[keysystem in DRM_KEYSYSTEM]?: DRMConfiguration;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
declare type DRMVendorImplementation = {
|
|
108
|
+
fairplay_fetch_certificate: (url: string, cb: (certificate_data: Uint8Array) => void) => void;
|
|
109
|
+
fairplay_request_license: (url: string, params: {
|
|
110
|
+
message: any;
|
|
111
|
+
assetId: string;
|
|
112
|
+
}, cb: (license_data: Uint8Array) => void) => void;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
declare type FlowplayerCustomElementRegistry = Map<string, string>;
|
|
116
|
+
|
|
117
|
+
declare interface FlowplayerUMD extends FlowplayerUMDBase {
|
|
118
|
+
(selector: string, config?: Config): Player;
|
|
119
|
+
(element: HTMLElement, config?: Config): Player;
|
|
120
|
+
<T>(selector: string, config?: CustomConfig<T>): Player;
|
|
121
|
+
<T>(element: HTMLElement, config?: CustomConfig<T>): Player;
|
|
122
|
+
<PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<CustomConfig<MergeConfigs<PluginCtors>>>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
declare interface FlowplayerUMDBase {
|
|
126
|
+
instances: Player[];
|
|
127
|
+
extensions: PluginCtor[];
|
|
128
|
+
events: Record<string, string>;
|
|
129
|
+
ads?: {
|
|
130
|
+
events: Record<string, string>;
|
|
131
|
+
};
|
|
132
|
+
states: Record<string, string>;
|
|
133
|
+
quality: typeof QualityOpts;
|
|
134
|
+
commit: string;
|
|
135
|
+
version: string;
|
|
136
|
+
customElements: FlowplayerCustomElementRegistry;
|
|
137
|
+
defaultElements: Record<string, string>;
|
|
138
|
+
components: Components;
|
|
139
|
+
support: any;
|
|
140
|
+
autoplay: typeof AutoplayOpts;
|
|
141
|
+
jwt: any;
|
|
142
|
+
loaders: any;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config> extends FlowplayerUMDBase {
|
|
146
|
+
(selector: string, config?: ConfigWithPlugins): Player;
|
|
147
|
+
(element: HTMLElement, config?: ConfigWithPlugins): Player;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare interface FPEvent<T> extends CustomEvent<T> {
|
|
151
|
+
/**
|
|
152
|
+
* @deprecated
|
|
153
|
+
the data attribute has been migrated to details to match the CustomEvent spec
|
|
154
|
+
more info: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
|
|
155
|
+
*/
|
|
156
|
+
data?: T;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
declare type JSONPlayer = any;
|
|
160
|
+
|
|
161
|
+
declare type KeyValue = Record<string, any>;
|
|
162
|
+
|
|
163
|
+
declare interface Loader<PluginOwnConfig extends KeyValue = KeyValue> extends Plugin_2<PluginOwnConfig> {
|
|
164
|
+
onload<T = KeyValue>(config: PluginConfig<T>, root: PlayerRoot, video: Player, src?: SourceObj): void;
|
|
165
|
+
wants<S = SourceObj, T = KeyValue>(srcString: SourceStr, srcObj: S, config: PluginConfig<T>): boolean;
|
|
166
|
+
wants<S = KeyValue, T = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: PluginConfig<T>): boolean;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
declare type MapToConfigs<Arr extends PluginCtor[]> = {
|
|
170
|
+
[PluginType in keyof Arr]: Arr[PluginType] extends PluginCtor<infer ConfigType> ? ConfigType : never;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
declare type MergeConfigs<Arr extends PluginCtor[]> = ArrayToIntersection<MapToConfigs<Arr>>;
|
|
174
|
+
|
|
175
|
+
declare interface Player extends HTMLVideoElement {
|
|
176
|
+
renderPlugin: (pluginContainer: HTMLElement) => void;
|
|
177
|
+
toggleDisable: (flag: boolean) => void;
|
|
178
|
+
original_src: string;
|
|
179
|
+
root: PlayerRoot;
|
|
180
|
+
playerState: Record<string, boolean>;
|
|
181
|
+
reaper: Map<string, any> | 0;
|
|
182
|
+
hasState(state: PlayerState): boolean;
|
|
183
|
+
transitionState(to: PlayerState, from: PlayerState, timer?: number): void;
|
|
184
|
+
togglePlay(on?: boolean): Promise<void>;
|
|
185
|
+
toggleFullScreen(on?: boolean, state_only?: boolean): void;
|
|
186
|
+
toggleMute(on?: boolean): void;
|
|
187
|
+
destroy(): void;
|
|
188
|
+
render(): void;
|
|
189
|
+
render(component: string, args: any[]): void;
|
|
190
|
+
createComponents(...args: string[]): HTMLElement[];
|
|
191
|
+
setOpts(config: Config): void;
|
|
192
|
+
setSrc(sources: UnsafeSource): Player;
|
|
193
|
+
on<T>(event: string | string[], handler: (e: FPEvent<T>) => void): Player;
|
|
194
|
+
once<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
|
|
195
|
+
off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
|
|
196
|
+
poll<T>(event: string, data?: T): FPEvent<T>;
|
|
197
|
+
emit<T>(event: string, data?: T): Player;
|
|
198
|
+
setAttrs(attrs: Config): Player;
|
|
199
|
+
opt<T>(key: string, fallback?: T): T;
|
|
200
|
+
enqueueSeek(offset: number): any;
|
|
201
|
+
setState(state: string, flag: boolean): Player;
|
|
202
|
+
toJSON(): JSONPlayer;
|
|
203
|
+
i18n(k: string, fallback?: string): string;
|
|
204
|
+
deviceId(): DeviceId;
|
|
205
|
+
live_state: {
|
|
206
|
+
dvr?: boolean;
|
|
207
|
+
dvr_window?: number;
|
|
208
|
+
};
|
|
209
|
+
opts: Config;
|
|
210
|
+
plugins: Array<Plugin_2 | Loader>;
|
|
211
|
+
dvr_offset?: number;
|
|
212
|
+
message?: {
|
|
213
|
+
events: Record<string, string>;
|
|
214
|
+
};
|
|
215
|
+
disabled: boolean;
|
|
216
|
+
started?: boolean;
|
|
217
|
+
token: string;
|
|
218
|
+
tracks?: VideoTrack[];
|
|
219
|
+
_customElements: FlowplayerCustomElementRegistry;
|
|
220
|
+
_storage: Storage;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
declare type PlayerRoot = HTMLElement & {
|
|
224
|
+
prevWidth?: number;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
declare type PlayerState = string;
|
|
228
|
+
|
|
229
|
+
declare interface Plugin_2<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
230
|
+
/**
|
|
231
|
+
* a plugin must always implement the init method so a player instance knows how to initialize it
|
|
232
|
+
*/
|
|
233
|
+
init<T>(config: PluginConfig<T>, container: PlayerRoot, player: Player): void;
|
|
234
|
+
init(config: PluginConfig<PluginOwnConfig>, container: PlayerRoot, player: Player): void;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
declare type PluginConfig<T> = Config & T;
|
|
238
|
+
|
|
239
|
+
declare interface PluginCtor<PluginOwnConfig extends KeyValue = KeyValue> {
|
|
240
|
+
new (umd: FlowplayerUMD, player: Player): AnyPlugin<PluginOwnConfig>;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
declare enum QualityOpts {
|
|
244
|
+
LOW = 1,
|
|
245
|
+
MEDIUM = 2,
|
|
246
|
+
HIGH = 4
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
declare type SourceObj = {
|
|
250
|
+
src?: SourceStr;
|
|
251
|
+
type?: string;
|
|
252
|
+
drm?: DRMSourceConfiguration;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
declare type SourceStr = string;
|
|
256
|
+
|
|
257
|
+
declare type SourceWith<T> = SourceObj & T;
|
|
258
|
+
|
|
259
|
+
declare type Thumbnail = {
|
|
260
|
+
x: number;
|
|
261
|
+
y: number;
|
|
262
|
+
w: number;
|
|
263
|
+
h: number;
|
|
264
|
+
url: string;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
declare namespace ThumbnailEvents {
|
|
268
|
+
export {
|
|
269
|
+
THUMBNAILS_RENDER,
|
|
270
|
+
THUMBNAILS_HIDE
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
declare class Thumbnails implements Plugin_2 {
|
|
275
|
+
static events: typeof ThumbnailEvents;
|
|
276
|
+
static activeThumbnails(player: Player, timestamp: number): {
|
|
277
|
+
previous?: undefined;
|
|
278
|
+
current?: undefined;
|
|
279
|
+
next?: undefined;
|
|
280
|
+
} | {
|
|
281
|
+
previous: Thumbnail;
|
|
282
|
+
current: Thumbnail;
|
|
283
|
+
next: Thumbnail;
|
|
284
|
+
} | undefined;
|
|
285
|
+
constructor(umd: FlowplayerUMD);
|
|
286
|
+
init(config: ConfigWith<{
|
|
287
|
+
thumbnails?: ThumbnailsConfig;
|
|
288
|
+
}>, root: PlayerRoot, player: Player): void;
|
|
289
|
+
}
|
|
290
|
+
export default Thumbnails;
|
|
291
|
+
|
|
292
|
+
declare const THUMBNAILS_HIDE = "thumbnails:hide";
|
|
293
|
+
|
|
294
|
+
declare const THUMBNAILS_RENDER = "thumbnails:render";
|
|
295
|
+
|
|
296
|
+
/* Excluded from this release type: ThumbnailsConfig */
|
|
297
|
+
|
|
298
|
+
declare type UnsafeSource = SourceStr | SourceObj | Array<SourceStr | SourceObj>;
|
|
299
|
+
|
|
300
|
+
declare interface VideoTrack {
|
|
301
|
+
name: string;
|
|
302
|
+
data: any;
|
|
303
|
+
default: boolean;
|
|
304
|
+
selected: boolean;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export { }
|