@flowplayer/player 3.15.0 → 3.16.0-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/core/events.d.ts +22 -2
  2. package/core/events.js +50 -50
  3. package/core.js +1 -1
  4. package/default.js +1 -1
  5. package/embed.js +2 -2
  6. package/flowplayer.css +1 -1
  7. package/index.d.ts +78 -35
  8. package/package.json +1 -1
  9. package/plugins/ads.d.ts +76 -33
  10. package/plugins/ads.js +1 -1
  11. package/plugins/airplay.d.ts +77 -52
  12. package/plugins/analytics.d.ts +76 -33
  13. package/plugins/analytics.js +1 -1
  14. package/plugins/asel.d.ts +221 -36
  15. package/plugins/asel.js +1 -1
  16. package/plugins/audio.d.ts +76 -33
  17. package/plugins/chapters.d.ts +76 -33
  18. package/plugins/chromecast.d.ts +76 -33
  19. package/plugins/chromecast.js +1 -1
  20. package/plugins/comscore.d.ts +76 -33
  21. package/plugins/consent.d.ts +76 -33
  22. package/plugins/context-menu.d.ts +76 -33
  23. package/plugins/cuepoints.d.ts +76 -33
  24. package/plugins/dash.d.ts +77 -45
  25. package/plugins/dash.js +1 -1
  26. package/plugins/drm.d.ts +76 -33
  27. package/plugins/endscreen.d.ts +76 -33
  28. package/plugins/fas.d.ts +76 -33
  29. package/plugins/float-on-scroll.d.ts +76 -33
  30. package/plugins/ga4.d.ts +76 -33
  31. package/plugins/gemius.d.ts +76 -33
  32. package/plugins/google-analytics.d.ts +76 -33
  33. package/plugins/health.d.ts +76 -33
  34. package/plugins/health.js +1 -1
  35. package/plugins/hls.d.ts +76 -33
  36. package/plugins/hls.js +1 -1
  37. package/plugins/id3.d.ts +76 -33
  38. package/plugins/iframe.d.ts +76 -33
  39. package/plugins/keyboard.d.ts +76 -33
  40. package/plugins/media-session.d.ts +76 -33
  41. package/plugins/message.d.ts +76 -33
  42. package/plugins/ovp.d.ts +76 -33
  43. package/plugins/playlist.d.ts +107 -33
  44. package/plugins/playlist.js +1 -1
  45. package/plugins/preview.d.ts +76 -33
  46. package/plugins/qsel.d.ts +76 -33
  47. package/plugins/qul.d.ts +76 -33
  48. package/plugins/rts.d.ts +76 -33
  49. package/plugins/share.d.ts +76 -33
  50. package/plugins/speed.d.ts +76 -33
  51. package/plugins/ssai.d.ts +76 -33
  52. package/plugins/ssai.js +1 -1
  53. package/plugins/subtitles.d.ts +76 -33
  54. package/plugins/thumbnails.d.ts +76 -33
  55. package/plugins/tizen.d.ts +76 -33
  56. package/plugins/vtsel.d.ts +76 -33
  57. package/plugins/webos.d.ts +76 -33
  58. package/util/loader.d.ts +76 -33
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.15.0"};const U="https://fp-eu-w1-aai.flowplayer.com/in",k="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.15.0"})),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,[U,k,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 async 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");try{n.daiStream=await a(e.ssai.streamManager,i),e.ssai.streamManager.loadStreamMetadata(),e.setSrc(n.daiStream)}catch(t){z(e)}}(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 z(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}}function z(e,t){var s,r;const i=e.ssai.provider;if(null===(s=i.src)||void 0===s?void 0:s.backupStream)return e.setSrc(i.src.backupStream);e.emit("error",{message:(null===(r=null==t?void 0:t.getStreamData())||void 0===r?void 0:r.errorMessage)||"error loading stream"})}const W=d("ads/ima/sdk");var G;async function H(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 W(":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",G.LOADING),K(r,t,s),r.src=e,document.head.appendChild(r)})}(i),void W(":loaded")}catch(e){W(":error "+e.message,e)}}function K(e,t,s){const r=e.getAttribute("state");if(r&&[G.ERROR,G.LOADED].includes(r))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",G.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",G.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(G||(G={}));const $=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends $.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 Z(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 X=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&&Z(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 Y=(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),J=(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 ee(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+":"+ee(r)+":"+ee(e)):t+ee(r)+":"+ee(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()}`)})}}var te;const se=[X,new class Dai{async init(e,t){var s,r;if(t.ssai)return this.make_analytics(t),await H(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 H(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.customAssetKey||!!t.requestStreamUrl,this.isVod=!!t.contentSourceId||!!t.videoId||!!t.requestStreamUrl,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}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)}}],re=((te=class Ssai{constructor(e){this.umd=e,J(e,"flowplayer-ssai-ui",SSAIAdUi),J(e,"flowplayer-ssai-timeline",SSAITimeline),J(e,"flowplayer-ssai-controls",SSAIControls),J(e,"flowplayer-ssai-indicator",SSAIAdIndicator)}init(e,t,i){se.forEach(e=>{if(i.ssai||!e.exists())return;const n=Y(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 se.forEach(e=>{if(!r&&e.exists()&&e.srcIsValid(t))return r=!0}),r}}).events=o,te);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 s=e.flowplayer;return"function"==typeof s?(s(t),t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t),t)}(window,re)}));
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.16.0-rc"};const U="https://fp-eu-w1-aai.flowplayer.com/in",k="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.16.0-rc"})),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,[U,k,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 async 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");try{n.daiStream=await a(e.ssai.streamManager,i),e.ssai.streamManager.loadStreamMetadata(),e.setSrc(n.daiStream)}catch(t){z(e)}}(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 z(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}}function z(e,t){var s,r;const i=e.ssai.provider;if(null===(s=i.src)||void 0===s?void 0:s.backupStream)return e.setSrc(i.src.backupStream);e.emit("error",{message:(null===(r=null==t?void 0:t.getStreamData())||void 0===r?void 0:r.errorMessage)||"error loading stream"})}const W=d("ads/ima/sdk");var G;async function H(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 W(":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",G.LOADING),K(r,t,s),r.src=e,document.head.appendChild(r)})}(i),void W(":loaded")}catch(e){W(":error "+e.message,e)}}function K(e,t,s){const r=e.getAttribute("state");if(r&&[G.ERROR,G.LOADED].includes(r))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",G.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",G.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(G||(G={}));const $=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends $.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 Z(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 X=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&&Z(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 Y=(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),J=(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 ee(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+":"+ee(r)+":"+ee(e)):t+ee(r)+":"+ee(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()}`)})}}var te;const se=[X,new class Dai{async init(e,t){var s,r;if(t.ssai)return this.make_analytics(t),await H(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 H(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.customAssetKey||!!t.requestStreamUrl,this.isVod=!!t.contentSourceId||!!t.videoId||!!t.requestStreamUrl,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}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)}}],re=((te=class Ssai{constructor(e){this.umd=e,J(e,"flowplayer-ssai-ui",SSAIAdUi),J(e,"flowplayer-ssai-timeline",SSAITimeline),J(e,"flowplayer-ssai-controls",SSAIControls),J(e,"flowplayer-ssai-indicator",SSAIAdIndicator)}init(e,t,i){se.forEach(e=>{if(i.ssai||!e.exists())return;const n=Y(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 se.forEach(e=>{if(!r&&e.exists()&&e.srcIsValid(t))return r=!0}),r}}).events=o,te);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 s=e.flowplayer;return"function"==typeof s?(s(t),t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t),t)}(window,re)}));
@@ -347,6 +347,7 @@ declare type ErrorEventDetail = {
347
347
  declare namespace events {
348
348
  export {
349
349
  MOUNT,
350
+ RETRY,
350
351
  ERROR,
351
352
  CONTEXT_MENU,
352
353
  CLICK,
@@ -398,7 +399,8 @@ declare namespace events {
398
399
  LANDSCAPE,
399
400
  PORTRAIT,
400
401
  DVR,
401
- LIVE_2 as LIVE
402
+ LIVE,
403
+ RECOVER
402
404
  }
403
405
  }
404
406
 
@@ -652,8 +654,6 @@ declare const /**
652
654
  */
653
655
  LANDSCAPE = "landscape";
654
656
 
655
- declare const LIVE = "is-live";
656
-
657
657
  /**
658
658
  * @public
659
659
  * when src is a livestream
@@ -665,7 +665,9 @@ declare const /**
665
665
  * @public
666
666
  * when src is a livestream
667
667
  */
668
- LIVE_2 = "live";
668
+ LIVE = "live";
669
+
670
+ declare const LIVE_2 = "is-live";
669
671
 
670
672
  declare const LIVE_SEEKED = "is-live-seeked";
671
673
 
@@ -965,33 +967,27 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
965
967
 
966
968
  declare type PlayerCustomEventName = keyof PlayerCustomEventsDetailMap;
967
969
 
968
- declare type PlayerCustomEventsDetailMap = {
969
- [MOUNT]: MountEventDetail;
970
- [ERROR]: ErrorEventDetail;
971
- [CONTEXT_MENU]: ContextMenuEventDetail;
972
- /* Excluded from this release type: beforeplay */
973
- /* Excluded from this release type: beforepause */
974
- /* Excluded from this release type: state */
970
+ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap & {
971
+ [REAP]: ReapEventDetail;
972
+ [SOURCE]: SourceEventDetail;
975
973
  [CUEPOINT_START]: CuePointStartEventDetail;
976
974
  [CUEPOINT_END]: CuePointEndEventDetail;
977
- [VIEW_ENTER]: ViewEnterEventDetail;
978
- [VIEW_LEAVE]: ViewLeaveEventDetail;
979
- [SOURCE]: SourceEventDetail;
980
- /* Excluded from this release type: recover */
981
- [REAP]: ReapEventDetail;
982
- /* Excluded from this release type: config */
983
- [QUALITIES]: QualitiesEventDetail;
984
- /* Excluded from this release type: "error:fatal" */
985
- [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
975
+ [MOUNT]: MountEventDetail;
976
+ [LIVE]: LiveEventDetail;
977
+ [DVR]: DvrEventDetail;
978
+ [RETRY]: RetryEventDetail;
979
+ [RECOVER]: RecoverEventDetail;
986
980
  /* Excluded from this release type: audioonlysource */
987
981
  /* Excluded from this release type: renderplugin */
988
- [DVR]: DvrEventDetail;
989
- [LIVE_2]: LiveEventDetail;
990
982
  /* Excluded from this release type: "seek:queued" */
991
983
  /* Excluded from this release type: "seek:cancel" */
992
984
  /* Excluded from this release type: "plugin:registered" */
993
985
  /* Excluded from this release type: intersectionchange */
994
- /* Excluded from this release type: retry */
986
+ /* Excluded from this release type: beforeplay */
987
+ /* Excluded from this release type: beforepause */
988
+ /* Excluded from this release type: state */
989
+ /* Excluded from this release type: config */
990
+ /* Excluded from this release type: "error:fatal" */
995
991
  };
996
992
 
997
993
  declare type PlayerCustomEventsOverloads = {
@@ -1030,11 +1026,18 @@ declare type PlayerCustomEventsOverloads = {
1030
1026
  * Sent right before the player src attribute is set. This allows you to change the video URL before playback.
1031
1027
  */
1032
1028
  on(event: typeof SOURCE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof SOURCE]>) => void): Player;
1033
- /* Excluded from this release type: on */
1029
+ /**
1030
+ * Emitted when an Error recovery is attempted
1031
+ */
1032
+ on(event: typeof RECOVER, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RECOVER]>) => void): Player;
1034
1033
  /**
1035
1034
  * Sent when a flowplayer instance is about to be removed from the DOM, and any unsafe references are about to be reaped, which allows Single Page Applications to perform the necessary resource cleanups. This is important when working with front-end frameworks like React. This event should never be emitted directly, only listened to.
1036
1035
  */
1037
1036
  on(event: typeof REAP, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof REAP]>) => void): Player;
