@flowplayer/player 3.15.1-rc → 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 +76 -33
  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 +76 -33
  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
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.chromecast=t())}(this,(function(){"use strict";function e(e){const t=document.createElement("a");t.href=e;const n=t.pathname&&t.pathname.split(".");return n.length>1&&n[n.length-1]}function t(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const n=n=>{var{src:r}=n,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["src"]);return[Object.assign({src:r,type:r?t("video/"+e(r)):""},o)]};function r(e){return n({src:e})}class Pipe{constructor(e){this.data=e}static of(e){return new Pipe(e)}static maybe(e,t,...n){return null==e?e:t.apply(e,[e,...n])}tap(e,...t){return e.apply(this,[this.data,...t]),new Pipe(this.data)}fmap(e,...t){const n=e.apply(this,[this.data,...t]);return new Pipe(n)}unwrap(){return this.data}}const o="chromecast:idle";var a=Object.freeze({__proto__:null,CAST_AVAILABLE:"chromecast:available",CAST_UNAVAILABLE:"chromecast:unavailable",CAST_START_CASTING:"chromecast:start",CAST_IDLE:o,CAST_STATE_CHANGED:"chromecast:state:changed",CAST_SESSION_CHANGED:"chromecast:session:changed",CAST_FIELD_UPDATE:"chromecast:field:update",CAST_MEDIA_LOAD_REQUEST:"chromecast:media"});const s=/(video\/mp4)|(application\/x-mpegurl)|(video\/mpd)|(application\/dash\+xml)/;function i(){var e;return(null===(e=f())||void 0===e?void 0:e.getCurrentSession())||null}function c(e){return p(e).unwrap().shift()}function l(){var e;return(null===(e=i())||void 0===e?void 0:e.getMediaSession())||null}function u(e){var t,n;const r=p(e).unwrap().map((function(e){return null==e?void 0:e.src})),o=null===(n=null===(t=l())||void 0===t?void 0:t.media)||void 0===n?void 0:n.contentId;return!!o&&!!~r.indexOf(o)}function d(e){var t;return(null===(t=e.type)||void 0===t?void 0:t.match(s))||!1}function m(e,t){if(!t.opts.src)return e;const n=(Array.isArray(t.opts.src)?t.opts.src:[t.opts.src]).map(e=>"string"==typeof e?r(e)[0]:e);return e.map(e=>{const t=n.find(t=>t.src===e.src);return t&&t.drm?Object.assign(Object.assign({},e),{drm:t.drm}):e})}function p(e){return Pipe.of(e).fmap(()=>e.original_src||[]).fmap((function(e){return"string"==typeof e?r(e):e})).fmap(m,e).fmap((function(e){return e.filter(d)}))}function f(){var e,t,n;return null===(n=null===(t=null===(e=window.cast)||void 0===e?void 0:e.framework)||void 0===t?void 0:t.CastContext)||void 0===n?void 0:n.getInstance()}function v(e){return e.filter((function(e){return u(e)}))}function h(e){return e.filter((function(e){return!u(e)}))}function y(e,t,n){v(e).forEach((function(e){e.emit(t,n)}))}function S(e,t,n){h(e).forEach((function(e){e.emit(t,n)}))}function E(e,t,n){e.forEach((function(e){e.emit(t,n)}))}const g={PAUSED:"isPaused",CURRENT_TIME:"currentTime",DURATION:"duration",CONNECTED:"isConnected",PLAYER_STATE:"playerState",SAVED_STATE:"savedPlayerState",DISPLAY_NAME:"displayName",STATUS:"statusText",VOLUME:"volumeLevel",MUTE:"isMuted",LIVE_RANGES:"liveSeekableRange"},w={player:void 0,controller:void 0,listener:void 0};function _(e){w.controller&&w.listener&&w.controller.removeEventListener(cast.framework.RemotePlayerEventType.ANY_CHANGE,w.listener),w.player=new cast.framework.RemotePlayer,w.controller=new cast.framework.RemotePlayerController(w.player),w.listener=T.bind(null,e),w.controller.addEventListener(cast.framework.RemotePlayerEventType.ANY_CHANGE,w.listener)}function T(e,t){if("IDLE"===t.value)return S(e,o);y(e,"chromecast:field:update",t)}function b(e){return Array.from(e.textTracks).filter(e=>["subtitles","captions"].includes(e.kind))}function A(e){return b(e).flatMap((t,n)=>{try{const r=e.querySelector("#"+t.id);if(!(r instanceof HTMLTrackElement&&r.lang))return[];const o=new chrome.cast.media.Track(n+1e3,chrome.cast.media.TrackType.TEXT);return o.trackContentType="text/vtt",o.subtype=chrome.cast.media.TextTrackType.SUBTITLES,o.trackContentId=r.src,o.name=r.label,o.language=r.lang,o}catch(e){return[]}})}function C(e){var t;const n=new chrome.cast.media.EditTracksInfoRequest(e);null===(t=l())||void 0===t||t.editTracksInfo(n,console.debug,console.error)}var k=Object.freeze({__proto__:null,getCurrentSession:i,getMedia:c,getMediaSession:l,isSame:u,is_supported_media:d,injectDRMConfiguration:m,normalizeSrc:p,getCastContext:f,casting_players:v,idle_players:h,broadcast_to_active:y,broadcast_to_idle:S,broadcast:E,FIELDS:g,SINGLETONS:w,refresh_singletons:_,onremotechange:T,tracks:b,cast_tracks:A,editTracks:C});function O(e,t,n,r){var a,s,l,u,d;const m=i();if(!m)return;const p=c(e);if(!p||!p.src)return;const f=new chrome.cast.media.MediaInfo(p.src,p.type||"");f.metadata=new chrome.cast.media.GenericMediaMetadata;const v={health:e.health,text_tracks:A(e),active_tracks:{active_audio:(null===(s=null===(a=null==e?void 0:e.asel)||void 0===a?void 0:a.active_track)||void 0===s?void 0:s.name)||(null===(u=null===(l=null==e?void 0:e.asel)||void 0===l?void 0:l.active_track)||void 0===u?void 0:u.lang),active_text:null===(d=b(e).find(e=>e.is_active))||void 0===d?void 0:d.label}};p.drm&&(v.drm=p.drm),localStorage.__fpChromecastDebug&&(v.debug=!0),e.opt("ads")&&(v.ads=e.opt("ads")),f.customData=v;const h=new chrome.cast.media.LoadRequest(f);isNaN(e.currentTime)||(h.currentTime=e.currentSessionTime),h.customData=e.opt("chromecast",{}),h.customData.metadata=e.opt("metadata"),e.emit("chromecast:media",{request:h}),console.debug("cast:request(%o)",h),m.loadMedia(h).then((function(){_(t);const n=w.player;n&&(e.volume=n.volumeLevel,e.muted=n.isMuted),S(t,o)}),r)}function L(){return!!l()}function I(){return!!i()}function N(){var e;return(null===(e=null==k?void 0:i())||void 0===e?void 0:e.getMediaSession()).getEstimatedLiveSeekableRange()}function D(){var e;return null===(e=l())||void 0===e?void 0:e.media.duration}function P(){var e;return null===(e=l())||void 0===e?void 0:e.playerState}function x(e){var t;return e?M(e):null===(t=l())||void 0===t?void 0:t.getEstimatedTime()}function M(e){const t=l();if(!t)return e;const n=new chrome.cast.media.SeekRequest;return n.currentTime=e,t.seek(n,console.debug,console.error),e}function R(){var e;return null===(e=l())||void 0===e?void 0:e.play(new chrome.cast.media.PlayRequest,console.debug,console.error)}function j(){var e;return null===(e=l())||void 0===e?void 0:e.pause(new chrome.cast.media.PauseRequest,console.debug,console.error)}var U=Object.freeze({__proto__:null,load:O,has_media:L,exists:I,device_name:function(){var e;return null===(e=i())||void 0===e?void 0:e.getCastDevice().friendlyName},seekable_ranges:N,duration:D,state:P,currentTime:x,seek:M,play:R,pause:j});class Sender{constructor(e){this.video=e}static of(e){return e.sender||(e.sender=new Sender(e)),e.sender}static maybe(e,t){e.sender&&t(e.sender,e)}static getEstimatedTime(){var e;return null===(e=l())||void 0===e?void 0:e.getEstimatedTime()}static load(e,t){O(e,t,console.debug,console.error)}static destroy(e){e.video=void 0}}var G="audio:update";var q=Object.freeze({__proto__:null,STABLE:"940D4BE4",CANARY:"6F71FA7C",LOCAL:"5258CA32"});const H="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";function V(e,t,n){if(document.querySelector("script[src='"+H+"']"))return B(n);!function(){const e=document.createElement("script");e.async=!0,e.src=H,document.head.appendChild(e)}(),window.__onGCastApiAvailable=function(){!function(e,t,n){var r;if(!F())return;const o=(null===(r=e.chromecast)||void 0===r?void 0:r.app)||"940D4BE4",a=f();if(!a)return;a.setOptions({receiverApplicationId:o,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),a.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,(function(e){E(n,"chromecast:state:changed",e)})),a.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,(function(e){_(n),E(n,"chromecast:session:changed",e)}))}(e,0,n),B(n)}}function F(){return"object"==typeof window.cast&&"object"==typeof chrome.cast}function B(e){if(F())return E(e,"chromecast:available");E(e,"chromecast:unavailable")}function Y(e,t){const n={play:function(){return new Promise(n=>u(e)?n(R()):L()?n(Sender.load(e,t)):(Sender.load(e,t),void n()))},pause:function(){return u(e)?j():HTMLMediaElement.prototype.pause.call(e)}};n.currentTime={get:x,set:x},n.seekable={get:()=>{const e=N();return{start:()=>(null==e?void 0:e.start)||0,end:()=>(null==e?void 0:e.end)||0,length:1}}},n.duration={get:D},n.paused={get:function(){return"PAUSED"===P()}},n.playing={get:function(){return"PLAYING"===P()}},Object.keys(n).forEach((function(t){if("object"==typeof n[t])return Object.defineProperty(e,t,{get:function(){var r,o;return u(e)?n[t].get():null===(o=null===(r=Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,t))||void 0===r?void 0:r.get)||void 0===o?void 0:o.call(this)},set:function(r){var o,a;return u(e)?n[t].set(r):null===(a=null===(o=Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,t))||void 0===o?void 0:o.set)||void 0===a?void 0:a.call(this,r)}});const r=e[t];e[t]=function(){const o=[].slice.apply(arguments);return I()?n[t].apply(e,o):r.apply(e,o)}}))}const z=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)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 o=window.customElements.get(n);return"function"!=typeof o?r:o})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class FlowplayerChromecastIcon extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-cast-button"),this.setAttribute("tabindex","-1"),this.setAttribute("role","button"),this.setAttribute("aria-hidden","true"),this.cast_launcher=document.createElement("google-cast-launcher"),this.cast_launcher.setAttribute("inert","true"),this.append(this.cast_launcher),this.addEventListener("click",t=>{const n=i();if(n)return n.endSession(!0);e.emit("chromecast:start"),t.target===this&&this.cast_launcher.click()}),e.on("chromecast:state:changed",t=>{const n=t.detail.castState;n&&(this.setAttribute("tabindex",n===cast.framework.CastState.NO_DEVICES_AVAILABLE?"-1":"0"),this.setAttribute("aria-hidden",(n===cast.framework.CastState.NO_DEVICES_AVAILABLE)+""),this.setAttribute("aria-label",n===cast.framework.CastState.NOT_CONNECTED?e.i18n("chromecast.start","start casting"):e.i18n("chromecast.stop","stop casting")))})}}function J(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}class ChromecastPlugin{constructor(e){var t,n,r;this.flowplayer=e,t=e,n="flowplayer-chromecast-icon",r=FlowplayerChromecastIcon,window.customElements.get(n)||window.customElements.define(n,r),t.customElements.get(n)||t.customElements.set(n,n)}init(e,t,n){if("https:"!==location.protocol&&"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname)return console.warn("Secure URL required to enable Chromecast");V(e,0,this.flowplayer.instances);const r={pending:void 0};n.on("reap",(function(){Sender.maybe(n,Sender.destroy)})),n.on("mount",(function(){const t=J(n,"flowplayer-middle");t&&function(e,t){const n=document.createElement("div");n.className="fp-chromecast";const r=document.createElement("p");t.poster&&(n.style.backgroundImage=["url(",t.poster,")"].join("")),n.append(r),e.prepend(n)}(t,{poster:e.poster});const r=J(n,"flowplayer-header-right-zone");r&&r.prepend(z(n,"flowplayer-chromecast-icon"))})),n.on("chromecast:available",()=>{n.setState("is-cast-available",!0),Sender.of(n),Y(n,this.flowplayer.instances)}),n.on("chromecast:unavailable",(function(){n.setState("is-cast-available",!1),Sender.maybe(n,Sender.destroy)})),n.on("chromecast:start",()=>{if(this.flowplayer.instances.forEach(e=>{e.togglePlay(!1),e.currentSessionTime=e.hasState("is-ended")?0:e.currentTime}),L())return Sender.load(n,this.flowplayer.instances);r.pending=!0}),n.on("volumechange",()=>{const e=w.player,t=w.controller;if(!L()||!e||!t)return;const r=n.volume,o=n.muted;r!==e.volumeLevel&&(e.volumeLevel=r,t.setVolumeLevel()),o!==e.isMuted&&t.muteOrUnmute()}),n.on("tracks:text:updated",(function(e){var t;if(L())return e.data?void C((null===(t=l())||void 0===t?void 0:t.media.tracks.filter(e=>"TEXT"===e.type).filter(e=>{var t;return e.name===(null===(t=b(n).find(e=>e.is_active))||void 0===t?void 0:t.label)}).map(e=>e.trackId))||[]):C([])})),n.on(G,()=>{L()&&setTimeout(()=>{var e,t,r;const o=null===(e=null==n?void 0:n.asel)||void 0===e?void 0:e.active_track,a=null===(r=null===(t=l())||void 0===t?void 0:t.media.tracks.filter(e=>"AUDIO"===e.type).find(e=>void 0!==e.name?e.name===(null==o?void 0:o.name):e.language===(null==o?void 0:o.lang)))||void 0===r?void 0:r.trackId;"number"==typeof a&&C([a])},0)}),n.on(o,()=>{this.reset_state(n);const e=n.opt("duration");"number"==typeof e&&Math.abs(e-n.currentSessionTime)<=1&&(n.currentSessionTime=0,n.setState("is-paused",!1),n.emit("ended"))}),n.on("chromecast:field:update",(function(e){if(!e.data)return;const{field:t,value:r}=e.data;switch(t){case g.MUTE:return n.muted=r;case g.VOLUME:return n.volume=r;case g.CURRENT_TIME:{Math.abs(r-n.currentSessionTime)>=1.5&&n.emit("seeked"),n.currentSessionTime=r,n.emit("timeupdate",r);const e=N();if(e){n.opts.live||n.setOpts({live:!0});const t=e.end,r=e.start;if("number"!=typeof r||"number"!=typeof t)return;n.emit("dvr/window",t-r)}return}case g.PLAYER_STATE:return"PLAYING"==r?n.emit("playing"):"PAUSED"==r?n.emit("pause"):void 0;case"videoInfo":var o=(r||{}).fake_session||U;return function(e,t){if(!e.root)return;const n=e.root.querySelector(".fp-chromecast p");if(!n)return;let r="";r=e.i18n("chromecast.message","{{state}} on {{device}}").replace("{{device}}",(null==t?void 0:t.device)||"chromecast"),r=r.replace("{{state}}",((null==t?void 0:t.state)||"").toLowerCase()),n.textContent=r}(n,{device:o.device_name(),state:o.state()}),o.hide_controls&&n.setState("no-chromecast-controls",!0),n.setState("is-starting",!1),n.hasState("is-loaded")||-1===n.duration||n.setOpts({duration:n.duration}),n.setState("is-chromecast-playing",!0)}})),n.on("chromecast:session:changed",e=>{if(e.data)switch(e.detail.sessionState){case cast.framework.SessionState.SESSION_ENDED:return n.emit("remotesession:ended",{currentTime:n.currentSessionTime}),n.setState("is-casting",!1),this.reset_state(n);case cast.framework.SessionState.SESSION_RESUMED:case cast.framework.SessionState.SESSION_STARTED:r.pending&&(r.pending=!1,Sender.load(n,this.flowplayer.instances),n.emit("remotesession:started"),n.setState("is-casting",!0))}})}reset_state(e){e.setState("is-chromecast-playing",!1),e.setState("is-playing",!1),e.setState("is-paused",!0),e.setState("is-starting",!0)}}ChromecastPlugin.apps=q,ChromecastPlugin.events=a;return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,ChromecastPlugin)}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.chromecast=t())}(this,(function(){"use strict";function e(e){const t=document.createElement("a");t.href=e;const n=t.pathname&&t.pathname.split(".");return n.length>1&&n[n.length-1]}function t(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const n=n=>{var{src:r}=n,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["src"]);return[Object.assign({src:r,type:r?t("video/"+e(r)):""},o)]};function r(e){return n({src:e})}class Pipe{constructor(e){this.data=e}static of(e){return new Pipe(e)}static maybe(e,t,...n){return null==e?e:t.apply(e,[e,...n])}tap(e,...t){return e.apply(this,[this.data,...t]),new Pipe(this.data)}fmap(e,...t){const n=e.apply(this,[this.data,...t]);return new Pipe(n)}unwrap(){return this.data}}const o="chromecast:idle";var a=Object.freeze({__proto__:null,CAST_AVAILABLE:"chromecast:available",CAST_UNAVAILABLE:"chromecast:unavailable",CAST_START_CASTING:"chromecast:start",CAST_IDLE:o,CAST_STATE_CHANGED:"chromecast:state:changed",CAST_SESSION_CHANGED:"chromecast:session:changed",CAST_FIELD_UPDATE:"chromecast:field:update",CAST_MEDIA_LOAD_REQUEST:"chromecast:media"});const s=/(video\/mp4)|(application\/x-mpegurl)|(video\/mpd)|(application\/dash\+xml)/;function i(){var e;return(null===(e=f())||void 0===e?void 0:e.getCurrentSession())||null}function c(e){return p(e).unwrap().shift()}function l(){var e;return(null===(e=i())||void 0===e?void 0:e.getMediaSession())||null}function u(e){var t,n;const r=p(e).unwrap().map((function(e){return null==e?void 0:e.src})),o=null===(n=null===(t=l())||void 0===t?void 0:t.media)||void 0===n?void 0:n.contentId;return!!o&&!!~r.indexOf(o)}function d(e){var t;return(null===(t=e.type)||void 0===t?void 0:t.match(s))||!1}function m(e,t){if(!t.opts.src)return e;const n=(Array.isArray(t.opts.src)?t.opts.src:[t.opts.src]).map(e=>"string"==typeof e?r(e)[0]:e);return e.map(e=>{const t=n.find(t=>t.src===e.src);return t&&t.drm?Object.assign(Object.assign({},e),{drm:t.drm}):e})}function p(e){return Pipe.of(e).fmap(()=>e.original_src||[]).fmap((function(e){return"string"==typeof e?r(e):e})).fmap(m,e).fmap((function(e){return e.filter(d)}))}function f(){var e,t,n;return null===(n=null===(t=null===(e=window.cast)||void 0===e?void 0:e.framework)||void 0===t?void 0:t.CastContext)||void 0===n?void 0:n.getInstance()}function v(e){return e.filter((function(e){return u(e)}))}function h(e){return e.filter((function(e){return!u(e)}))}function y(e,t,n){v(e).forEach((function(e){e.emit(t,n)}))}function S(e,t,n){h(e).forEach((function(e){e.emit(t,n)}))}function E(e,t,n){e.forEach((function(e){e.emit(t,n)}))}const g={PAUSED:"isPaused",CURRENT_TIME:"currentTime",DURATION:"duration",CONNECTED:"isConnected",PLAYER_STATE:"playerState",SAVED_STATE:"savedPlayerState",DISPLAY_NAME:"displayName",STATUS:"statusText",VOLUME:"volumeLevel",MUTE:"isMuted",LIVE_RANGES:"liveSeekableRange"},w={player:void 0,controller:void 0,listener:void 0};function _(e){w.controller&&w.listener&&w.controller.removeEventListener(cast.framework.RemotePlayerEventType.ANY_CHANGE,w.listener),w.player=new cast.framework.RemotePlayer,w.controller=new cast.framework.RemotePlayerController(w.player),w.listener=T.bind(null,e),w.controller.addEventListener(cast.framework.RemotePlayerEventType.ANY_CHANGE,w.listener)}function T(e,t){if("IDLE"===t.value)return S(e,o);y(e,"chromecast:field:update",t)}function b(e){return Array.from(e.textTracks).filter(e=>["subtitles","captions"].includes(e.kind))}function A(e){return b(e).flatMap((t,n)=>{try{const r=e.querySelector("#"+t.id);if(!(r instanceof HTMLTrackElement&&r.lang))return[];const o=new chrome.cast.media.Track(n+1e3,chrome.cast.media.TrackType.TEXT);return o.trackContentType="text/vtt",o.subtype=chrome.cast.media.TextTrackType.SUBTITLES,o.trackContentId=r.src,o.name=r.label,o.language=r.lang,o}catch(e){return[]}})}function C(e){var t;const n=new chrome.cast.media.EditTracksInfoRequest(e);null===(t=l())||void 0===t||t.editTracksInfo(n,console.debug,console.error)}var k=Object.freeze({__proto__:null,getCurrentSession:i,getMedia:c,getMediaSession:l,isSame:u,is_supported_media:d,injectDRMConfiguration:m,normalizeSrc:p,getCastContext:f,casting_players:v,idle_players:h,broadcast_to_active:y,broadcast_to_idle:S,broadcast:E,FIELDS:g,SINGLETONS:w,refresh_singletons:_,onremotechange:T,tracks:b,cast_tracks:A,editTracks:C});function O(e,t,n,r){var a,s,l,u,d;const m=i();if(!m)return;const p=c(e);if(!p||!p.src)return;const f=new chrome.cast.media.MediaInfo(p.src,p.type||"");f.metadata=new chrome.cast.media.GenericMediaMetadata;const v={health:e.health,text_tracks:A(e),active_tracks:{active_audio:(null===(s=null===(a=null==e?void 0:e.asel)||void 0===a?void 0:a.active_track)||void 0===s?void 0:s.name)||(null===(u=null===(l=null==e?void 0:e.asel)||void 0===l?void 0:l.active_track)||void 0===u?void 0:u.lang),active_text:null===(d=b(e).find(e=>e.is_active))||void 0===d?void 0:d.label}};p.drm&&(v.drm=p.drm),localStorage.__fpChromecastDebug&&(v.debug=!0),e.opt("ads")&&(v.ads=e.opt("ads")),f.customData=v;const h=new chrome.cast.media.LoadRequest(f);isNaN(e.currentTime)||(h.currentTime=e.currentSessionTime),h.customData=e.opt("chromecast",{}),h.customData.metadata=e.opt("metadata"),e.emit("chromecast:media",{request:h}),console.debug("cast:request(%o)",h),m.loadMedia(h).then((function(){_(t);const n=w.player;n&&(e.volume=n.volumeLevel,e.muted=n.isMuted),S(t,o)}),r)}function L(){return!!l()}function I(){return!!i()}function N(){var e;return(null===(e=null==k?void 0:i())||void 0===e?void 0:e.getMediaSession()).getEstimatedLiveSeekableRange()}function D(){var e;return null===(e=l())||void 0===e?void 0:e.media.duration}function P(){var e;return null===(e=l())||void 0===e?void 0:e.playerState}function x(e){var t;return e?M(e):null===(t=l())||void 0===t?void 0:t.getEstimatedTime()}function M(e){const t=l();if(!t)return e;const n=new chrome.cast.media.SeekRequest;return n.currentTime=e,t.seek(n,console.debug,console.error),e}function R(){var e;return null===(e=l())||void 0===e?void 0:e.play(new chrome.cast.media.PlayRequest,console.debug,console.error)}function j(){var e;return null===(e=l())||void 0===e?void 0:e.pause(new chrome.cast.media.PauseRequest,console.debug,console.error)}var U=Object.freeze({__proto__:null,load:O,has_media:L,exists:I,device_name:function(){var e;return null===(e=i())||void 0===e?void 0:e.getCastDevice().friendlyName},seekable_ranges:N,duration:D,state:P,currentTime:x,seek:M,play:R,pause:j});class Sender{constructor(e){this.video=e}static of(e){return e.sender||(e.sender=new Sender(e)),e.sender}static maybe(e,t){e.sender&&t(e.sender,e)}static getEstimatedTime(){var e;return null===(e=l())||void 0===e?void 0:e.getEstimatedTime()}static load(e,t){O(e,t,console.debug,console.error)}static destroy(e){e.video=void 0}}var G=Object.freeze({__proto__:null,STABLE:"940D4BE4",CANARY:"6F71FA7C",LOCAL:"5258CA32"});const q="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";function H(e,t,n){if(document.querySelector("script[src='"+q+"']"))return F(n);!function(){const e=document.createElement("script");e.async=!0,e.src=q,document.head.appendChild(e)}(),window.__onGCastApiAvailable=function(){!function(e,t,n){var r;if(!V())return;const o=(null===(r=e.chromecast)||void 0===r?void 0:r.app)||"940D4BE4",a=f();if(!a)return;a.setOptions({receiverApplicationId:o,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),a.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,(function(e){E(n,"chromecast:state:changed",e)})),a.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,(function(e){_(n),E(n,"chromecast:session:changed",e)}))}(e,0,n),F(n)}}function V(){return"object"==typeof window.cast&&"object"==typeof chrome.cast}function F(e){if(V())return E(e,"chromecast:available");E(e,"chromecast:unavailable")}function B(e,t){const n={play:function(){return new Promise(n=>u(e)?n(R()):L()?n(Sender.load(e,t)):(Sender.load(e,t),void n()))},pause:function(){return u(e)?j():HTMLMediaElement.prototype.pause.call(e)}};n.currentTime={get:x,set:x},n.seekable={get:()=>{const e=N();return{start:()=>(null==e?void 0:e.start)||0,end:()=>(null==e?void 0:e.end)||0,length:1}}},n.duration={get:D},n.paused={get:function(){return"PAUSED"===P()}},n.playing={get:function(){return"PLAYING"===P()}},Object.keys(n).forEach((function(t){if("object"==typeof n[t])return Object.defineProperty(e,t,{get:function(){var r,o;return u(e)?n[t].get():null===(o=null===(r=Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,t))||void 0===r?void 0:r.get)||void 0===o?void 0:o.call(this)},set:function(r){var o,a;return u(e)?n[t].set(r):null===(a=null===(o=Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,t))||void 0===o?void 0:o.set)||void 0===a?void 0:a.call(this,r)}});const r=e[t];e[t]=function(){const o=[].slice.apply(arguments);return I()?n[t].apply(e,o):r.apply(e,o)}}))}const Y=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)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 o=window.customElements.get(n);return"function"!=typeof o?r:o})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class FlowplayerChromecastIcon extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-cast-button"),this.setAttribute("tabindex","-1"),this.setAttribute("role","button"),this.setAttribute("aria-hidden","true"),this.cast_launcher=document.createElement("google-cast-launcher"),this.cast_launcher.setAttribute("inert","true"),this.append(this.cast_launcher),this.addEventListener("click",t=>{const n=i();if(n)return n.endSession(!0);e.emit("chromecast:start"),t.target===this&&this.cast_launcher.click()}),e.on("chromecast:state:changed",t=>{const n=t.detail.castState;n&&(this.setAttribute("tabindex",n===cast.framework.CastState.NO_DEVICES_AVAILABLE?"-1":"0"),this.setAttribute("aria-hidden",(n===cast.framework.CastState.NO_DEVICES_AVAILABLE)+""),this.setAttribute("aria-label",n===cast.framework.CastState.NOT_CONNECTED?e.i18n("chromecast.start","start casting"):e.i18n("chromecast.stop","stop casting")))})}}function z(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}class ChromecastPlugin{constructor(e){var t,n,r;this.flowplayer=e,t=e,n="flowplayer-chromecast-icon",r=FlowplayerChromecastIcon,window.customElements.get(n)||window.customElements.define(n,r),t.customElements.get(n)||t.customElements.set(n,n)}init(e,t,n){if("https:"!==location.protocol&&"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname)return console.warn("Secure URL required to enable Chromecast");H(e,0,this.flowplayer.instances);const r={pending:void 0};n.on("reap",(function(){Sender.maybe(n,Sender.destroy)})),n.on("mount",(function(){const t=z(n,"flowplayer-middle");t&&function(e,t){const n=document.createElement("div");n.className="fp-chromecast";const r=document.createElement("p");t.poster&&(n.style.backgroundImage=["url(",t.poster,")"].join("")),n.append(r),e.prepend(n)}(t,{poster:e.poster});const r=z(n,"flowplayer-header-right-zone");r&&r.prepend(Y(n,"flowplayer-chromecast-icon"))})),n.on("chromecast:available",()=>{n.setState("is-cast-available",!0),Sender.of(n),B(n,this.flowplayer.instances)}),n.on("chromecast:unavailable",(function(){n.setState("is-cast-available",!1),Sender.maybe(n,Sender.destroy)})),n.on("chromecast:start",()=>{if(this.flowplayer.instances.forEach(e=>{e.togglePlay(!1),e.currentSessionTime=e.hasState("is-ended")?0:e.currentTime}),L())return Sender.load(n,this.flowplayer.instances);r.pending=!0}),n.on("volumechange",()=>{const e=w.player,t=w.controller;if(!L()||!e||!t)return;const r=n.volume,o=n.muted;r!==e.volumeLevel&&(e.volumeLevel=r,t.setVolumeLevel()),o!==e.isMuted&&t.muteOrUnmute()}),n.on("tracks:text:updated",(function(e){var t;if(L())return e.data?void C((null===(t=l())||void 0===t?void 0:t.media.tracks.filter(e=>"TEXT"===e.type).filter(e=>{var t;return e.name===(null===(t=b(n).find(e=>e.is_active))||void 0===t?void 0:t.label)}).map(e=>e.trackId))||[]):C([])})),n.on("audio:update",()=>{L()&&setTimeout(()=>{var e,t,r;const o=null===(e=null==n?void 0:n.asel)||void 0===e?void 0:e.active_track,a=null===(r=null===(t=l())||void 0===t?void 0:t.media.tracks.filter(e=>"AUDIO"===e.type).find(e=>void 0!==e.name?e.name===(null==o?void 0:o.name):e.language===(null==o?void 0:o.lang)))||void 0===r?void 0:r.trackId;"number"==typeof a&&C([a])},0)}),n.on(o,()=>{this.reset_state(n);const e=n.opt("duration");"number"==typeof e&&Math.abs(e-n.currentSessionTime)<=1&&(n.currentSessionTime=0,n.setState("is-paused",!1),n.emit("ended"))}),n.on("chromecast:field:update",(function(e){if(!e.data)return;const{field:t,value:r}=e.data;switch(t){case g.MUTE:return n.muted=r;case g.VOLUME:return n.volume=r;case g.CURRENT_TIME:{Math.abs(r-n.currentSessionTime)>=1.5&&n.emit("seeked"),n.currentSessionTime=r,n.emit("timeupdate",r);const e=N();if(e){n.opts.live||n.setOpts({live:!0});const t=e.end,r=e.start;if("number"!=typeof r||"number"!=typeof t)return;n.emit("dvr/window",t-r)}return}case g.PLAYER_STATE:return"PLAYING"==r?n.emit("playing"):"PAUSED"==r?n.emit("pause"):void 0;case"videoInfo":var o=(r||{}).fake_session||U;return function(e,t){if(!e.root)return;const n=e.root.querySelector(".fp-chromecast p");if(!n)return;let r="";r=e.i18n("chromecast.message","{{state}} on {{device}}").replace("{{device}}",(null==t?void 0:t.device)||"chromecast"),r=r.replace("{{state}}",((null==t?void 0:t.state)||"").toLowerCase()),n.textContent=r}(n,{device:o.device_name(),state:o.state()}),o.hide_controls&&n.setState("no-chromecast-controls",!0),n.setState("is-starting",!1),n.hasState("is-loaded")||-1===n.duration||n.setOpts({duration:n.duration}),n.setState("is-chromecast-playing",!0)}})),n.on("chromecast:session:changed",e=>{if(e.data)switch(e.detail.sessionState){case cast.framework.SessionState.SESSION_ENDED:return n.emit("remotesession:ended",{currentTime:n.currentSessionTime}),n.setState("is-casting",!1),this.reset_state(n);case cast.framework.SessionState.SESSION_RESUMED:case cast.framework.SessionState.SESSION_STARTED:r.pending&&(r.pending=!1,Sender.load(n,this.flowplayer.instances),n.emit("remotesession:started"),n.setState("is-casting",!0))}})}reset_state(e){e.setState("is-chromecast-playing",!1),e.setState("is-playing",!1),e.setState("is-paused",!0),e.setState("is-starting",!0)}}ChromecastPlugin.apps=G,ChromecastPlugin.events=a;return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,ChromecastPlugin)}));
@@ -350,6 +350,7 @@ declare type ErrorEventDetail = {
350
350
  declare namespace events {
351
351
  export {
352
352
  MOUNT,
353
+ RETRY,
353
354
  ERROR,
354
355
  CONTEXT_MENU,
355
356
  CLICK,
@@ -401,7 +402,8 @@ declare namespace events {
401
402
  LANDSCAPE,
402
403
  PORTRAIT,
403
404
  DVR,
404
- LIVE_2 as LIVE
405
+ LIVE,
406
+ RECOVER
405
407
  }
406
408
  }
407
409
 
@@ -600,8 +602,6 @@ declare const /**
600
602
  */
601
603
  LANDSCAPE = "landscape";
602
604
 
603
- declare const LIVE = "is-live";
604
-
605
605
  /**
606
606
  * @public
607
607
  * when src is a livestream
@@ -613,7 +613,9 @@ declare const /**
613
613
  * @public
614
614
  * when src is a livestream
615
615
  */
616
- LIVE_2 = "live";
616
+ LIVE = "live";
617
+
618
+ declare const LIVE_2 = "is-live";
617
619
 
618
620
  declare const LIVE_SEEKED = "is-live-seeked";
619
621
 
@@ -913,33 +915,27 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
913
915
 
914
916
  declare type PlayerCustomEventName = keyof PlayerCustomEventsDetailMap;
915
917
 
916
- declare type PlayerCustomEventsDetailMap = {
917
- [MOUNT]: MountEventDetail;
918
- [ERROR]: ErrorEventDetail;
919
- [CONTEXT_MENU]: ContextMenuEventDetail;
920
- /* Excluded from this release type: beforeplay */
921
- /* Excluded from this release type: beforepause */
922
- /* Excluded from this release type: state */
918
+ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap & {
919
+ [REAP]: ReapEventDetail;
920
+ [SOURCE]: SourceEventDetail;
923
921
  [CUEPOINT_START]: CuePointStartEventDetail;
924
922
  [CUEPOINT_END]: CuePointEndEventDetail;
925
- [VIEW_ENTER]: ViewEnterEventDetail;
926
- [VIEW_LEAVE]: ViewLeaveEventDetail;
927
- [SOURCE]: SourceEventDetail;
928
- /* Excluded from this release type: recover */
929
- [REAP]: ReapEventDetail;
930
- /* Excluded from this release type: config */
931
- [QUALITIES]: QualitiesEventDetail;
932
- /* Excluded from this release type: "error:fatal" */
933
- [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
923
+ [MOUNT]: MountEventDetail;
924
+ [LIVE]: LiveEventDetail;
925
+ [DVR]: DvrEventDetail;
926
+ [RETRY]: RetryEventDetail;
927
+ [RECOVER]: RecoverEventDetail;
934
928
  /* Excluded from this release type: audioonlysource */
935
929
  /* Excluded from this release type: renderplugin */
936
- [DVR]: DvrEventDetail;
937
- [LIVE_2]: LiveEventDetail;
938
930
  /* Excluded from this release type: "seek:queued" */
939
931
  /* Excluded from this release type: "seek:cancel" */
940
932
  /* Excluded from this release type: "plugin:registered" */
941
933
  /* Excluded from this release type: intersectionchange */
942
- /* Excluded from this release type: retry */
934
+ /* Excluded from this release type: beforeplay */
935
+ /* Excluded from this release type: beforepause */
936
+ /* Excluded from this release type: state */
937
+ /* Excluded from this release type: config */
938
+ /* Excluded from this release type: "error:fatal" */
943
939
  };
944
940
 
945
941
  declare type PlayerCustomEventsOverloads = {
@@ -978,11 +974,18 @@ declare type PlayerCustomEventsOverloads = {
978
974
  * Sent right before the player src attribute is set. This allows you to change the video URL before playback.
979
975
  */
980
976
  on(event: typeof SOURCE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof SOURCE]>) => void): Player;
981
- /* Excluded from this release type: on */
977
+ /**
978
+ * Emitted when an Error recovery is attempted
979
+ */
980
+ on(event: typeof RECOVER, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RECOVER]>) => void): Player;
982
981
  /**
983
982
  * 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.
984
983
  */
985
984
  on(event: typeof REAP, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof REAP]>) => void): Player;
