@flowplayer/player 3.15.0-rc.9 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/core.js +1 -1
  2. package/default.js +1 -1
  3. package/embed.js +2 -2
  4. package/index.d.ts +16 -10
  5. package/package.json +1 -1
  6. package/plugins/ads.d.ts +19 -13
  7. package/plugins/ads.js +1 -1
  8. package/plugins/airplay.d.ts +19 -13
  9. package/plugins/analytics.d.ts +16 -10
  10. package/plugins/analytics.js +1 -1
  11. package/plugins/asel.d.ts +16 -10
  12. package/plugins/audio.d.ts +16 -10
  13. package/plugins/chapters.d.ts +16 -10
  14. package/plugins/chromecast.d.ts +16 -10
  15. package/plugins/comscore.d.ts +16 -10
  16. package/plugins/consent.d.ts +16 -10
  17. package/plugins/context-menu.d.ts +17 -11
  18. package/plugins/cuepoints.d.ts +17 -11
  19. package/plugins/dash.d.ts +23 -15
  20. package/plugins/drm.d.ts +16 -10
  21. package/plugins/endscreen.d.ts +16 -10
  22. package/plugins/fas.d.ts +16 -10
  23. package/plugins/float-on-scroll.d.ts +16 -10
  24. package/plugins/ga4.d.ts +16 -10
  25. package/plugins/gemius.d.ts +16 -10
  26. package/plugins/google-analytics.d.ts +16 -10
  27. package/plugins/health.d.ts +18 -12
  28. package/plugins/health.js +1 -1
  29. package/plugins/hls.d.ts +19 -13
  30. package/plugins/id3.d.ts +16 -10
  31. package/plugins/iframe.d.ts +16 -10
  32. package/plugins/keyboard.d.ts +16 -10
  33. package/plugins/media-session.d.ts +16 -10
  34. package/plugins/message.d.ts +16 -10
  35. package/plugins/ovp.d.ts +31 -24
  36. package/plugins/ovp.js +1 -1
  37. package/plugins/playlist.d.ts +16 -10
  38. package/plugins/preview.d.ts +16 -10
  39. package/plugins/qsel.d.ts +16 -10
  40. package/plugins/qul.d.ts +16 -10
  41. package/plugins/rts.d.ts +16 -10
  42. package/plugins/share.d.ts +16 -10
  43. package/plugins/speed.d.ts +16 -10
  44. package/plugins/ssai.d.ts +16 -10
  45. package/plugins/ssai.js +1 -1
  46. package/plugins/subtitles.d.ts +19 -13
  47. package/plugins/thumbnails.d.ts +16 -10
  48. package/plugins/tizen.d.ts +16 -10
  49. package/plugins/vtsel.d.ts +16 -10
  50. package/plugins/webos.d.ts +16 -10
  51. package/util/loader.d.ts +18 -12