1037
+ /**
1038
+ * Emitted when a player will retry to reload
1039
+ */
1040
+ on(event: typeof RETRY, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RETRY]>) => void): Player;
1038
1041
  /* Excluded from this release type: on */
1039
1042
  /**
1040
1043
  * Emitted when the set of underlying qualities has changed.
@@ -1054,8 +1057,7 @@ declare type PlayerCustomEventsOverloads = {
1054
1057
  /**
1055
1058
  * when src is a livestream
1056
1059
  */
1057
- on(event: typeof LIVE_2, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof LIVE_2]>) => void): Player;
1058
- /* Excluded from this release type: on */
1060
+ on(event: typeof LIVE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof LIVE]>) => void): Player;
1059
1061
  /* Excluded from this release type: on */
1060
1062
  /* Excluded from this release type: on */
1061
1063
  /* Excluded from this release type: on */
@@ -1084,11 +1086,26 @@ declare type PlayerCustomEventsOverloads = {
1084
1086
  */
1085
1087
  off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1086
1088
  /* Excluded from this release type: poll */
1087
- emit<T extends PlayerCustomEventName>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1088
1089
  /* Excluded from this release type: emit */
1089
- emit<T, X extends string = string>(event: X & (X extends PlayerCustomEventName ? "Incorrect event detail type" : X), data?: T): Player;
1090
+ /* Excluded from this release type: emit */
1091
+ emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1092
+ /* Excluded from this release type: emit */
1093
+ };
1094
+
1095
+ declare type PlayerEmittableCustomEventsDetailMap = {
1096
+ [ERROR]: ErrorEventDetail;
1097
+ [CONTEXT_MENU]: ContextMenuEventDetail;
1098
+ [VIEW_ENTER]: ViewEnterEventDetail;
1099
+ [VIEW_LEAVE]: ViewLeaveEventDetail;
1100
+ [QUALITIES]: QualitiesEventDetail;
1101
+ [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1090
1102
  };
1091
1103
 
1104
+ declare type PlayerEmittableEventNames = keyof PlayerEmittableCustomEventsDetailMap;
1105
+
1106
+ /**
1107
+ * @public
1108
+ */
1092
1109
  declare type PlayerEventOverloads = PlayerNativeEventsOverloads & PlayerCustomEventsOverloads;
1093
1110
 
1094
1111
  declare type PlayerNativeEventName = keyof PlayerNativeEventsDetailMap;
@@ -1282,9 +1299,23 @@ declare type RecommendationsReadyEventDetail = {
1282
1299
  playlist: RecommendationItem[];
1283
1300
  };
1284
1301
 
1285
- /* Excluded from this release type: RECOVER */
1302
+ /**
1303
+ * @public
1304
+ * emitted when an Error recovery is attempted
1305
+ */
1306
+ declare const /**
1307
+ @public
1308
+ * when a new player is inserted into the HTML
1309
+ */ /**
1310
+ * @public
1311
+ * emitted when an Error recovery is attempted
1312
+ */
1313
+ RECOVER = "recover";
1286
1314
 
1287
- /* Excluded from this release type: RecoverEventDetail */
1315
+ /**
1316
+ * @public
1317
+ */
1318
+ declare type RecoverEventDetail = null;
1288
1319
 
1289
1320
  /* Excluded from this release type: REMOTE_SESSION_ENDED */
1290
1321
 
@@ -1308,9 +1339,21 @@ declare const /**
1308
1339
  */
1309
1340
  RESIZE = "resize";
1310
1341
 
1311
- /* Excluded from this release type: RETRY */
1342
+ /**
1343
+ * @public
1344
+ */
1345
+ declare const /**
1346
+ @public
1347
+ * when a new player is inserted into the HTML
1348
+ */ /**
1349
+ * @public
1350
+ */
1351
+ RETRY = "retry";
1312
1352
 
1313
- /* Excluded from this release type: RetryEventDetail */
1353
+ /**
1354
+ * @public
1355
+ */
1356
+ declare type RetryEventDetail = null;
1314
1357
 
1315
1358
  declare const RTL = "is-rtl";
1316
1359
 
@@ -1445,7 +1488,7 @@ declare namespace states {
1445
1488
  RTL,
1446
1489
  TV,
1447
1490
  ENDED,
1448
- LIVE,
1491
+ LIVE_2 as LIVE,
1449
1492
  ERRORED,
1450
1493
  WAITING,
1451
1494
  AUTOPLAY,
@@ -344,6 +344,7 @@ declare type ErrorEventDetail = {
344
344
  declare namespace events {
345
345
  export {
346
346
  MOUNT,
347
+ RETRY,
347
348
  ERROR,
348
349
  CONTEXT_MENU,
349
350
  CLICK,
@@ -395,7 +396,8 @@ declare namespace events {
395
396
  LANDSCAPE,
396
397
  PORTRAIT,
397
398
  DVR,
398
- LIVE_2 as LIVE
399
+ LIVE,
400
+ RECOVER
399
401
  }
400
402
  }
401
403
 
@@ -594,8 +596,6 @@ declare const /**
594
596
  */
595
597
  LANDSCAPE = "landscape";
596
598
 
597
- declare const LIVE = "is-live";
598
-
599
599
  /**
600
600
  * @public
601
601
  * when src is a livestream
@@ -607,7 +607,9 @@ declare const /**
607
607
  * @public
608
608
  * when src is a livestream
609
609
  */
610
- LIVE_2 = "live";
610
+ LIVE = "live";
611
+
612
+ declare const LIVE_2 = "is-live";
611
613
 
612
614
  declare const LIVE_SEEKED = "is-live-seeked";
613
615
 
@@ -907,33 +909,27 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
907
909
 
908
910
  declare type PlayerCustomEventName = keyof PlayerCustomEventsDetailMap;
909
911
 
910
- declare type PlayerCustomEventsDetailMap = {
911
- [MOUNT]: MountEventDetail;
912
- [ERROR]: ErrorEventDetail;
913
- [CONTEXT_MENU]: ContextMenuEventDetail;
914
- /* Excluded from this release type: beforeplay */
915
- /* Excluded from this release type: beforepause */
916
- /* Excluded from this release type: state */
912
+ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap & {
913
+ [REAP]: ReapEventDetail;
914
+ [SOURCE]: SourceEventDetail;
917
915
  [CUEPOINT_START]: CuePointStartEventDetail;
918
916
  [CUEPOINT_END]: CuePointEndEventDetail;
919
- [VIEW_ENTER]: ViewEnterEventDetail;
920
- [VIEW_LEAVE]: ViewLeaveEventDetail;
921
- [SOURCE]: SourceEventDetail;
922
- /* Excluded from this release type: recover */
923
- [REAP]: ReapEventDetail;
924
- /* Excluded from this release type: config */
925
- [QUALITIES]: QualitiesEventDetail;
926
- /* Excluded from this release type: "error:fatal" */
927
- [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
917
+ [MOUNT]: MountEventDetail;
918
+ [LIVE]: LiveEventDetail;
919
+ [DVR]: DvrEventDetail;
920
+ [RETRY]: RetryEventDetail;
921
+ [RECOVER]: RecoverEventDetail;
928
922
  /* Excluded from this release type: audioonlysource */
929
923
  /* Excluded from this release type: renderplugin */
930
- [DVR]: DvrEventDetail;
931
- [LIVE_2]: LiveEventDetail;
932
924
  /* Excluded from this release type: "seek:queued" */
933
925
  /* Excluded from this release type: "seek:cancel" */
934
926
  /* Excluded from this release type: "plugin:registered" */
935
927
  /* Excluded from this release type: intersectionchange */
936
- /* Excluded from this release type: retry */
928
+ /* Excluded from this release type: beforeplay */
929
+ /* Excluded from this release type: beforepause */
930
+ /* Excluded from this release type: state */
931
+ /* Excluded from this release type: config */
932
+ /* Excluded from this release type: "error:fatal" */
937
933
  };
938
934
 
939
935
  declare type PlayerCustomEventsOverloads = {
@@ -972,11 +968,18 @@ declare type PlayerCustomEventsOverloads = {
972
968
  * Sent right before the player src attribute is set. This allows you to change the video URL before playback.
973
969
  */
974
970
  on(event: typeof SOURCE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof SOURCE]>) => void): Player;
975
- /* Excluded from this release type: on */
971
+ /**
972
+ * Emitted when an Error recovery is attempted
973
+ */
974
+ on(event: typeof RECOVER, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RECOVER]>) => void): Player;
976
975
  /**
977
976
  * Sent when a flowplayer instance is about to be removed from the DOM, and any unsafe references are about to be reaped, which allows Single Page Applications to perform the necessary resource cleanups. This is important when working with front-end frameworks like React. This event should never be emitted directly, only listened to.
978
977
  */
979
978
  on(event: typeof REAP, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof REAP]>) => void): Player;
979
+ /**
980
+ * Emitted when a player will retry to reload
981
+ */
982
+ on(event: typeof RETRY, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RETRY]>) => void): Player;
980
983
  /* Excluded from this release type: on */