985
+ /**
986
+ * Emitted when a player will retry to reload
987
+ */
988
+ on(event: typeof RETRY, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RETRY]>) => void): Player;
986
989
  /* Excluded from this release type: on */
987
990
  /**
988
991
  * Emitted when the set of underlying qualities has changed.
@@ -1002,8 +1005,7 @@ declare type PlayerCustomEventsOverloads = {
1002
1005
  /**
1003
1006
  * when src is a livestream
1004
1007
  */
1005
- on(event: typeof LIVE_2, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof LIVE_2]>) => void): Player;
1006
- /* Excluded from this release type: on */
1008
+ on(event: typeof LIVE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof LIVE]>) => void): Player;
1007
1009
  /* Excluded from this release type: on */
1008
1010
  /* Excluded from this release type: on */
1009
1011
  /* Excluded from this release type: on */
@@ -1032,11 +1034,26 @@ declare type PlayerCustomEventsOverloads = {
1032
1034
  */
1033
1035
  off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1034
1036
  /* Excluded from this release type: poll */
1035
- emit<T extends PlayerCustomEventName>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1036
1037
  /* Excluded from this release type: emit */
1037
- emit<T, X extends string = string>(event: X & (X extends PlayerCustomEventName ? "Incorrect event detail type" : X), data?: T): Player;
1038
+ /* Excluded from this release type: emit */
1039
+ emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1040
+ /* Excluded from this release type: emit */
1041
+ };
1042
+
1043
+ declare type PlayerEmittableCustomEventsDetailMap = {
1044
+ [ERROR]: ErrorEventDetail;
1045
+ [CONTEXT_MENU]: ContextMenuEventDetail;
1046
+ [VIEW_ENTER]: ViewEnterEventDetail;
1047
+ [VIEW_LEAVE]: ViewLeaveEventDetail;
1048
+ [QUALITIES]: QualitiesEventDetail;
1049
+ [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1038
1050
  };
1039
1051
 
1052
+ declare type PlayerEmittableEventNames = keyof PlayerEmittableCustomEventsDetailMap;
1053
+
1054
+ /**
1055
+ * @public
1056
+ */
1040
1057
  declare type PlayerEventOverloads = PlayerNativeEventsOverloads & PlayerCustomEventsOverloads;
1041
1058
 
1042
1059
  declare type PlayerNativeEventName = keyof PlayerNativeEventsDetailMap;
@@ -1230,9 +1247,23 @@ declare type RecommendationsReadyEventDetail = {
1230
1247
  playlist: RecommendationItem[];
1231
1248
  };
1232
1249
 
1233
- /* Excluded from this release type: RECOVER */
1250
+ /**
1251
+ * @public
1252
+ * emitted when an Error recovery is attempted
1253
+ */
1254
+ declare const /**
1255
+ @public
1256
+ * when a new player is inserted into the HTML
1257
+ */ /**
1258
+ * @public
1259
+ * emitted when an Error recovery is attempted
1260
+ */
1261
+ RECOVER = "recover";
1234
1262
 
1235
- /* Excluded from this release type: RecoverEventDetail */
1263
+ /**
1264
+ * @public
1265
+ */
1266
+ declare type RecoverEventDetail = null;
1236
1267
 
1237
1268
  /* Excluded from this release type: REMOTE_SESSION_ENDED */
1238
1269
 
@@ -1256,9 +1287,21 @@ declare const /**
1256
1287
  */
1257
1288
  RESIZE = "resize";
1258
1289
 
1259
- /* Excluded from this release type: RETRY */
1290
+ /**
1291
+ * @public
1292
+ */
1293
+ declare const /**
1294
+ @public
1295
+ * when a new player is inserted into the HTML
1296
+ */ /**
1297
+ * @public
1298
+ */
1299
+ RETRY = "retry";
1260
1300
 
1261
- /* Excluded from this release type: RetryEventDetail */
1301
+ /**
1302
+ * @public
1303
+ */
1304
+ declare type RetryEventDetail = null;
1262
1305
 
1263
1306
  declare const RTL = "is-rtl";
1264
1307
 
@@ -1393,7 +1436,7 @@ declare namespace states {
1393
1436
  RTL,
1394
1437
  TV,
1395
1438
  ENDED,
1396
- LIVE,
1439
+ LIVE_2 as LIVE,
1397
1440
  ERRORED,
1398
1441
  WAITING,
1399
1442
  AUTOPLAY,
@@ -350,6 +350,7 @@ declare type ErrorEventDetail = {
350
350
  declare namespace events {
351
351
  export {
352
352
  MOUNT,
353
+ RETRY,
353
354
  ERROR,
354
355
  CONTEXT_MENU,
355
356
  CLICK,
@@ -401,7 +402,8 @@ declare namespace events {
401
402
  LANDSCAPE,
402
403
  PORTRAIT,
403
404
  DVR,
404
- LIVE_2 as LIVE
405
+ LIVE,
406
+ RECOVER
405
407
  }
406
408
  }
407
409
 
@@ -600,8 +602,6 @@ declare const /**
600
602
  */
601
603
  LANDSCAPE = "landscape";
602
604
 
603
- declare const LIVE = "is-live";
604
-
605
605
  /**
606
606
  * @public
607
607
  * when src is a livestream
@@ -613,7 +613,9 @@ declare const /**
613
613
  * @public
614
614
  * when src is a livestream
615
615
  */
616
- LIVE_2 = "live";
616
+ LIVE = "live";
617
+
618
+ declare const LIVE_2 = "is-live";
617
619
 
618
620
  declare const LIVE_SEEKED = "is-live-seeked";
619
621
 
@@ -913,33 +915,27 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
913
915
 
914
916
  declare type PlayerCustomEventName = keyof PlayerCustomEventsDetailMap;
915
917
 
916
- declare type PlayerCustomEventsDetailMap = {
917
- [MOUNT]: MountEventDetail;
918
- [ERROR]: ErrorEventDetail;
919
- [CONTEXT_MENU]: ContextMenuEventDetail;
920
- /* Excluded from this release type: beforeplay */
921
- /* Excluded from this release type: beforepause */
922
- /* Excluded from this release type: state */
918
+ declare type PlayerCustomEventsDetailMap = PlayerEmittableCustomEventsDetailMap & {
919
+ [REAP]: ReapEventDetail;
920
+ [SOURCE]: SourceEventDetail;
923
921
  [CUEPOINT_START]: CuePointStartEventDetail;
924
922
  [CUEPOINT_END]: CuePointEndEventDetail;
925
- [VIEW_ENTER]: ViewEnterEventDetail;
926
- [VIEW_LEAVE]: ViewLeaveEventDetail;
927
- [SOURCE]: SourceEventDetail;
928
- /* Excluded from this release type: recover */
929
- [REAP]: ReapEventDetail;
930
- /* Excluded from this release type: config */
931
- [QUALITIES]: QualitiesEventDetail;
932
- /* Excluded from this release type: "error:fatal" */
933
- [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
923
+ [MOUNT]: MountEventDetail;
924
+ [LIVE]: LiveEventDetail;
925
+ [DVR]: DvrEventDetail;
926
+ [RETRY]: RetryEventDetail;
927
+ [RECOVER]: RecoverEventDetail;
934
928
  /* Excluded from this release type: audioonlysource */
935
929
  /* Excluded from this release type: renderplugin */
936
- [DVR]: DvrEventDetail;
937
- [LIVE_2]: LiveEventDetail;
938
930
  /* Excluded from this release type: "seek:queued" */
939
931
  /* Excluded from this release type: "seek:cancel" */
940
932
  /* Excluded from this release type: "plugin:registered" */
941
933
  /* Excluded from this release type: intersectionchange */
942
- /* Excluded from this release type: retry */
934
+ /* Excluded from this release type: beforeplay */
935
+ /* Excluded from this release type: beforepause */
936
+ /* Excluded from this release type: state */
937
+ /* Excluded from this release type: config */
938
+ /* Excluded from this release type: "error:fatal" */
943
939
  };
944
940
 
945
941
  declare type PlayerCustomEventsOverloads = {
@@ -978,11 +974,18 @@ declare type PlayerCustomEventsOverloads = {
978
974
  * Sent right before the player src attribute is set. This allows you to change the video URL before playback.
979
975
  */
980
976
  on(event: typeof SOURCE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof SOURCE]>) => void): Player;
981
- /* Excluded from this release type: on */
977
+ /**
978
+ * Emitted when an Error recovery is attempted
979
+ */
980
+ on(event: typeof RECOVER, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RECOVER]>) => void): Player;
982
981
  /**
983
982
  * 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.
984
983
  */
985
984
  on(event: typeof REAP, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof REAP]>) => void): Player;
985
+ /**
986
+ * Emitted when a player will retry to reload
987
+ */
988
+ on(event: typeof RETRY, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof RETRY]>) => void): Player;
986
989
  /* Excluded from this release type: on */