package/plugins/ovp.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=t.flowplayer||{},t.flowplayer.ovp=e())}(this,(function(){"use strict";function t(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}const e=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),n=(...t)=>t.reduce((t,o)=>e(o)?(Object.keys(o).forEach(r=>{if(e(t[r])&&e(o[r]))return t[r]=n(t[r],o[r]);t[r]=o[r]}),t):t,{});class Pipe{constructor(t){this.data=t}static of(t){return new Pipe(t)}static maybe(t,e,...n){return null==t?t:e.apply(t,[t,...n])}tap(t,...e){return t.apply(this,[this.data,...e]),new Pipe(this.data)}fmap(t,...e){const n=t.apply(this,[this.data,...e]);return new Pipe(n)}unwrap(){return this.data}}const o="https://ljsp.lwcdn.com".concat("/web/public/countdown/time.json"),r=window,i=r._flowplayerTimekeeper||(r._flowplayerTimekeeper={});function s(t){return fetch(t).then(t=>t.json())}function a(){let t=[].join.call(arguments,"/");return"/"!==t[0]&&(t="/"+t),c()+"/web/public/native/config"+t}const c=()=>"https://ljsp.lwcdn.com";function l(t){(async function(){const t=i.cachedServerOffset;if(t)return t;const e=i.pendingRequest||(i.pendingRequest=fetch(o)),n=await e,r=parseInt(n.headers.get("age")||"0"),s=await n.json(),a=Date.now()-s.millisUtc-1e3*r;return i.cachedServerOffset=a,i.cachedServerOffset})().then(e=>Object.assign(t,{server_time_offset:e}))}function d(t){return~t.indexOf("/")?t:"/media/"+t}var u={404:"media not found",402:"invalid subscription",400:"bad request",415:"unsupported media type"};function p(t,e){var o,r;e="object"==typeof e?e:{};const i={title:null===(o=null==t?void 0:t.metadata)||void 0===o?void 0:o.title,description:null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.description},s={ima:{parameters:function({media_id:t,duration:e,title:n,tags:o,category_name:r,ad_keywords:i}){return{ad_keywords:i||"",media_id:t||"",category:r||"",media_name:n||"",media_tags:o||"",media_duration:e||-1}}((null==t?void 0:t.metadata)||{})}},a=e.embed||{};return delete a.src,n(s,i,t,(delete(c=e).src,delete c.metadata,delete c.title,delete c.description,delete c.duration,delete c.poster,c),a);var c}const m=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,f=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,v=/^[A-Za-z0-9]{8}$/,y=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[A-Za-z0-9]{8}$/;function h(t){return"object"==typeof t&&"ovp/base64"==t.type}function w(t,e){return function(t,e){return!(!m.test(t)&&!f.test(t))&&(e.type="video/ovp",!0)}(t,e)||function(t,e){return!/[aeiou]/.test(t.toLowerCase())&&(!(!v.test(t)&&!y.test(t))&&(e&&(e.type="video/ovp"),!0))}(t,e)||h(e)}function g(t){try{return function(t){return null===t?{}:JSON.parse(t)}(decodeURIComponent(atob(t).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return{err:t.message}}}function _(t){const e=t.split(/[^0-9]/).map(t=>parseInt(t,10));return Date.UTC(e[0],e[1]-1,e[2],e[3],e[4],e[5])}function b(t){return t.live}var E=Object.freeze({__proto__:null,OVP_ERROR:"ovp:error",OVP_MEDIA_REQUEST_START:"ovp:request:start",OVP_MEDIA_REQUEST_COMPLETE:"ovp:request:media:complete",OVP_PLAYLIST_REQUEST_COMPLETE:"ovp:request:playlist:complete",LIVE_COUNTDOWN_TICK:"ovp:live:countdown:tick",LIVE_COUNTDOWN_START:"ovp:live:countdown:start",LIVE_COUNTDOWN_COMPLETE:"ovp:live:countdown:complete",OVP_MEDIA_CHANGED:"ovp:media:changed",OVP_REALTIME_MESSAGE:"ovp:message:realtime",OVP_CONFIG_FINALIZED:"ovp:config:finalized"});function O(t,e){const n=null==e?void 0:e.src;if(h(e))return function(t,e){const n=g(e.src||"");if(function(t){return"string"==typeof t.err}(n))return console.error(n.err);j(t,n)}(t,e);n&&(t.setState("is-source-processing",!0),Pipe.of(n).fmap(d).fmap(a).fmap(t=>fetch(t)).fmap(e=>e.then(t=>Promise.all([t.status,t.json()])).then(([e,n])=>{return 200==e?j(t,n):(r=n,(o=t).setState("is-source-processing",!1),r.message?o.emit("ovp:error",r):r.status?o.emit("ovp:error",new Error(u[r.status])):o.emit("ovp:error",r));var o,r})))}function j(t,e){return t.emit("ovp:media:changed",e),function(t){return Array.isArray(t.playlist)}(e)?function(t,e){t.emit("ovp:request:playlist:complete",function(t,e){const o=Object.assign({},t),r=(null==t?void 0:t.playlist)||{},i=n(e,r),s=((null==i?void 0:i.playlist)||[]).map(t=>{e.ima&&Object.assign(t,{ima:e.ima});const n=p(t,o);return delete n.playlist,n});return delete i.ima,Object.assign(i,{playlist:s})}(t.opts,e))}(t,e):b(e)?function(t,e){var n,o;const r=(null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.live_start_time)||(null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.starttime);r&&(e.live_start_time=Pipe.of(r).fmap(_).unwrap());t.emit("ovp:live:countdown:start",Pipe.of(e).fmap(p,t.opts).unwrap())}(t,e):function(t,e){t.emit("ovp:request:media:complete",Pipe.of(e).fmap(p,t.opts).unwrap())}(t,e)}const A={};function P(t,e,n){"object"!=typeof A[e]&&(A[e]=n);const o=t.opts,r=(null==o?void 0:o.metadata)||{};r.player_id=e,o.metadata=r,n.title&&delete n.title,n.description&&delete n.description;const i=Object.assign(o,n);t.setOpts(i),n.autoplay&&t.togglePlay(!0)}let S=!1;function L(t,e,n){T()||Pipe.of("recommendation").fmap(a,e,n).fmap(s).fmap(e=>e.then(e=>function(t,e){const n=e.playlist;if(t.opts.recommendations=n,!n.length)return;t.emit("recommendationsready",{playlist:n.map((function(t){var e,n;return{poster:t.poster,src:t.src,title:null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.title,description:null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.description,metadata:t.metadata||{},chapters:t.chapters,thumbnails:t.thumbnails,subtitles:t.subtitles}}))})}(t,e)).catch(C))}function T(){return S}function C(t){S=!0,console.error("Failed to load recommendations: %j",t)}function x(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}function I(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}const M="flowplayer-live-countdown";function k(t){const e=Date.now()-(t.server_time_offset||0);return Math.floor(((t.live_start_time||0)-e)/1e3)}function D(t,e){let n=0;function o(){const o=k(e);if(o<0||isNaN(o)||0===t.reaper||void 0===e.live_start_time)return clearInterval(n),function(t,e,n){t.emit("ovp:live:countdown:complete");const o=I(t,M);if(o&&o.remove(),t.root.classList.remove("is-livecountdown"),n)return t.setState("is-source-processing",!1);t.emit("ovp:request:media:complete",e)}(t,e,void 0===e.live_start_time);var r,i,s;r=t,i=t.root,s=o,i.classList.add("is-livecountdown"),r.emit("ovp:live:countdown:tick",{remaining_time:q(s+1)}),r.hasState("is-starting")||r.setState("is-starting",!0)}l(e),o(),n=setInterval(o,250)}function q(t){const e=function(t){"number"!=typeof t&&(t=parseInt(t,10)),t=Math.round(t);const e=Math.floor(t/86400);t-=86400*e;const n=Math.floor(t/3600);t-=3600*n;const o=Math.floor(t/60);return{days:e,hours:n,minutes:o,seconds:t-=60*o}}(t);let n="";return e.days&&(n+=e.days+":"),n+x(e.hours)+":"+x(e.minutes)+":"+x(e.seconds)}class WebsocketBridge{constructor(t){this.manualDisconnect=!1,this.video=t,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}static of(t){return new WebsocketBridge(t)}connect(t){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+t),this.current_media_id=t,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(t){JSON.parse(t.data).forEach(t=>{this.video.emit("ovp:message:realtime",t)})}reconnect(t){this.cleanup(),this.connect(t)}wireup(){this.client&&(this.client.addEventListener("message",this.onMessage),this.client.addEventListener("close",this.onClose))}cleanup(){this.client&&(this.client.removeEventListener("message",this.onMessage),this.client.removeEventListener("close",this.onClose),this.client=void 0)}disconnect(){this.client&&(this.manualDisconnect=!0,this.client.close())}}const N=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const o=window.customElements.get(e);if(!o)throw new Error(`no default flowplayer component with the name ${e} exists`);const r=window.customElements.get(n);return"function"!=typeof r?o:r})(t._customElements,e))(t);class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}class FlowplayerLiveCountdown extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-livecountdown");const e=function(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}("fp-inner");this.append(e);const n=document.createElement("p");n.innerText=t.i18n("ovp.starting_in"),e.append(n);const o=document.createElement("p");o.classList.add("fp-countdown"),e.append(o),t.on("ovp:live:countdown:tick",e=>{const n=e.detail.remaining_time;t.root.classList.add("is-livecountdown"),o.innerText=n})}}const R=["*.lwcdn.com","*.flowplayer.com","*.wowza.com"];function V(){try{return window.location.hostname!==window.parent.location.hostname?function(t){const e=document.createElement("a");return e.href=t,e}(document.referrer).hostname:document.location.hostname}catch(t){return window.location.hostname}}function U(t){const e=document.createElement("a");e.href=t;const n=e.pathname&&e.pathname.split(".");return n.length>1&&n[n.length-1]}function W(t){switch(t){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return t}}const $=e=>{var{src:n}=e,o=t(e,["src"]);return[Object.assign({src:n,type:n?W("video/"+U(n)):""},o)]};function F(t){return $({src:t})}function z(e){var{src:n,type:o}=e,r=t(e,["src","type"]);return n&&o?[Object.assign({src:n,type:o},r)]:o&&!n?[Object.assign({type:o},r)]:$(Object.assign({src:n},r))}var H,B;!function(t){t[t.Err=0]="Err",t[t.Ok=1]="Ok"}(H||(H={}));const G=((B=class OVP{constructor(t){((t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)})(t,M,FlowplayerLiveCountdown)}onload(t,e,n,o){if("string"==typeof o.src)return"string"!=typeof t.player_id||0===o.src.indexOf(t.player_id)||h(o)||(o.src=[t.player_id,o.src].join("/")),O(n,o)}wants(t,e,n){return w(t,e)}init(e,o,r){const i=new WebsocketBridge(r);let c=Object.assign({},e);const l=function(t){if(!c)return t;e.autoplay!==c.autoplay&&(c.autoplay=e.autoplay),delete c.src;const o=n(t,c);return r.emit("ovp:config:finalized",o),o};r.on("src",()=>{(r.currentSrc||r.root.classList.contains("is-livecountdown"))&&(c=!1)}),r.on("ovp:error",(function(t){r.emit("error",t.data)})),r.on("ovp:request:start",(function(){r.setState("is-waiting",!0),e.recommendations&&(e.recommendations=!1)})),r.on("ovp:media:changed",(function({data:t}){var e;const n=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id;(null==t?void 0:t.live)&&n&&(i.disconnect(),i.connect(n))})),r.on("ovp:message:realtime",(function({data:t}){var n;const o=null==t?void 0:t.event,i=null==t?void 0:t.value,s=r.opt("metadata",{live_start_time:""});switch(o){case"METADATA":{const t=Object.assign(s,i),o=Object.assign(e,{metadata:t});o.live&&(null===(n=null==o?void 0:o.metadata)||void 0===n?void 0:n.live_start_time)&&(o.live_start_time=_(o.metadata.live_start_time)),r.setOpts(o);break}}})),r.on("beforeplay",(function(t){const n=e;if(b(n)){if(Q(n))return;t.preventDefault()}})),r.on("ovp:request:media:complete",(function(t){const e=t.data;if(!e)return;var n;if(e.src&&(e.src=(n=e.src,"string"==typeof n?F(n):Array.isArray(n)||"object"!=typeof n?n.reduce((function(t,e){return"string"==typeof e&&(e=F(e)),"object"!=typeof e||Array.isArray(e)||(e=z(e)),t.concat(e)}),[]):z(n)).map(t=>(t.src&&t.src.startsWith("//")&&(t.src="https:"+t.src),t))),0==r.reaper||"object"!=typeof e||k(e)>0)return;const o=l(e);r.setOpts(o),r.setAttrs(o),o.src&&r.setSrc(o.src),r.setState("is-source-processing",!1)})),r.on("config",(function({data:t}){var n,i;if("string"==typeof e.src&&w(e.src,{}))return;if((null==t?void 0:t.domains)&&(null==t?void 0:t.domains.length)&&!((t,e)=>{const n=t.split(".").reverse();return e.concat(R).some(t=>{const e=t.split(".").reverse(),o="*"===e[e.length-1];return o&&e.pop(),(o||e.length===n.length)&&e.every((t,e)=>n[e]===t)})})(V(),t.domains))return function({root:t,video:e,data:n}){e&&e.destroy(),console.error(new Error(n.details||n.reason)),t.innerHTML="",t.classList.remove("flowplayer"),t.classList.add("flowplayer-fatal"),t.style.removeProperty("background-image");const o=document.createElement("h2");o.textContent="Playback Error";const r=document.createElement("p");r.textContent="Are you the site owner?";const i=document.createElement("a");i.classList.add("troubleshoot"),i.target="_blank",i.href="https://docs.flowplayer.com/troubleshooting/player#"+n.reason,i.textContent="Troubleshoot?";const s=document.createElement("img");s.src="https://flowplayer.com/user/pages/images/logo-white.png",t.append(o,r,i,s)}({root:o,video:r,data:{details:`Hostname ${V()} is not allowed to load player ${null===(n=t.metadata)||void 0===n?void 0:n.player_id}.`,reason:"domain"}});if(e.src&&Z(e.src))return;const c=null==t?void 0:t.brand_color;return c&&r.root.style.setProperty("--fp-brand-color","#"==c[0]?c:"#"+c),"string"==typeof e.player_id&&(null===(i=null==e?void 0:e.metadata)||void 0===i?void 0:i.player_id)!==e.player_id?function(t,e){if("object"==typeof A[e])return console.debug("using Cache(%s)",e),P(t,e,A[e]);Pipe.of(e).fmap(a).fmap(s).fmap(n=>n.then(n=>P(t,e,n)).catch(console.error))}(r,e.player_id):void 0})),r.on("ovp:request:playlist:complete",(function(e){const n=e.data;if(!n||0==r.reaper)return;const{playlist:o}=n,i=t(n,["playlist"]),s=l(i);Array.isArray(s.playlist)&&(s.playlist=i),r.setOpts(s),r.setAttrs(s);const a={type:"flowplayer/playlist",items:o};r.setSrc(a),r.setState("is-source-processing",!1)})),r.on("ovp:live:countdown:start",(function(t){const n=t.data;if(!n||0==r.reaper)return;const i=l(n);if(r.setOpts(i),r.setAttrs(i),k(n)<=0)return r.emit("ovp:request:media:complete",n);I(r,M)||(o.appendChild(N(r,M)),D(r,e))})),r.on("timeupdate",(function(){var t,n,o;const i=e;b(i)?Q(i)||(r.togglePlay(!1),r.emit("ended")):e.recommendations&&(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.media_id)&&(Array.isArray(e.recommendations)||r.currentTime/r.duration<.8||T()||(null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.media_id)&&(null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.player_id)&&L(r,e.metadata.media_id,e.metadata.player_id))})),r.on("reap",(function(){i.disconnect()}))}}).events=E,B);function Q(t){var e,n;const o=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.live_stop_time;if(!o)return!0;return!!(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.allow_after_stop_time)||_(o)>Date.now()}const Z=t=>{var e;if(t&&Array.isArray(t))return"object"==typeof t[0]&&"ovp/base64"===(null===(e=t[0])||void 0===e?void 0:e.type)};return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;return"function"==typeof n?(n(e),e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e),e)}(window,G)}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=t.flowplayer||{},t.flowplayer.ovp=e())}(this,(function(){"use strict";function t(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}const e=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),n=(...t)=>t.reduce((t,o)=>e(o)?(Object.keys(o).forEach(r=>{if(e(t[r])&&e(o[r]))return t[r]=n(t[r],o[r]);t[r]=o[r]}),t):t,{});class Pipe{constructor(t){this.data=t}static of(t){return new Pipe(t)}static maybe(t,e,...n){return null==t?t:e.apply(t,[t,...n])}tap(t,...e){return t.apply(this,[this.data,...e]),new Pipe(this.data)}fmap(t,...e){const n=t.apply(this,[this.data,...e]);return new Pipe(n)}unwrap(){return this.data}}const o="https://ljsp.lwcdn.com".concat("/web/public/countdown/time.json"),r=window,i=r._flowplayerTimekeeper||(r._flowplayerTimekeeper={});function s(t){return fetch(t).then(t=>t.json())}function a(){let t=[].join.call(arguments,"/");return"/"!==t[0]&&(t="/"+t),c()+"/web/public/native/config"+t}const c=()=>"https://ljsp.lwcdn.com";function l(t){(async function(){const t=i.cachedServerOffset;if(t)return t;const e=i.pendingRequest||(i.pendingRequest=fetch(o)),n=await e,r=parseInt(n.headers.get("age")||"0"),s=await n.json(),a=Date.now()-s.millisUtc-1e3*r;return i.cachedServerOffset=a,i.cachedServerOffset})().then(e=>Object.assign(t,{server_time_offset:e}))}function d(t){return~t.indexOf("/")?t:"/media/"+t}var u={404:"media not found",402:"invalid subscription",400:"bad request",415:"unsupported media type"};function p(t,e){var o,r;e="object"==typeof e?e:{};const i={title:null===(o=null==t?void 0:t.metadata)||void 0===o?void 0:o.title,description:null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.description},s={ima:{parameters:function({media_id:t,duration:e,title:n,tags:o,category_name:r,ad_keywords:i}){return{ad_keywords:i||"",media_id:t||"",category:r||"",media_name:n||"",media_tags:o||"",media_duration:e||-1}}((null==t?void 0:t.metadata)||{})}},a=e.embed||{};return delete a.src,n(s,i,t,(delete(c=e).src,delete c.metadata,delete c.title,delete c.description,delete c.duration,delete c.poster,c),a);var c}const m=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,f=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,v=/^[A-Za-z0-9]{8}$/,y=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[A-Za-z0-9]{8}$/;function h(t){return"object"==typeof t&&"ovp/base64"==t.type}function w(t,e){return function(t,e){return!(!m.test(t)&&!f.test(t))&&(e.type="video/ovp",!0)}(t,e)||function(t,e){return!/[aeiou]/.test(t.toLowerCase())&&(!(!v.test(t)&&!y.test(t))&&(e&&(e.type="video/ovp"),!0))}(t,e)||h(e)}function g(t){try{return function(t){return null===t?{}:JSON.parse(t)}(decodeURIComponent(atob(t).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return{err:t.message}}}function _(t){const e=t.split(/[^0-9]/).map(t=>parseInt(t,10));return Date.UTC(e[0],e[1]-1,e[2],e[3],e[4],e[5])}function b(t){return t.live}var E=Object.freeze({__proto__:null,OVP_ERROR:"ovp:error",OVP_MEDIA_REQUEST_START:"ovp:request:start",OVP_MEDIA_REQUEST_COMPLETE:"ovp:request:media:complete",OVP_PLAYLIST_REQUEST_COMPLETE:"ovp:request:playlist:complete",LIVE_COUNTDOWN_TICK:"ovp:live:countdown:tick",LIVE_COUNTDOWN_START:"ovp:live:countdown:start",LIVE_COUNTDOWN_COMPLETE:"ovp:live:countdown:complete",OVP_MEDIA_CHANGED:"ovp:media:changed",OVP_REALTIME_MESSAGE:"ovp:message:realtime",OVP_CONFIG_FINALIZED:"ovp:config:finalized"});function O(t,e){const n=null==e?void 0:e.src;if(h(e))return function(t,e){const n=g(e.src||"");if(function(t){return"string"==typeof t.err}(n))return console.error(n.err);j(t,n)}(t,e);n&&(t.setState("is-source-processing",!0),Pipe.of(n).fmap(d).fmap(a).fmap(t=>fetch(t)).fmap(e=>e.then(t=>Promise.all([t.status,t.json()])).then(([e,n])=>{return 200==e?j(t,n):(r=n,(o=t).setState("is-source-processing",!1),r.message?o.emit("ovp:error",r):r.status?o.emit("ovp:error",new Error(u[r.status])):o.emit("ovp:error",r));var o,r})))}function j(t,e){return t.emit("ovp:media:changed",e),function(t){return Array.isArray(t.playlist)}(e)?function(t,e){t.emit("ovp:request:playlist:complete",function(t,e){const o=Object.assign({},t),r=(null==t?void 0:t.playlist)||{},i=n(e,r),s=((null==i?void 0:i.playlist)||[]).map(t=>{e.ima&&Object.assign(t,{ima:e.ima});const n=p(t,o);return delete n.playlist,n});return delete i.ima,Object.assign(i,{playlist:s})}(t.opts,e))}(t,e):b(e)?function(t,e){var n,o;const r=(null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.live_start_time)||(null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.starttime);r&&(e.live_start_time=Pipe.of(r).fmap(_).unwrap());t.emit("ovp:live:countdown:start",Pipe.of(e).fmap(p,t.opts).unwrap())}(t,e):function(t,e){t.emit("ovp:request:media:complete",Pipe.of(e).fmap(p,t.opts).unwrap())}(t,e)}const A={};function P(t,e,n){"object"!=typeof A[e]&&(A[e]=n);const o=t.opts,r=(null==o?void 0:o.metadata)||{};r.player_id=e,o.metadata=r,n.title&&delete n.title,n.description&&delete n.description;const i=Object.assign(o,n);t.setOpts(i),n.autoplay&&t.togglePlay(!0)}let S=!1;function L(t,e,n){T()||Pipe.of("recommendation").fmap(a,e,n).fmap(s).fmap(e=>e.then(e=>function(t,e){const n=e.playlist;if(t.opts.recommendations=n,!n.length)return;t.emit("recommendationsready",{playlist:n.map((function(t){var e,n;return{poster:t.poster,src:t.src,title:null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.title,description:null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.description,metadata:t.metadata||{},chapters:t.chapters,thumbnails:t.thumbnails,subtitles:t.subtitles}}))})}(t,e)).catch(C))}function T(){return S}function C(t){S=!0,console.error("Failed to load recommendations: %j",t)}function x(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}function I(t,e){const n=t._customElements.get(e);return n&&t.root.querySelector(n)||void 0}const M="flowplayer-live-countdown";function k(t){const e=Date.now()-(t.server_time_offset||0);return Math.floor(((t.live_start_time||0)-e)/1e3)}function D(t,e){let n=0;function o(){const o=k(e);if(o<0||isNaN(o)||0===t.reaper||void 0===e.live_start_time)return clearInterval(n),function(t,e,n){t.emit("ovp:live:countdown:complete");const o=I(t,M);if(o&&o.remove(),t.root.classList.remove("is-livecountdown"),n)return t.setState("is-source-processing",!1);t.emit("ovp:request:media:complete",e)}(t,e,void 0===e.live_start_time);var r,i,s;r=t,i=t.root,s=o,i.classList.add("is-livecountdown"),r.emit("ovp:live:countdown:tick",{remaining_time:q(s+1)}),r.hasState("is-starting")||r.setState("is-starting",!0)}l(e),o(),n=setInterval(o,250)}function q(t){const e=function(t){"number"!=typeof t&&(t=parseInt(t,10)),t=Math.round(t);const e=Math.floor(t/86400);t-=86400*e;const n=Math.floor(t/3600);t-=3600*n;const o=Math.floor(t/60);return{days:e,hours:n,minutes:o,seconds:t-=60*o}}(t);let n="";return e.days&&(n+=e.days+":"),n+x(e.hours)+":"+x(e.minutes)+":"+x(e.seconds)}class WebsocketBridge{constructor(t){this.manualDisconnect=!1,this.video=t,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}static of(t){return new WebsocketBridge(t)}connect(t){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+t),this.current_media_id=t,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(t){JSON.parse(t.data).forEach(t=>{this.video.emit("ovp:message:realtime",t)})}reconnect(t){this.cleanup(),this.connect(t)}wireup(){this.client&&(this.client.addEventListener("message",this.onMessage),this.client.addEventListener("close",this.onClose))}cleanup(){this.client&&(this.client.removeEventListener("message",this.onMessage),this.client.removeEventListener("close",this.onClose),this.client=void 0)}disconnect(){this.client&&(this.manualDisconnect=!0,this.client.close())}}const N=(t,e)=>new(((t,e)=>{const n=t.get(e);if(!n)throw new Error(`no flowplayer component with the name ${e} exists`);const o=window.customElements.get(e);if(!o)throw new Error(`no default flowplayer component with the name ${e} exists`);const r=window.customElements.get(n);return"function"!=typeof r?o:r})(t._customElements,e))(t);class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}class FlowplayerLiveCountdown extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-livecountdown");const e=function(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}("fp-inner");this.append(e);const n=document.createElement("p");n.innerText=t.i18n("ovp.starting_in"),e.append(n);const o=document.createElement("p");o.classList.add("fp-countdown"),e.append(o),t.on("ovp:live:countdown:tick",e=>{const n=e.detail.remaining_time;t.root.classList.add("is-livecountdown"),o.innerText=n})}}const R=["*.lwcdn.com","*.flowplayer.com","*.wowza.com"];function V(){try{return window.location.hostname!==window.parent.location.hostname?function(t){const e=document.createElement("a");return e.href=t,e}(document.referrer).hostname:document.location.hostname}catch(t){return window.location.hostname}}function U(t){const e=document.createElement("a");e.href=t;const n=e.pathname&&e.pathname.split(".");return n.length>1&&n[n.length-1]}function W(t){switch(t){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return t}}const $=e=>{var{src:n}=e,o=t(e,["src"]);return[Object.assign({src:n,type:n?W("video/"+U(n)):""},o)]};function F(t){return $({src:t})}function z(e){var{src:n,type:o}=e,r=t(e,["src","type"]);return n&&o?[Object.assign({src:n,type:o},r)]:o&&!n?[Object.assign({type:o},r)]:$(Object.assign({src:n},r))}var H,B;!function(t){t[t.Err=0]="Err",t[t.Ok=1]="Ok"}(H||(H={}));const G=((B=class OVP{constructor(t){((t,e,n)=>{window.customElements.get(e)||window.customElements.define(e,n),t.customElements.get(e)||t.customElements.set(e,e)})(t,M,FlowplayerLiveCountdown)}onload(t,e,n,o){if("string"==typeof(null==o?void 0:o.src))return"string"!=typeof t.player_id||0===o.src.indexOf(t.player_id)||h(o)||(o.src=[t.player_id,o.src].join("/")),O(n,o)}wants(t,e,n){return w(t,e)}init(e,o,r){const i=new WebsocketBridge(r);let c=Object.assign({},e);const l=function(t){if(!c)return t;e.autoplay!==c.autoplay&&(c.autoplay=e.autoplay),delete c.src;const o=n(t,c);return r.emit("ovp:config:finalized",o),o};r.on("src",()=>{(r.currentSrc||r.root.classList.contains("is-livecountdown"))&&(c=!1)}),r.on("ovp:error",(function(t){r.emit("error",t.data)})),r.on("ovp:request:start",(function(){r.setState("is-waiting",!0),e.recommendations&&(e.recommendations=!1)})),r.on("ovp:media:changed",(function({data:t}){var e;const n=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id;(null==t?void 0:t.live)&&n&&(i.disconnect(),i.connect(n))})),r.on("ovp:message:realtime",(function({data:t}){var n;const o=null==t?void 0:t.event,i=null==t?void 0:t.value,s=r.opt("metadata",{live_start_time:""});switch(o){case"METADATA":{const t=Object.assign(s,i),o=Object.assign(e,{metadata:t});o.live&&(null===(n=null==o?void 0:o.metadata)||void 0===n?void 0:n.live_start_time)&&(o.live_start_time=_(o.metadata.live_start_time)),r.setOpts(o);break}}})),r.on("beforeplay",(function(t){const n=e;if(b(n)){if(Q(n))return;t.preventDefault()}})),r.on("ovp:request:media:complete",(function(t){const e=t.data;if(!e)return;var n;if(e.src&&(e.src=(n=e.src,"string"==typeof n?F(n):Array.isArray(n)||"object"!=typeof n?n.reduce((function(t,e){return"string"==typeof e&&(e=F(e)),"object"!=typeof e||Array.isArray(e)||(e=z(e)),t.concat(e)}),[]):z(n)).map(t=>(t.src&&t.src.startsWith("//")&&(t.src="https:"+t.src),t))),0==r.reaper||"object"!=typeof e||k(e)>0)return;const o=l(e);r.setOpts(o),r.setAttrs(o),o.src&&r.setSrc(o.src),r.setState("is-source-processing",!1)})),r.on("config",(function({data:t}){var n,i;if("string"==typeof e.src&&w(e.src,{}))return;if((null==t?void 0:t.domains)&&(null==t?void 0:t.domains.length)&&!((t,e)=>{const n=t.split(".").reverse();return e.concat(R).some(t=>{const e=t.split(".").reverse(),o="*"===e[e.length-1];return o&&e.pop(),(o||e.length===n.length)&&e.every((t,e)=>n[e]===t)})})(V(),t.domains))return function({root:t,video:e,data:n}){e&&e.destroy(),console.error(new Error(n.details||n.reason)),t.innerHTML="",t.classList.remove("flowplayer"),t.classList.add("flowplayer-fatal"),t.style.removeProperty("background-image");const o=document.createElement("h2");o.textContent="Playback Error";const r=document.createElement("p");r.textContent="Are you the site owner?";const i=document.createElement("a");i.classList.add("troubleshoot"),i.target="_blank",i.href="https://docs.flowplayer.com/troubleshooting/player#"+n.reason,i.textContent="Troubleshoot?";const s=document.createElement("img");s.src="https://flowplayer.com/user/pages/images/logo-white.png",t.append(o,r,i,s)}({root:o,video:r,data:{details:`Hostname ${V()} is not allowed to load player ${null===(n=t.metadata)||void 0===n?void 0:n.player_id}.`,reason:"domain"}});if(e.src&&Z(e.src))return;const c=null==t?void 0:t.brand_color;return c&&r.root.style.setProperty("--fp-brand-color","#"==c[0]?c:"#"+c),"string"==typeof e.player_id&&(null===(i=null==e?void 0:e.metadata)||void 0===i?void 0:i.player_id)!==e.player_id?function(t,e){if("object"==typeof A[e])return console.debug("using Cache(%s)",e),P(t,e,A[e]);Pipe.of(e).fmap(a).fmap(s).fmap(n=>n.then(n=>P(t,e,n)).catch(console.error))}(r,e.player_id):void 0})),r.on("ovp:request:playlist:complete",(function(e){const n=e.data;if(!n||0==r.reaper)return;const{playlist:o}=n,i=t(n,["playlist"]),s=l(i);Array.isArray(s.playlist)&&(s.playlist=i),r.setOpts(s),r.setAttrs(s);const a={type:"flowplayer/playlist",items:o};r.setSrc(a),r.setState("is-source-processing",!1)})),r.on("ovp:live:countdown:start",(function(t){const n=t.data;if(!n||0==r.reaper)return;const i=l(n);if(r.setOpts(i),r.setAttrs(i),k(n)<=0)return r.emit("ovp:request:media:complete",n);I(r,M)||(o.appendChild(N(r,M)),D(r,e))})),r.on("timeupdate",(function(){var t,n,o;const i=e;b(i)?Q(i)||(r.togglePlay(!1),r.emit("ended")):e.recommendations&&(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.media_id)&&(Array.isArray(e.recommendations)||r.currentTime/r.duration<.8||T()||(null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.media_id)&&(null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.player_id)&&L(r,e.metadata.media_id,e.metadata.player_id))})),r.on("reap",(function(){i.disconnect()}))}}).events=E,B);function Q(t){var e,n;const o=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.live_stop_time;if(!o)return!0;return!!(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.allow_after_stop_time)||_(o)>Date.now()}const Z=t=>{var e;if(t&&Array.isArray(t))return"object"==typeof t[0]&&"ovp/base64"===(null===(e=t[0])||void 0===e?void 0:e.type)};return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const n=t.flowplayer;return"function"==typeof n?(n(e),e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e),e)}(window,G)}));
@@ -315,6 +315,8 @@ declare const /**
315
315
  */