981
984
  /**
982
985
  * Emitted when the set of underlying qualities has changed.
@@ -996,8 +999,7 @@ declare type PlayerCustomEventsOverloads = {
996
999
  /**
997
1000
  * when src is a livestream
998
1001
  */
999
- on(event: typeof LIVE_2, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof LIVE_2]>) => void): Player;
1000
- /* Excluded from this release type: on */
1002
+ on(event: typeof LIVE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof LIVE]>) => void): Player;
1001
1003
  /* Excluded from this release type: on */
1002
1004
  /* Excluded from this release type: on */
1003
1005
  /* Excluded from this release type: on */
@@ -1026,11 +1028,26 @@ declare type PlayerCustomEventsOverloads = {
1026
1028
  */
1027
1029
  off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1028
1030
  /* Excluded from this release type: poll */
1029
- emit<T extends PlayerCustomEventName>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1030
1031
  /* Excluded from this release type: emit */
1031
- emit<T, X extends string = string>(event: X & (X extends PlayerCustomEventName ? "Incorrect event detail type" : X), data?: T): Player;
1032
+ /* Excluded from this release type: emit */
1033
+ emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1034
+ /* Excluded from this release type: emit */
1035
+ };
1036
+
1037
+ declare type PlayerEmittableCustomEventsDetailMap = {
1038
+ [ERROR]: ErrorEventDetail;
1039
+ [CONTEXT_MENU]: ContextMenuEventDetail;
1040
+ [VIEW_ENTER]: ViewEnterEventDetail;
1041
+ [VIEW_LEAVE]: ViewLeaveEventDetail;
1042
+ [QUALITIES]: QualitiesEventDetail;
1043
+ [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1032
1044
  };
1033
1045
 
1046
+ declare type PlayerEmittableEventNames = keyof PlayerEmittableCustomEventsDetailMap;
1047
+
1048
+ /**
1049
+ * @public
1050
+ */
1034
1051
  declare type PlayerEventOverloads = PlayerNativeEventsOverloads & PlayerCustomEventsOverloads;
1035
1052
 
1036
1053
  declare type PlayerNativeEventName = keyof PlayerNativeEventsDetailMap;
@@ -1224,9 +1241,23 @@ declare type RecommendationsReadyEventDetail = {
1224
1241
  playlist: RecommendationItem[];
1225
1242
  };
1226
1243
 
1227
- /* Excluded from this release type: RECOVER */
1244
+ /**
1245
+ * @public
1246
+ * emitted when an Error recovery is attempted
1247
+ */
1248
+ declare const /**
1249
+ @public
1250
+ * when a new player is inserted into the HTML
1251
+ */ /**
1252
+ * @public
1253
+ * emitted when an Error recovery is attempted
1254
+ */
1255
+ RECOVER = "recover";
1228
1256
 
1229
- /* Excluded from this release type: RecoverEventDetail */
1257
+ /**
1258
+ * @public
1259
+ */
1260
+ declare type RecoverEventDetail = null;
1230
1261
 
1231
1262
  /* Excluded from this release type: REMOTE_SESSION_ENDED */
1232
1263
 
@@ -1250,9 +1281,21 @@ declare const /**
1250
1281
  */
1251
1282
  RESIZE = "resize";
1252
1283
 
1253
- /* Excluded from this release type: RETRY */
1284
+ /**
1285
+ * @public
1286
+ */
1287
+ declare const /**
1288
+ @public
1289
+ * when a new player is inserted into the HTML
1290
+ */ /**
1291
+ * @public
1292
+ */
1293
+ RETRY = "retry";
1254
1294
 
1255
- /* Excluded from this release type: RetryEventDetail */
1295
+ /**
1296
+ * @public
1297
+ */
1298
+ declare type RetryEventDetail = null;
1256
1299
 
1257
1300
  declare const RTL = "is-rtl";
1258
1301
 
@@ -1387,7 +1430,7 @@ declare namespace states {
1387
1430
  RTL,
1388
1431
  TV,
1389
1432
  ENDED,
1390
- LIVE,
1433
+ LIVE_2 as LIVE,
1391
1434
  ERRORED,
1392
1435
  WAITING,
1393
1436
  AUTOPLAY,