987
990
  /**
988
991
  * Emitted when the set of underlying qualities has changed.
@@ -1002,8 +1005,7 @@ declare type PlayerCustomEventsOverloads = {
1002
1005
  /**
1003
1006
  * when src is a livestream
1004
1007
  */
1005
- on(event: typeof LIVE_2, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof LIVE_2]>) => void): Player;
1006
- /* Excluded from this release type: on */
1008
+ on(event: typeof LIVE, handler: (e: FPEvent<PlayerCustomEventsDetailMap[typeof LIVE]>) => void): Player;
1007
1009
  /* Excluded from this release type: on */
1008
1010
  /* Excluded from this release type: on */
1009
1011
  /* Excluded from this release type: on */
@@ -1032,11 +1034,26 @@ declare type PlayerCustomEventsOverloads = {
1032
1034
  */
1033
1035
  off<T>(event: string, handler: (e: FPEvent<T>) => void): Player;
1034
1036
  /* Excluded from this release type: poll */
1035
- emit<T extends PlayerCustomEventName>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1036
1037
  /* Excluded from this release type: emit */
1037
- emit<T, X extends string = string>(event: X & (X extends PlayerCustomEventName ? "Incorrect event detail type" : X), data?: T): Player;
1038
+ /* Excluded from this release type: emit */
1039
+ emit<T extends PlayerEmittableEventNames>(event: T, data?: PlayerCustomEventsDetailMap[T]): Player;
1040
+ /* Excluded from this release type: emit */
1041
+ };
1042
+
1043
+ declare type PlayerEmittableCustomEventsDetailMap = {
1044
+ [ERROR]: ErrorEventDetail;
1045
+ [CONTEXT_MENU]: ContextMenuEventDetail;
1046
+ [VIEW_ENTER]: ViewEnterEventDetail;
1047
+ [VIEW_LEAVE]: ViewLeaveEventDetail;
1048
+ [QUALITIES]: QualitiesEventDetail;
1049
+ [RECOMMENDATIONS_READY]: RecommendationsReadyEventDetail;
1038
1050
  };