316
316
  ENDED_2 = "ended";
317
317
 
318
+ declare type EnsureOnAttached<P extends Function, T extends Player> = ExtractPureAPI<T> extends _AttachedEventCheck ? P : "Loaders must implement on('<pluginname>:attached') event";
319
+
318
320
  /**
319
321
  * @public
320
322
  */
@@ -397,6 +399,8 @@ declare namespace events {
397
399
  }
398
400
  }
399
401
 
402
+ declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
403
+
400
404
  /**
401
405
  * @public
402
406
  */
@@ -474,19 +478,19 @@ declare interface FlowplayerUMDBase {
474
478
  /**
475
479
  * @public
476
480
  */
477
- declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayerAPIExtension extends Player = Player> extends FlowplayerUMDBase {
481
+ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayer extends Player = Player> extends FlowplayerUMDBase {
478
482
  /**
479
483
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
480
484
  * @param selector - query selector of the HTML element where player will render
481
485
  * @param config - Configuration of the flowplayer and the attached plugins
482
486
  */
483
- (selector: string, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
487
+ (selector: string, config?: ConfigWithPlugins): PluginPlayer;
484
488
  /**
485
489
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
486
490
  * @param element - HTML element where player will render
487
491
  * @param config - Configuration of the flowplayer and the attached plugins
488
492
  */
489
- (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
493
+ (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayer;
490
494
  }
491
495
 
492
496
  /**
@@ -638,10 +642,11 @@ declare const LOADED = "is-loaded";
638
642
 
639
643
  /**
640
644
  * @public A plugin that supports loading new media formats. Use 'class MyPlugin implements Loader\<...\>' when writing your custom Loader
641
- * @typeParam PluginPlayerAPIExtension - additional Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
645
+ * @typeParam PluginPlayer- Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
642
646
  */
643
- declare interface Loader<PluginOwnConfig extends KeyValue, PluginPlayerAPIExtension extends _AttachedEventCheck> extends Plugin_2<PluginOwnConfig, PlayerWith<PluginPlayerAPIExtension>> {
644
- onload(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayerAPIExtension>, src?: SourceObj): void;
647
+ declare interface Loader<PluginOwnConfig extends KeyValue, // FIXME extends Config
648
+ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwnConfig, PluginPlayer> {
649
+ onload: EnsureOnAttached<(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayer>, src: SourceObj) => void, PluginPlayer>;
645
650
  wants<S = SourceObj>(srcString: SourceStr, srcObj: S, config: ConfigWith<PluginOwnConfig>): boolean;
646
651
  wants<S = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: ConfigWith<PluginOwnConfig>): boolean;
647
652
  }
@@ -1038,6 +1043,7 @@ declare type PlayerNativeEventsOverloads = {
1038
1043
 
1039
1044
  /**
1040
1045
  * @public
1046
+ * The root element of the video player. This is the immediate parent element of the video tag.
1041
1047
  */
1042
1048
  declare type PlayerRoot = HTMLElement & {
1043
1049
  /* Excluded from this release type: prevWidth */
@@ -1079,11 +1085,11 @@ export default Playlist;
1079
1085
  /**
1080
1086
  * @public
1081
1087
  */
1082
- declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1088
+ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1083
1089
  /**
1084
1090
  * a plugin must always implement the init method so a player instance knows how to initialize it
1085
1091
  */
1086
- init(config: PluginConfig, container: PlayerRoot, player: PluginPlayerAPI): void;
1092
+ init(config: PluginConfig, container: PlayerRoot, player: PluginPlayer): void;
1087
1093
  }
1088
1094
 
1089
1095
  /* Excluded from this release type: PLUGIN_REGISTERED */
@@ -1091,8 +1097,8 @@ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI
1091
1097
  /**
1092
1098
  * @public
1093
1099
  */
1094
- declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1095
- new (umd: FlowplayerUMD, player: PluginPlayerAPI): Plugin_2<PluginConfig, PluginPlayerAPI>;
1100
+ declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1101
+ new (umd: FlowplayerUMD, player: PluginPlayer): Plugin_2<PluginConfig, PluginPlayer>;
1096
1102
  }
1097
1103
 
1098
1104
  /* Excluded from this release type: PluginRegisteredEventDetail */
@@ -315,6 +315,8 @@ declare const /**
315
315
  */
316
316
  ENDED_2 = "ended";
317
317
 
318
+ declare type EnsureOnAttached<P extends Function, T extends Player> = ExtractPureAPI<T> extends _AttachedEventCheck ? P : "Loaders must implement on('<pluginname>:attached') event";
319
+
318
320
  /**
319
321
  * @public
320
322
  */
@@ -397,6 +399,8 @@ declare namespace events {
397
399
  }
398
400
  }
399
401
 
402
+ declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
403
+
400
404
  /**
401
405
  * @public
402
406
  */
@@ -474,19 +478,19 @@ declare interface FlowplayerUMDBase {
474
478
  /**
475
479
  * @public
476
480
  */
477
- declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayerAPIExtension extends Player = Player> extends FlowplayerUMDBase {
481
+ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayer extends Player = Player> extends FlowplayerUMDBase {
478
482
  /**
479
483
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
480
484
  * @param selector - query selector of the HTML element where player will render
481
485
  * @param config - Configuration of the flowplayer and the attached plugins
482
486
  */
483
- (selector: string, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
487
+ (selector: string, config?: ConfigWithPlugins): PluginPlayer;
484
488
  /**
485
489
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
486
490
  * @param element - HTML element where player will render
487
491
  * @param config - Configuration of the flowplayer and the attached plugins
488
492
  */
489
- (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
493
+ (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayer;
490
494
  }
491
495
 
492
496
  /**
@@ -638,10 +642,11 @@ declare const LOADED = "is-loaded";
638
642
 
639
643
  /**
640
644
  * @public A plugin that supports loading new media formats. Use 'class MyPlugin implements Loader\<...\>' when writing your custom Loader
641
- * @typeParam PluginPlayerAPIExtension - additional Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
645
+ * @typeParam PluginPlayer- Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
642
646
  */
643
- declare interface Loader<PluginOwnConfig extends KeyValue, PluginPlayerAPIExtension extends _AttachedEventCheck> extends Plugin_2<PluginOwnConfig, PlayerWith<PluginPlayerAPIExtension>> {
644
- onload(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayerAPIExtension>, src?: SourceObj): void;
647
+ declare interface Loader<PluginOwnConfig extends KeyValue, // FIXME extends Config
648
+ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwnConfig, PluginPlayer> {
649
+ onload: EnsureOnAttached<(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayer>, src: SourceObj) => void, PluginPlayer>;
645
650
  wants<S = SourceObj>(srcString: SourceStr, srcObj: S, config: ConfigWith<PluginOwnConfig>): boolean;
646
651
  wants<S = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: ConfigWith<PluginOwnConfig>): boolean;
647
652
  }
@@ -1038,6 +1043,7 @@ declare type PlayerNativeEventsOverloads = {
1038
1043
 
1039
1044
  /**
1040
1045
  * @public
1046
+ * The root element of the video player. This is the immediate parent element of the video tag.
1041
1047
  */
1042
1048
  declare type PlayerRoot = HTMLElement & {
1043
1049
  /* Excluded from this release type: prevWidth */
@@ -1073,11 +1079,11 @@ PLAYING_2 = "playing";
1073
1079
  /**
1074
1080
  * @public
1075
1081
  */
1076
- declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1082
+ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1077
1083
  /**
1078
1084
  * a plugin must always implement the init method so a player instance knows how to initialize it
1079
1085
  */
1080
- init(config: PluginConfig, container: PlayerRoot, player: PluginPlayerAPI): void;
1086
+ init(config: PluginConfig, container: PlayerRoot, player: PluginPlayer): void;
1081
1087
  }
1082
1088
 
1083
1089
  /* Excluded from this release type: PLUGIN_REGISTERED */
@@ -1085,8 +1091,8 @@ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI
1085
1091
  /**
1086
1092
  * @public
1087
1093
  */
1088
- declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1089
- new (umd: FlowplayerUMD, player: PluginPlayerAPI): Plugin_2<PluginConfig, PluginPlayerAPI>;
1094
+ declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1095
+ new (umd: FlowplayerUMD, player: PluginPlayer): Plugin_2<PluginConfig, PluginPlayer>;
1090
1096
  }
1091
1097
 
1092
1098
  /* Excluded from this release type: PluginRegisteredEventDetail */
package/plugins/qsel.d.ts CHANGED
@@ -315,6 +315,8 @@ declare const /**
315
315
  */
316
316
  ENDED_2 = "ended";
317
317
 
318
+ declare type EnsureOnAttached<P extends Function, T extends Player> = ExtractPureAPI<T> extends _AttachedEventCheck ? P : "Loaders must implement on('<pluginname>:attached') event";
319
+
318
320
  /**
319
321
  * @public
320
322
  */
@@ -397,6 +399,8 @@ declare namespace events {
397
399
  }
398
400
  }
399
401
 
402
+ declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
403
+
400
404
  /**
401
405
  * @public
402
406
  */
@@ -474,19 +478,19 @@ declare interface FlowplayerUMDBase {
474
478
  /**
475
479
  * @public
476
480
  */
477
- declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayerAPIExtension extends Player = Player> extends FlowplayerUMDBase {
481
+ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayer extends Player = Player> extends FlowplayerUMDBase {
478
482
  /**
479
483
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
480
484
  * @param selector - query selector of the HTML element where player will render
481
485
  * @param config - Configuration of the flowplayer and the attached plugins
482
486
  */
483
- (selector: string, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
487
+ (selector: string, config?: ConfigWithPlugins): PluginPlayer;
484
488
  /**
485
489
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
486
490
  * @param element - HTML element where player will render
487
491
  * @param config - Configuration of the flowplayer and the attached plugins
488
492
  */
489
- (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
493
+ (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayer;
490
494
  }
491
495
 
492
496
  /**
@@ -638,10 +642,11 @@ declare const LOADED = "is-loaded";
638
642
 
639
643
  /**
640
644
  * @public A plugin that supports loading new media formats. Use 'class MyPlugin implements Loader\<...\>' when writing your custom Loader
641
- * @typeParam PluginPlayerAPIExtension - additional Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
645
+ * @typeParam PluginPlayer- Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
642
646
  */
643
- declare interface Loader<PluginOwnConfig extends KeyValue, PluginPlayerAPIExtension extends _AttachedEventCheck> extends Plugin_2<PluginOwnConfig, PlayerWith<PluginPlayerAPIExtension>> {
644
- onload(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayerAPIExtension>, src?: SourceObj): void;
647
+ declare interface Loader<PluginOwnConfig extends KeyValue, // FIXME extends Config
648
+ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwnConfig, PluginPlayer> {
649
+ onload: EnsureOnAttached<(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayer>, src: SourceObj) => void, PluginPlayer>;
645
650
  wants<S = SourceObj>(srcString: SourceStr, srcObj: S, config: ConfigWith<PluginOwnConfig>): boolean;
646
651
  wants<S = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: ConfigWith<PluginOwnConfig>): boolean;
647
652
  }
@@ -1038,6 +1043,7 @@ declare type PlayerNativeEventsOverloads = {
1038
1043
 
1039
1044
  /**
1040
1045
  * @public
1046
+ * The root element of the video player. This is the immediate parent element of the video tag.
1041
1047
  */
1042
1048
  declare type PlayerRoot = HTMLElement & {
1043
1049
  /* Excluded from this release type: prevWidth */
@@ -1073,11 +1079,11 @@ PLAYING_2 = "playing";
1073
1079
  /**
1074
1080
  * @public
1075
1081
  */
1076
- declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1082
+ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1077
1083
  /**
1078
1084
  * a plugin must always implement the init method so a player instance knows how to initialize it
1079
1085
  */
1080
- init(config: PluginConfig, container: PlayerRoot, player: PluginPlayerAPI): void;
1086
+ init(config: PluginConfig, container: PlayerRoot, player: PluginPlayer): void;
1081
1087
  }
1082
1088
 
1083
1089
  /* Excluded from this release type: PLUGIN_REGISTERED */
@@ -1085,8 +1091,8 @@ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI
1085
1091
  /**
1086
1092
  * @public
1087
1093
  */
1088
- declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1089
- new (umd: FlowplayerUMD, player: PluginPlayerAPI): Plugin_2<PluginConfig, PluginPlayerAPI>;
1094
+ declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1095
+ new (umd: FlowplayerUMD, player: PluginPlayer): Plugin_2<PluginConfig, PluginPlayer>;
1090
1096
  }
1091
1097
 
1092
1098
  /* Excluded from this release type: PluginRegisteredEventDetail */
package/plugins/qul.d.ts CHANGED
@@ -315,6 +315,8 @@ declare const /**
315
315
  */
316
316
  ENDED_2 = "ended";
317
317
 
318
+ declare type EnsureOnAttached<P extends Function, T extends Player> = ExtractPureAPI<T> extends _AttachedEventCheck ? P : "Loaders must implement on('<pluginname>:attached') event";
319
+
318
320
  /**
319
321
  * @public
320
322
  */
@@ -397,6 +399,8 @@ declare namespace events {
397
399
  }
398
400
  }
399
401
 
402
+ declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
403
+
400
404
  /**
401
405
  * @public
402
406
  */
@@ -474,19 +478,19 @@ declare interface FlowplayerUMDBase {
474
478
  /**
475
479
  * @public
476
480
  */
477
- declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayerAPIExtension extends Player = Player> extends FlowplayerUMDBase {
481
+ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayer extends Player = Player> extends FlowplayerUMDBase {
478
482
  /**
479
483
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
480
484
  * @param selector - query selector of the HTML element where player will render
481
485
  * @param config - Configuration of the flowplayer and the attached plugins
482
486
  */
483
- (selector: string, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
487
+ (selector: string, config?: ConfigWithPlugins): PluginPlayer;
484
488
  /**
485
489
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
486
490
  * @param element - HTML element where player will render
487
491
  * @param config - Configuration of the flowplayer and the attached plugins
488
492
  */
489
- (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
493
+ (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayer;
490
494
  }
491
495
 
492
496
  /**
@@ -638,10 +642,11 @@ declare const LOADED = "is-loaded";
638
642
 
639
643
  /**
640
644
  * @public A plugin that supports loading new media formats. Use 'class MyPlugin implements Loader\<...\>' when writing your custom Loader
641
- * @typeParam PluginPlayerAPIExtension - additional Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
645
+ * @typeParam PluginPlayer- Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
642
646
  */
643
- declare interface Loader<PluginOwnConfig extends KeyValue, PluginPlayerAPIExtension extends _AttachedEventCheck> extends Plugin_2<PluginOwnConfig, PlayerWith<PluginPlayerAPIExtension>> {
644
- onload(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayerAPIExtension>, src?: SourceObj): void;
647
+ declare interface Loader<PluginOwnConfig extends KeyValue, // FIXME extends Config
648
+ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwnConfig, PluginPlayer> {
649
+ onload: EnsureOnAttached<(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayer>, src: SourceObj) => void, PluginPlayer>;
645
650
  wants<S = SourceObj>(srcString: SourceStr, srcObj: S, config: ConfigWith<PluginOwnConfig>): boolean;
646
651
  wants<S = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: ConfigWith<PluginOwnConfig>): boolean;
647
652
  }
@@ -1038,6 +1043,7 @@ declare type PlayerNativeEventsOverloads = {
1038
1043
 
1039
1044
  /**
1040
1045
  * @public
1046
+ * The root element of the video player. This is the immediate parent element of the video tag.
1041
1047
  */
1042
1048
  declare type PlayerRoot = HTMLElement & {
1043
1049
  /* Excluded from this release type: prevWidth */
@@ -1073,11 +1079,11 @@ PLAYING_2 = "playing";
1073
1079
  /**
1074
1080
  * @public
1075
1081
  */
1076
- declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1082
+ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1077
1083
  /**
1078
1084
  * a plugin must always implement the init method so a player instance knows how to initialize it
1079
1085
  */
1080
- init(config: PluginConfig, container: PlayerRoot, player: PluginPlayerAPI): void;
1086
+ init(config: PluginConfig, container: PlayerRoot, player: PluginPlayer): void;
1081
1087
  }
1082
1088
 
1083
1089
  /* Excluded from this release type: PLUGIN_REGISTERED */
@@ -1085,8 +1091,8 @@ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI
1085
1091
  /**
1086
1092
  * @public
1087
1093
  */
1088
- declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1089
- new (umd: FlowplayerUMD, player: PluginPlayerAPI): Plugin_2<PluginConfig, PluginPlayerAPI>;
1094
+ declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1095
+ new (umd: FlowplayerUMD, player: PluginPlayer): Plugin_2<PluginConfig, PluginPlayer>;
1090
1096
  }
1091
1097
 
1092
1098
  /* Excluded from this release type: PluginRegisteredEventDetail */
package/plugins/rts.d.ts CHANGED
@@ -315,6 +315,8 @@ declare const /**
315
315
  */
316
316
  ENDED_2 = "ended";
317
317
 
318
+ declare type EnsureOnAttached<P extends Function, T extends Player> = ExtractPureAPI<T> extends _AttachedEventCheck ? P : "Loaders must implement on('<pluginname>:attached') event";
319
+
318
320
  /**
319
321
  * @public
320
322
  */
@@ -397,6 +399,8 @@ declare namespace events {
397
399
  }
398
400
  }
399
401
 
402
+ declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
403
+
400
404
  /**
401
405
  * @public
402
406
  */
@@ -474,19 +478,19 @@ declare interface FlowplayerUMDBase {
474
478
  /**
475
479
  * @public
476
480
  */
477
- declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayerAPIExtension extends Player = Player> extends FlowplayerUMDBase {
481
+ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayer extends Player = Player> extends FlowplayerUMDBase {
478
482
  /**
479
483
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
480
484
  * @param selector - query selector of the HTML element where player will render
481
485
  * @param config - Configuration of the flowplayer and the attached plugins
482
486
  */
483
- (selector: string, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
487
+ (selector: string, config?: ConfigWithPlugins): PluginPlayer;
484
488
  /**
485
489
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
486
490
  * @param element - HTML element where player will render
487
491
  * @param config - Configuration of the flowplayer and the attached plugins
488
492
  */
489
- (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
493
+ (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayer;
490
494
  }
491
495
 
492
496
  /**
@@ -638,10 +642,11 @@ declare const LOADED = "is-loaded";
638
642
 
639
643
  /**
640
644
  * @public A plugin that supports loading new media formats. Use 'class MyPlugin implements Loader\<...\>' when writing your custom Loader
641
- * @typeParam PluginPlayerAPIExtension - additional Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
645
+ * @typeParam PluginPlayer- Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
642
646
  */
643
- declare interface Loader<PluginOwnConfig extends KeyValue, PluginPlayerAPIExtension extends _AttachedEventCheck> extends Plugin_2<PluginOwnConfig, PlayerWith<PluginPlayerAPIExtension>> {
644
- onload(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayerAPIExtension>, src?: SourceObj): void;
647
+ declare interface Loader<PluginOwnConfig extends KeyValue, // FIXME extends Config
648
+ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwnConfig, PluginPlayer> {
649
+ onload: EnsureOnAttached<(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayer>, src: SourceObj) => void, PluginPlayer>;
645
650
  wants<S = SourceObj>(srcString: SourceStr, srcObj: S, config: ConfigWith<PluginOwnConfig>): boolean;
646
651
  wants<S = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: ConfigWith<PluginOwnConfig>): boolean;
647
652
  }
@@ -1038,6 +1043,7 @@ declare type PlayerNativeEventsOverloads = {
1038
1043
 
1039
1044
  /**
1040
1045
  * @public
1046
+ * The root element of the video player. This is the immediate parent element of the video tag.
1041
1047
  */
1042
1048
  declare type PlayerRoot = HTMLElement & {
1043
1049
  /* Excluded from this release type: prevWidth */
@@ -1073,11 +1079,11 @@ PLAYING_2 = "playing";
1073
1079
  /**
1074
1080
  * @public
1075
1081
  */
1076
- declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1082
+ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1077
1083
  /**
1078
1084
  * a plugin must always implement the init method so a player instance knows how to initialize it
1079
1085
  */
1080
- init(config: PluginConfig, container: PlayerRoot, player: PluginPlayerAPI): void;
1086
+ init(config: PluginConfig, container: PlayerRoot, player: PluginPlayer): void;
1081
1087
  }
1082
1088
 
1083
1089
  /* Excluded from this release type: PLUGIN_REGISTERED */
@@ -1085,8 +1091,8 @@ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI
1085
1091
  /**
1086
1092
  * @public
1087
1093
  */
1088
- declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1089
- new (umd: FlowplayerUMD, player: PluginPlayerAPI): Plugin_2<PluginConfig, PluginPlayerAPI>;
1094
+ declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1095
+ new (umd: FlowplayerUMD, player: PluginPlayer): Plugin_2<PluginConfig, PluginPlayer>;
1090
1096
  }
1091
1097
 
1092
1098
  /* Excluded from this release type: PluginRegisteredEventDetail */
@@ -315,6 +315,8 @@ declare const /**
315
315
  */
316
316
  ENDED_2 = "ended";
317
317
 
318
+ declare type EnsureOnAttached<P extends Function, T extends Player> = ExtractPureAPI<T> extends _AttachedEventCheck ? P : "Loaders must implement on('<pluginname>:attached') event";
319
+
318
320
  /**
319
321
  * @public
320
322
  */
@@ -397,6 +399,8 @@ declare namespace events {
397
399
  }
398
400
  }
399
401
 
402
+ declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
403
+
400
404
  /**
401
405
  * @public
402
406
  */
@@ -474,19 +478,19 @@ declare interface FlowplayerUMDBase {
474
478
  /**
475
479
  * @public
476
480
  */
477
- declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayerAPIExtension extends Player = Player> extends FlowplayerUMDBase {
481
+ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayer extends Player = Player> extends FlowplayerUMDBase {
478
482
  /**
479
483
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
480
484
  * @param selector - query selector of the HTML element where player will render
481
485
  * @param config - Configuration of the flowplayer and the attached plugins
482
486
  */
483
- (selector: string, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
487
+ (selector: string, config?: ConfigWithPlugins): PluginPlayer;
484
488
  /**
485
489
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
486
490
  * @param element - HTML element where player will render
487
491
  * @param config - Configuration of the flowplayer and the attached plugins
488
492
  */
489
- (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayerAPIExtension;
493
+ (element: HTMLElement, config?: ConfigWithPlugins): PluginPlayer;
490
494
  }
491
495
 
492
496
  /**
@@ -638,10 +642,11 @@ declare const LOADED = "is-loaded";
638
642
 
639
643
  /**
640
644
  * @public A plugin that supports loading new media formats. Use 'class MyPlugin implements Loader\<...\>' when writing your custom Loader
641
- * @typeParam PluginPlayerAPIExtension - additional Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
645
+ * @typeParam PluginPlayer- Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler
642
646
  */
643
- declare interface Loader<PluginOwnConfig extends KeyValue, PluginPlayerAPIExtension extends _AttachedEventCheck> extends Plugin_2<PluginOwnConfig, PlayerWith<PluginPlayerAPIExtension>> {
644
- onload(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayerAPIExtension>, src?: SourceObj): void;
647
+ declare interface Loader<PluginOwnConfig extends KeyValue, // FIXME extends Config
648
+ PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwnConfig, PluginPlayer> {
649
+ onload: EnsureOnAttached<(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayer>, src: SourceObj) => void, PluginPlayer>;
645
650
  wants<S = SourceObj>(srcString: SourceStr, srcObj: S, config: ConfigWith<PluginOwnConfig>): boolean;
646
651
  wants<S = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: ConfigWith<PluginOwnConfig>): boolean;
647
652
  }
@@ -1038,6 +1043,7 @@ declare type PlayerNativeEventsOverloads = {
1038
1043
 
1039
1044
  /**
1040
1045
  * @public
1046
+ * The root element of the video player. This is the immediate parent element of the video tag.
1041
1047
  */
1042
1048
  declare type PlayerRoot = HTMLElement & {
1043
1049
  /* Excluded from this release type: prevWidth */
@@ -1073,11 +1079,11 @@ PLAYING_2 = "playing";
1073
1079
  /**
1074
1080
  * @public
1075
1081
  */
1076
- declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1082
+ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1077
1083
  /**
1078
1084
  * a plugin must always implement the init method so a player instance knows how to initialize it
1079
1085
  */
1080
- init(config: PluginConfig, container: PlayerRoot, player: PluginPlayerAPI): void;
1086
+ init(config: PluginConfig, container: PlayerRoot, player: PluginPlayer): void;
1081
1087
  }
1082
1088
 
1083
1089
  /* Excluded from this release type: PLUGIN_REGISTERED */
@@ -1085,8 +1091,8 @@ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayerAPI
1085
1091
  /**
1086
1092
  * @public
1087
1093
  */
1088
- declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayerAPI extends Player = Player> {
1089
- new (umd: FlowplayerUMD, player: PluginPlayerAPI): Plugin_2<PluginConfig, PluginPlayerAPI>;
1094
+ declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1095
+ new (umd: FlowplayerUMD, player: PluginPlayer): Plugin_2<PluginConfig, PluginPlayer>;
1090
1096
  }
1091
1097
 
1092
1098
  /* Excluded from this release type: PluginRegisteredEventDetail */