1039
1051
 
1052
+ declare type PlayerEmittableEventNames = keyof PlayerEmittableCustomEventsDetailMap;
1053
+
1054
+ /**
1055
+ * @public
1056
+ */
1040
1057
  declare type PlayerEventOverloads = PlayerNativeEventsOverloads & PlayerCustomEventsOverloads;
1041
1058
 
1042
1059
  declare type PlayerNativeEventName = keyof PlayerNativeEventsDetailMap;
@@ -1230,9 +1247,23 @@ declare type RecommendationsReadyEventDetail = {
1230
1247
  playlist: RecommendationItem[];
1231
1248
  };
1232
1249
 
1233
- /* Excluded from this release type: RECOVER */
1250
+ /**
1251
+ * @public
1252
+ * emitted when an Error recovery is attempted
1253
+ */
1254
+ declare const /**
1255
+ @public
1256
+ * when a new player is inserted into the HTML
1257
+ */ /**
1258
+ * @public
1259
+ * emitted when an Error recovery is attempted
1260
+ */
1261
+ RECOVER = "recover";
1234
1262
 
1235
- /* Excluded from this release type: RecoverEventDetail */
1263
+ /**
1264
+ * @public
1265
+ */
1266
+ declare type RecoverEventDetail = null;
1236
1267
 
1237
1268
  /* Excluded from this release type: REMOTE_SESSION_ENDED */
1238
1269
 
@@ -1256,9 +1287,21 @@ declare const /**
1256
1287
  */
1257
1288
  RESIZE = "resize";
1258
1289
 
1259
- /* Excluded from this release type: RETRY */
1290
+ /**
1291
+ * @public
1292
+ */
1293
+ declare const /**
1294
+ @public
1295
+ * when a new player is inserted into the HTML
1296
+ */ /**
1297
+ * @public
1298
+ */
1299
+ RETRY = "retry";
1260
1300
 
1261
- /* Excluded from this release type: RetryEventDetail */
1301
+ /**
1302
+ * @public
1303
+ */
1304
+ declare type RetryEventDetail = null;
1262
1305
 
1263
1306
  declare const RTL = "is-rtl";
1264
1307
 
@@ -1393,7 +1436,7 @@ declare namespace states {
1393
1436
  RTL,
1394
1437
  TV,
1395
1438
  ENDED,
1396
- LIVE,
1439
+ LIVE_2 as LIVE,
1397
1440
  ERRORED,
1398
1441
  WAITING,
1399
1442
  AUTOPLAY,