@flowplayer/player 3.23.1-rc → 3.24.0-rc.2

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 (86) hide show
  1. package/core/events.js +148 -74
  2. package/core.js +1 -1
  3. package/default.js +1 -1
  4. package/embed.js +2 -2
  5. package/index.d.ts +8 -37
  6. package/package.json +1 -1
  7. package/plugins/ads.d.ts +13 -42
  8. package/plugins/ads.js +2 -2
  9. package/plugins/airplay.d.ts +8 -42
  10. package/plugins/airplay.js +1 -1
  11. package/plugins/analytics.d.ts +8 -42
  12. package/plugins/analytics.js +1 -1
  13. package/plugins/asel.d.ts +8 -42
  14. package/plugins/asel.js +1 -1
  15. package/plugins/audio.d.ts +8 -42
  16. package/plugins/audio.js +1 -1
  17. package/plugins/chapters.d.ts +8 -42
  18. package/plugins/chapters.js +1 -1
  19. package/plugins/chromecast.d.ts +8 -42
  20. package/plugins/chromecast.js +1 -1
  21. package/plugins/comscore.d.ts +8 -42
  22. package/plugins/comscore.js +1 -1
  23. package/plugins/consent.d.ts +8 -42
  24. package/plugins/consent.js +1 -1
  25. package/plugins/context-menu.d.ts +8 -42
  26. package/plugins/context-menu.js +1 -1
  27. package/plugins/cuepoints.d.ts +8 -42
  28. package/plugins/cuepoints.js +1 -1
  29. package/plugins/dash.d.ts +8 -42
  30. package/plugins/dash.js +1 -1
  31. package/plugins/drm.d.ts +70 -8
  32. package/plugins/drm.js +1 -1
  33. package/plugins/endscreen.d.ts +8 -42
  34. package/plugins/endscreen.js +1 -1
  35. package/plugins/fas.d.ts +8 -42
  36. package/plugins/fas.js +1 -1
  37. package/plugins/float-on-scroll.d.ts +8 -42
  38. package/plugins/float-on-scroll.js +1 -1
  39. package/plugins/ga4.d.ts +8 -42
  40. package/plugins/ga4.js +1 -1
  41. package/plugins/gemius.d.ts +8 -42
  42. package/plugins/gemius.js +1 -1
  43. package/plugins/google-analytics.d.ts +8 -42
  44. package/plugins/google-analytics.js +1 -1
  45. package/plugins/hls.d.ts +8 -42
  46. package/plugins/hls.js +1 -1
  47. package/plugins/id3.d.ts +8 -42
  48. package/plugins/id3.js +1 -1
  49. package/plugins/iframe.d.ts +8 -42
  50. package/plugins/iframe.js +1 -1
  51. package/plugins/keyboard.d.ts +8 -42
  52. package/plugins/keyboard.js +1 -1
  53. package/plugins/media-session.d.ts +8 -42
  54. package/plugins/media-session.js +1 -1
  55. package/plugins/message.d.ts +8 -42
  56. package/plugins/message.js +1 -1
  57. package/plugins/ovp.d.ts +8 -42
  58. package/plugins/ovp.js +1 -1
  59. package/plugins/playlist.d.ts +95 -43
  60. package/plugins/playlist.js +1 -1
  61. package/plugins/preview.d.ts +8 -42
  62. package/plugins/preview.js +1 -1
  63. package/plugins/qsel.d.ts +8 -42
  64. package/plugins/qsel.js +1 -1
  65. package/plugins/qul.d.ts +8 -42
  66. package/plugins/qul.js +1 -1
  67. package/plugins/rts.d.ts +8 -42
  68. package/plugins/rts.js +1 -1
  69. package/plugins/share.d.ts +8 -42
  70. package/plugins/share.js +1 -1
  71. package/plugins/speed.d.ts +8 -42
  72. package/plugins/speed.js +1 -1
  73. package/plugins/ssai.d.ts +8 -42
  74. package/plugins/ssai.js +1 -1
  75. package/plugins/subtitles.d.ts +15 -45
  76. package/plugins/subtitles.js +1 -1
  77. package/plugins/thumbnails.d.ts +8 -42
  78. package/plugins/thumbnails.js +1 -1
  79. package/plugins/tizen.d.ts +8 -42
  80. package/plugins/tizen.js +1 -1
  81. package/plugins/vtsel.d.ts +8 -42
  82. package/plugins/vtsel.js +1 -1
  83. package/plugins/webos.d.ts +8 -42
  84. package/plugins/webos.js +1 -1
  85. package/util/loader.d.ts +8 -42
  86. package/util/loader.js +9 -8
@@ -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.subtitles=t())}(this,(function(){"use strict";function e(e,t,s){const n=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;n.length;){if(null==e)return s;const t=n.shift();if("string"!=typeof t)return s;e=e[t]}return null==e?s:e}function t(e,t){e.innerHTML="",t.forEach((function(t){const s=document.createElement("pre");s.classList.add("fp-cue"),function(e,t){const s=e.style,n=t.size;s.setProperty("--caption-size",n.toString());const i=t.position;i&&"auto"!==i&&t?s.setProperty("--caption-position",i.toString()):s.removeProperty("--caption-position");const r="captions-align-"+t.align;Array.from(e.classList).forEach((function(s){s!=r&&("captions-vertical"==s&&t.vertical||s.startsWith("captions")&&e.classList.remove(s))})),e.classList.add(r),e.classList.toggle("captions-vertical",!!t.vertical)}(e,t),s.appendChild(t.getCueAsHTML()),e.appendChild(s)}))}function s(){}const n="is-source-processing",i=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const n=window.customElements.get(t);if(!n)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?n:i})(e._customElements,t))(e),r=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};function a(e,t,s){const n=function(e,t){const s=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(s,"data",{get:()=>t}),s}(t,s);return e.dispatchEvent(n),e}function o(e,t){const s=e._customElements.get(t);return s&&e.root.querySelector(s)||void 0}!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const l="fp-on",c="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.menuHeader=document.createElement("div"),this.menuTitle=document.createElement("h3"),this.olEle=document.createElement("ol"),this.olEle.id=d(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menuHeader.classList.add("fp-menu-header"),this.menuHeader.append(this.menuTitle,this.closeEle),this.menu.classList.add("fp-menu"),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add("fp-menu-container"),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",t=>{if(t.defaultPrevented)return;t.preventDefault();const s=this.menuContainer.open;s||(u(),document.active_menu=this.menuContainer),this.menuContainer.open=!s,e.root.classList.toggle("has-menu-opened",!s),this.summaryEle.setAttribute("aria-expanded",s?"false":"true")}),this.addEventListener("focusin",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","true")}),this.addEventListener("focusout",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","false")}),this.append(this.menuContainer),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("aria-expanded","false"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.className=e.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=e.id||d()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=i(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}e.menuTitle&&(this.menuTitle.textContent=e.menuTitle),this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.toggle_visibility(!(null==e?void 0:e.length)))}menuOption(e,t){const s=document.createElement("li");s.setAttribute("role","menuitem"),s.setAttribute("aria-selected","false"),s.setAttribute("tabindex","0"),e.icon&&s.append(e.icon);const n=document.createElement("span");n.textContent=e.text,s.append(n),s.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(s),e.selected&&this.select_item(t)}select_item(e){this.options.forEach((t,s)=>{t.classList.toggle(l,s===e)})}unselect_item(){this.options.forEach(e=>{e.classList.remove(l)})}toggle_visibility(e){this.classList.toggle(c,e),this.menu.style.setProperty("display",e?"none":"flex")}}function u(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const s=e.root.querySelector("details[open].fp-menu-container");s&&(s.open=!1,null===(t=s.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}function d(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(u(),this.active_menu=void 0)}));const p=["255, 255, 255","255, 255, 0","0, 255, 0","0, 255, 255","0, 0, 255","255, 0, 255","255, 0, 0","0, 0, 0"],m=[.25,.5,.75,1,1.25,1.5,1.75,2,3,4],h=["White","Yellow","Green","Cyan","Blue","Magenta","Red","Black"],f=["Monospaced Serif","Proportional Serif","Monospaced Sans-Serif","Proportional Sans-Serif","Casual","Cursive"],y=["Courier New, monospace","serif","Andale Mono, Lucida Console, monospace","sans-serif","Comic Sans MS, Impact, fantasy","Monotype Corsiva, cursive"],v=["None","Drop shadow","Raised","Depressed","Outline"],b=["","rgb(34, 34, 34) 2px 2px 3px, rgb(34, 34, 34) 2px 2px 4px, rgb(34, 34, 34) 2px 2px 5px","rgb(34, 34, 34) 1px 1px, rgb(34, 34, 34) 2px 2px, rgb(34, 34, 34) 3px 3px","rgb(204, 204, 204) 1px 1px, rgb(204, 204, 204) 0px 1px, rgb(34, 34, 34) -1px -1px, rgb(34, 34, 34) 0px -1px","rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px"];class StyleOpt{constructor(e,t,s,n,i){this.player=e,this.labels=t,this.values=s,this.css_variable=n,this.default_value=i,this.selected=e._storage.getItem(n)||i}set selected(e){document.documentElement.style.setProperty(this.css_variable,e),this.player._storage.setItem(this.css_variable,e)}get selected(){return document.documentElement.style.getPropertyValue(this.css_variable)}}var g;!function(e){e[e.main=0]="main",e[e.tracks=1]="tracks",e[e.style=2]="style",e[e.styleOpt=3]="styleOpt"}(g||(g={}));class FlowplayerSubtitlesMenu extends FlowplayerMenu{constructor(e){if(super(e),this.state=g.main,this.selectedTrackIdx=-1,this.isTV=!1,this.styleOpts=function(e){return{[e.i18n("cc.properties.fontSize","Font size")]:new StyleOpt(e,m.map(e=>100*e+"%"),m.map(e=>100*e+"%"),"--fp-sub-font-size","100%"),[e.i18n("cc.properties.fontFamily","Font family")]:new StyleOpt(e,f.map(t=>e.i18n("cc.fontFamily."+t,t)),y,"--fp-sub-font-family","sans-serif"),[e.i18n("cc.properties.fontColor","Font color")]:new StyleOpt(e,h.map(t=>e.i18n("cc.colors."+t,t)),p,"--fp-sub-font-color",p[0]),[e.i18n("cc.properties.fontOpacity","Font opacity")]:new StyleOpt(e,m.flatMap(e=>e>1?[]:100*e+"%"),m.flatMap(e=>e>1?[]:e+""),"--fp-sub-font-opacity","1"),[e.i18n("cc.properties.backgroundColor","Background color")]:new StyleOpt(e,h.map(t=>e.i18n("cc.colors."+t,t)),p,"--fp-sub-background-color",p[7]),[e.i18n("cc.properties.backgroundOpacity","Background opacity")]:new StyleOpt(e,m.flatMap(e=>e>1?[]:100*e+"%"),m.flatMap(e=>e>1?[]:e+""),"--fp-sub-background-opacity","0.5"),[e.i18n("cc.properties.characterEdgeStyle","Character edge style")]:new StyleOpt(e,v.map(t=>e.i18n("cc.edgeStyle."+t,t)),b,"--fp-sub-edge-style","")}}(e),e.on("mount",()=>{setTimeout(()=>this.isTV=e.hasState("is-tv"),0),this.classList.toggle("subs-native",!!e.opt("subtitles.native"))}),e.on(M.events.TRACK_UPDATED,e=>this.summaryEle.classList.toggle("fp-color-text",!!e.detail)),e.opt("subtitles.native"))return;const t=i(this.player,"flowplayer-menu-back");t.setAttribute("aria-label","Back to previous menu"),this.menuHeader.prepend(t),t.addEventListener("click",()=>this.navigateBack());const s=i(this.player,"flowplayer-subs-menu-icon");s.setAttribute("aria-label","Open style menu"),s.addEventListener("click",()=>this.createMenu(g.style)),this.menuHeader.insertBefore(s,this.menuTitle),this.summaryEle.addEventListener("click",()=>{this.menuContainer.open||this.createMenu(g.main)}),this.menu.addEventListener("click",e=>{(e.target===s||e.target===t||this.state!==g.main&&e.target!==this.closeEle)&&e.preventDefault()}),this.addEventListener(M.events.TRACKS,e=>{var t;this.tracks=e.detail,this.selectedTrackIdx=-1,this.toggle_visibility(!(null===(t=null==this?void 0:this.tracks)||void 0===t?void 0:t.length)),this.state===(this.isTV?g.tracks:g.main)&&this.createMenu(this.isTV?g.tracks:g.main)}),this.addEventListener(M.events.SWITCH,e=>{this.selectedTrackIdx=e.detail.selected_index,this.state===(this.isTV?g.tracks:g.main)&&this.select_item(this.selectedTrackIdx)}),this.player.addEventListener("tv-menu:will-open",()=>{var e;(null===(e=this.tracks)||void 0===e?void 0:e.length)&&this.createMenu(g.main)}),this.player.on(["tv-menu:will-close","keyboard:close:menus"],e=>{var t;this.state!==g.main&&(null===(t=document.activeElement)||void 0===t?void 0:t.closest(".fp-menu"))===this.menu&&(this.navigateBack(),e.preventDefault())})}navigateBack(){switch(this.state){case g.style:case g.tracks:return this.createMenu(g.main);case g.styleOpt:return this.createMenu(g.style)}}getMenuTitle(){switch(this.state){case g.main:return this.player.i18n("cc.menu_title","Subtitles");case g.tracks:return this.player.i18n("cc.tracks","Tracks");case g.style:return this.player.i18n("cc.options","Options");default:return""}}createMenuOpts(e){switch(this.state){case g.main:return this.isTV?this.createTvMainMenuOpts():this.createTracksMenuOpts();case g.tracks:return this.createTracksMenuOpts();case g.style:return this.createStyleMenuOpts();case g.styleOpt:return e?this.createStylePropertyMenuOpts(this.styleOpts[e]):[]}}createMenu(e,t){var s;this.state=e,this.menu.classList.toggle("fp-submenu",e>0),this.menuTitle.textContent=t||this.getMenuTitle(),this.render(this.createMenuOpts(t)),null===(s=this.menu.querySelector("li"))||void 0===s||s.focus()}createTvMainMenuOpts(){return[{text:this.player.i18n("cc.tracks","Tracks"),onclick:this.createMenu.bind(this,g.tracks)},{text:this.player.i18n("cc.options","Options"),onclick:this.createMenu.bind(this,g.style)}]}createTracksMenuOpts(){return Array.isArray(null==this?void 0:this.tracks)?this.tracks.map((e,t)=>({text:e.text,onclick:()=>{e.onclick(),this.selectedTrackIdx=this.selectedTrackIdx===t?-1:t},selected:this.selectedTrackIdx===t})):[]}createStyleMenuOpts(){const e=Object.keys(this.styleOpts).map(e=>({text:e,onclick:this.createMenu.bind(this,g.styleOpt,e)}));return e.push({text:this.player.i18n("cc.reset","Reset"),onclick:()=>Object.values(this.styleOpts).forEach(e=>e.selected=e.default_value)}),e}createStylePropertyMenuOpts(e){return e.labels.map((t,s)=>({text:t,onclick:()=>{e.selected=e.values[s]},selected:s===e.values.indexOf(e.selected)}))}select_item(e){if(this.state!==g.style)return this.state===g.styleOpt?super.select_item(e):void this.options.forEach((t,s)=>{t.classList.toggle(l,s===e&&!t.classList.contains(l))})}}class FlowplayerIcon extends FlowplayerComponent{constructor(e,t){super(e),this.classList.add("fp-icon",t.name),t.title&&this.setAttribute("title",t.title),t.title&&this.setAttribute("aria-label",t.title),t.translation_key&&this.setAttribute("aria-label",e.i18n(t.translation_key)),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}function k(e){return!document.fullscreenEnabled&&"function"==typeof e.webkitEnterFullScreen&&"function"==typeof e.webkitExitFullScreen}const x="subs:tracks",E="subs:change";var A,w=Object.freeze({__proto__:null,TRACK_UPDATED:"tracks:text:updated",TRACKS:x,SWITCH:E,CUES_PARSED:"cues:parsed",TEXT_TRACKS:"tracks:text:all"});function _(e,t){if(function(e){return Object.values(A).includes(e)}(t=t||A.Anonymous))return e instanceof HTMLVideoElement&&(e.poster="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),"crossOrigin"in e?e.crossOrigin=t:e.setAttribute("crossorigin",t),e}function T(e){const t=document.createElement("a");return t.href=e,t.origin}function C(e,t){const n=document.createElement("track");n.className="fp-track renderable",n.kind=t.kind||"captions",n.label=t.label||t.lang||"",n.lang=t.lang||"",n.id=["fp",t.lang].join("-");const i=n.track;return i.removeCue=s,"string"!=typeof t.crossorigin&&function(e,t){try{return e.src.startsWith("blob:"),T(e.src)!==T(t)}catch(e){return console.error(e),!0}}(e,t.src)&&(_(e),t.crossorigin=e.getAttribute("crossorigin")),"crossorigin"in t&&_(e,t.crossorigin),Object.keys(t).forEach(e=>{"default"!==e&&(n[e]=t[e])}),i.mode=t.default?"hidden":"disabled",e.appendChild(n),n}!function(e){e.Anonymous="anonymous",e.UseCredentials="use-credentials",e.Empty=""}(A||(A={}));const O={translation_key:"cc.menu_title",name:"fp-subtitles-menu"},S={name:"fp-menu-back"};var L;const M=((L=class Subtitles{constructor(e){r(e,"flowplayer-subtitles-menu",FlowplayerSubtitlesMenu),r(e,"flowplayer-subs-menu-icon",class extends FlowplayerIcon{constructor(e){super(e,O)}}),r(e,"flowplayer-menu-back",class extends FlowplayerIcon{constructor(e){super(e,S)}})}init(r,l,c){var u,d;const p=i(c,"flowplayer-subtitles-menu");p instanceof FlowplayerSubtitlesMenu&&p.setMenuAttrs({class:"fp-cc",summaryTitle:c.i18n("cc.button","CC"),menuTitle:c.i18n("cc.menu_title","Subtitles"),options_event:(null===(u=r.subtitles)||void 0===u?void 0:u.native)?x:void 0,item_selected_event:(null===(d=r.subtitles)||void 0===d?void 0:d.native)?E:void 0});const m=function(e){const t=document.createElement("div");return t.classList.add("fp-captions"),t.ontouchend=t=>e.emit(t.type),t.onclick=t=>e.emit(t.type),t}(c);let h,f=[],y=[];function v(){return Array.from(c.textTracks).filter(e=>~["captions","subtitles","descriptions"].indexOf(e.kind)&&!e.removed&&e.label)}function b(){return v().find(e=>e.is_active)}function g(e){Array.from(e.querySelectorAll("track")).forEach(t=>{["captions","subtitles","descriptions"].includes(t.kind)&&e.removeChild(t)})}function A(e,t,s){a(t,x,s.map((function(t){return{text:t.label,onclick:w.bind(0,e,t)}})));const n=b();return n?v().find(e=>e===n)?void a(t,E,{selected_index:s.indexOf(n)}):_():e.emit("tracks:text:updated")}function w(e,t){var s,n;if(t==b())return _();_(),t.is_hls_embedded&&"number"==typeof t.track_id&&e.hls&&(e.hls.subtitleTrack=t.track_id),t.mode=(null===(s=e.opts.subtitles)||void 0===s?void 0:s.native)?"showing":"hidden",t.is_active=!0,e.emit("tracks:text:updated",t),(null===(n=e.opts.subtitles)||void 0===n?void 0:n.native)||e.emit("cuechange",{track:t})}function _(){const e=b();e&&(c.emit("tracks:text:updated"),e.mode="disabled",e.is_active=!1,t(m,[]))}!function(e){if(!k(e))return;e.on("webkitbeginfullscreen",()=>{const e=b();e&&(e.mode="showing")}),e.on("webkitendfullscreen",()=>{var t;const s=v().find(e=>"showing"===e.mode);s&&!(null===(t=e.opts.subtitles)||void 0===t?void 0:t.native)&&(s.mode="hidden"),s!==b()&&(s?w(e,s):_(),a(p,E,{selected_index:s?y.indexOf(s):-1}))})}(c),c.on("mount",(function(){var e,t;const s=o(c,"flowplayer-control");if(!s)return null===(e=o(c,"flowplayer-ui"))||void 0===e?void 0:e.appendChild(m);s.insertAdjacentElement("beforebegin",m),null===(t=c.hasState("is-tv")?o(c,"flowplayer-tv-menu"):s)||void 0===t||t.append(p)})),c.on("config",(function(e){var t,s;const n=null===(s=null===(t=e.data)||void 0===t?void 0:t.subtitles)||void 0===s?void 0:s.tracks;n&&f!==n&&(f=n,g(c),y=v(),A(c,p,y),f.forEach(e=>C(c,e)))})),c.on("tracks:text:all",e=>{const t=e.detail.tracks;t!==h&&(h=t,y=y.flatMap(e=>e.is_hls_embedded?(e.removed=!0,[]):e),A(c,p,y),t.filter(e=>{var t,s;return~["subtitles","captions"].indexOf((null==e?void 0:e.kind)||(null===(s=null===(t=null==e?void 0:e.subtitleTrack)||void 0===t?void 0:t.type)||void 0===s?void 0:s.toLocaleLowerCase())||"")}).forEach(e=>{var t,n,i,r,a,o,l;const u=c.addTextTrack("captions"===e.kind?"captions":"subtitles",(null===(t=e.subtitleTrack)||void 0===t?void 0:t.name)||e.label,null===(n=e.subtitleTrack)||void 0===n?void 0:n.lang);u.is_hls_embedded=!0,u.default=void 0!==(null===(i=e.subtitleTrack)||void 0===i?void 0:i.default)?null===(r=e.subtitleTrack)||void 0===r?void 0:r.default:e.default,u.track_id=null!==(o=null===(a=e.subtitleTrack)||void 0===a?void 0:a.id)&&void 0!==o?o:e._id,u.mode=u.default?"hidden":"disabled",u.removeCue=s,u.attr=null===(l=e.subtitleTrack)||void 0===l?void 0:l.attrs}))}),c.on("cues:parsed",e=>{const t=e.detail,s=y.find(e=>e.is_hls_embedded&&!e.removed&&(e.default&&"default"===t.track||e.track_id===t.track||"subtitles"+e.track_id===t.track||"captions"+e.track_id===t.track));s&&t.cues.forEach(e=>s.addCue(e))}),c.textTracks.addEventListener("addtrack",()=>{const e=v();if(y.length===e.length&&y.every((t,s)=>t===e[s]))return;let t=b();if(e.map((function(e){return~["showing","hidden"].indexOf(e.mode)&&(t=e,e.mode="disabled",e.is_active=!1),e.oncuechange=function(t){var s;if(!(e===b()||k(c)&&c.hasState("is-fullscreen")))return e.mode="disabled";(null===(s=r.subtitles)||void 0===s?void 0:s.native)||c.emit(t.type,{track:t.target})},e})),a(p,x,e.map((function(e){return{text:e.label,onclick:w.bind(0,c,e)}}))),y=e,!t)return _();w(c,t),a(p,E,{selected_index:y.indexOf(t)})}),c.on("cuechange",(function(s){var n;const i=null===(n=s.data)||void 0===n?void 0:n.track;if(!i||!["captions","subtitles","descriptions"].includes(i.kind))return;const r=Array.from(e(i,"activeCues",[])).filter((e,t,s)=>t===s.findIndex(t=>e.id===t.id)).sort((e,t)=>"number"!=typeof e.line||"number"!=typeof t.line?0:e.line-t.line);t(m,r)})),c.on(["playlist/advance","src"],e=>{c.currentSrc&&("src"===e.type&&["is-playlist",n].some(e=>c.root.classList.contains(e))||(delete c.opts.subtitles,g(c),f=[],_(),y=[],h=[],v().forEach(e=>e.removed=!0),a(p,x,[])))})}}).events=w,L);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const s=e.flowplayer;return"function"==typeof s?(s(t),t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t),t)}(window,M)}));
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.subtitles=t())}(this,(function(){"use strict";function e(e,t,s){const n=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;n.length;){if(null==e)return s;const t=n.shift();if("string"!=typeof t)return s;e=e[t]}return null==e?s:e}function t(e,t){e.innerHTML="",t.forEach((function(t){const s=document.createElement("pre");s.classList.add("fp-cue"),function(e,t){const s=e.style,n=t.size;s.setProperty("--caption-size",n.toString());const i=t.position;i&&"auto"!==i&&t?s.setProperty("--caption-position",i.toString()):s.removeProperty("--caption-position");const r="captions-align-"+t.align;Array.from(e.classList).forEach((function(s){s!=r&&("captions-vertical"==s&&t.vertical||s.startsWith("captions")&&e.classList.remove(s))})),e.classList.add(r),e.classList.toggle("captions-vertical",!!t.vertical)}(e,t),s.appendChild(t.getCueAsHTML()),e.appendChild(s)}))}function s(){}const n="is-source-processing",i=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const n=window.customElements.get(t);if(!n)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?n:i})(e._customElements,t))(e),r=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};function a(e,t,s){const n=function(e,t){const s=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(s,"data",{get:()=>t}),s}(t,s);return e.dispatchEvent(n),e}function o(e,t){const s=e._customElements.get(t);return s&&e.root.querySelector(s)||void 0}!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const l="fp-on",c="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.menuHeader=document.createElement("div"),this.menuTitle=document.createElement("h3"),this.olEle=document.createElement("ol"),this.olEle.id=d(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menuHeader.classList.add("fp-menu-header"),this.menuHeader.append(this.menuTitle,this.closeEle),this.menu.classList.add("fp-menu"),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add("fp-menu-container"),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",t=>{if(t.defaultPrevented)return;t.preventDefault();const s=this.menuContainer.open;s||(u(),document.active_menu=this.menuContainer),this.menuContainer.open=!s,e.root.classList.toggle("has-menu-opened",!s),this.summaryEle.setAttribute("aria-expanded",s?"false":"true")}),this.addEventListener("focusin",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","true")}),this.addEventListener("focusout",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","false")}),this.append(this.menuContainer),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("aria-expanded","false"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.className=e.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=e.id||d()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=i(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}e.menuTitle&&(this.menuTitle.textContent=e.menuTitle),this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.toggle_visibility(!(null==e?void 0:e.length)))}menuOption(e,t){const s=document.createElement("li");s.setAttribute("role","menuitem"),s.setAttribute("aria-selected","false"),s.setAttribute("tabindex","0"),e.icon&&s.append(e.icon);const n=document.createElement("span");n.textContent=e.text,s.append(n),s.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(s),e.selected&&this.select_item(t)}select_item(e){this.options.forEach((t,s)=>{t.classList.toggle(l,s===e)})}unselect_item(){this.options.forEach(e=>{e.classList.remove(l)})}toggle_visibility(e){this.classList.toggle(c,e),this.menu.style.setProperty("display",e?"none":"flex")}}function u(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const s=e.root.querySelector("details[open].fp-menu-container");s&&(s.open=!1,null===(t=s.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}function d(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(u(),this.active_menu=void 0)}));const p=["255, 255, 255","255, 255, 0","0, 255, 0","0, 255, 255","0, 0, 255","255, 0, 255","255, 0, 0","0, 0, 0"],m=[.25,.5,.75,1,1.25,1.5,1.75,2,3,4],h=["White","Yellow","Green","Cyan","Blue","Magenta","Red","Black"],f=["Monospaced Serif","Proportional Serif","Monospaced Sans-Serif","Proportional Sans-Serif","Casual","Cursive"],y=["Courier New, monospace","serif","Andale Mono, Lucida Console, monospace","sans-serif","Comic Sans MS, Impact, fantasy","Monotype Corsiva, cursive"],v=["None","Drop shadow","Raised","Depressed","Outline"],b=["","rgb(34, 34, 34) 2px 2px 3px, rgb(34, 34, 34) 2px 2px 4px, rgb(34, 34, 34) 2px 2px 5px","rgb(34, 34, 34) 1px 1px, rgb(34, 34, 34) 2px 2px, rgb(34, 34, 34) 3px 3px","rgb(204, 204, 204) 1px 1px, rgb(204, 204, 204) 0px 1px, rgb(34, 34, 34) -1px -1px, rgb(34, 34, 34) 0px -1px","rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px"];class StyleOpt{constructor(e,t,s,n,i){this.player=e,this.labels=t,this.values=s,this.css_variable=n,this.default_value=i,this.selected=e._storage.getItem(n)||i}set selected(e){document.documentElement.style.setProperty(this.css_variable,e),this.player._storage.setItem(this.css_variable,e)}get selected(){return document.documentElement.style.getPropertyValue(this.css_variable)}}var g;!function(e){e[e.main=0]="main",e[e.tracks=1]="tracks",e[e.style=2]="style",e[e.styleOpt=3]="styleOpt"}(g||(g={}));class FlowplayerSubtitlesMenu extends FlowplayerMenu{constructor(e){if(super(e),this.state=g.main,this.selectedTrackIdx=-1,this.isTV=!1,this.styleOpts=function(e){return{[e.i18n("cc.properties.fontSize","Font size")]:new StyleOpt(e,m.map(e=>100*e+"%"),m.map(e=>100*e+"%"),"--fp-sub-font-size","100%"),[e.i18n("cc.properties.fontFamily","Font family")]:new StyleOpt(e,f.map(t=>e.i18n("cc.fontFamily."+t,t)),y,"--fp-sub-font-family","sans-serif"),[e.i18n("cc.properties.fontColor","Font color")]:new StyleOpt(e,h.map(t=>e.i18n("cc.colors."+t,t)),p,"--fp-sub-font-color",p[0]),[e.i18n("cc.properties.fontOpacity","Font opacity")]:new StyleOpt(e,m.flatMap(e=>e>1?[]:100*e+"%"),m.flatMap(e=>e>1?[]:e+""),"--fp-sub-font-opacity","1"),[e.i18n("cc.properties.backgroundColor","Background color")]:new StyleOpt(e,h.map(t=>e.i18n("cc.colors."+t,t)),p,"--fp-sub-background-color",p[7]),[e.i18n("cc.properties.backgroundOpacity","Background opacity")]:new StyleOpt(e,m.flatMap(e=>e>1?[]:100*e+"%"),m.flatMap(e=>e>1?[]:e+""),"--fp-sub-background-opacity","0.5"),[e.i18n("cc.properties.characterEdgeStyle","Character edge style")]:new StyleOpt(e,v.map(t=>e.i18n("cc.edgeStyle."+t,t)),b,"--fp-sub-edge-style","")}}(e),e.on("mount",()=>{setTimeout(()=>this.isTV=e.hasState("is-tv"),0),this.classList.toggle("subs-native",!!e.opt("subtitles.native"))}),e.on(M.events.TRACK_UPDATED,e=>this.summaryEle.classList.toggle("fp-color-text",!!e.detail)),e.opt("subtitles.native"))return;const t=i(this.player,"flowplayer-menu-back");t.setAttribute("aria-label","Back to previous menu"),this.menuHeader.prepend(t),t.addEventListener("click",()=>this.navigateBack());const s=i(this.player,"flowplayer-subs-menu-icon");s.setAttribute("aria-label","Open style menu"),s.addEventListener("click",()=>this.createMenu(g.style)),this.menuHeader.insertBefore(s,this.menuTitle),this.summaryEle.addEventListener("click",()=>{this.menuContainer.open||this.createMenu(g.main)}),this.menu.addEventListener("click",e=>{(e.target===s||e.target===t||this.state!==g.main&&e.target!==this.closeEle)&&e.preventDefault()}),this.addEventListener(M.events.TRACKS,e=>{var t;this.tracks=e.detail,this.selectedTrackIdx=-1,this.toggle_visibility(!(null===(t=null==this?void 0:this.tracks)||void 0===t?void 0:t.length)),this.state===(this.isTV?g.tracks:g.main)&&this.createMenu(this.isTV?g.tracks:g.main)}),this.addEventListener(M.events.SWITCH,e=>{this.selectedTrackIdx=e.detail.selected_index,this.state===(this.isTV?g.tracks:g.main)&&this.select_item(this.selectedTrackIdx)}),this.player.addEventListener("tv-menu:will-open",()=>{var e;(null===(e=this.tracks)||void 0===e?void 0:e.length)&&this.createMenu(g.main)}),this.player.on(["tv-menu:will-close","keyboard:close:menus"],e=>{var t;this.state!==g.main&&(null===(t=document.activeElement)||void 0===t?void 0:t.closest(".fp-menu"))===this.menu&&(this.navigateBack(),e.preventDefault())})}navigateBack(){switch(this.state){case g.style:case g.tracks:return this.createMenu(g.main);case g.styleOpt:return this.createMenu(g.style)}}getMenuTitle(){switch(this.state){case g.main:return this.player.i18n("cc.menu_title","Subtitles");case g.tracks:return this.player.i18n("cc.tracks","Tracks");case g.style:return this.player.i18n("cc.options","Options");default:return""}}createMenuOpts(e){switch(this.state){case g.main:return this.isTV?this.createTvMainMenuOpts():this.createTracksMenuOpts();case g.tracks:return this.createTracksMenuOpts();case g.style:return this.createStyleMenuOpts();case g.styleOpt:return e?this.createStylePropertyMenuOpts(this.styleOpts[e]):[]}}createMenu(e,t){var s;this.state=e,this.menu.classList.toggle("fp-submenu",e>0),this.menuTitle.textContent=t||this.getMenuTitle(),this.render(this.createMenuOpts(t)),null===(s=this.menu.querySelector("li"))||void 0===s||s.focus()}createTvMainMenuOpts(){return[{text:this.player.i18n("cc.tracks","Tracks"),onclick:this.createMenu.bind(this,g.tracks)},{text:this.player.i18n("cc.options","Options"),onclick:this.createMenu.bind(this,g.style)}]}createTracksMenuOpts(){return Array.isArray(null==this?void 0:this.tracks)?this.tracks.map((e,t)=>({text:e.text,onclick:()=>{e.onclick(),this.selectedTrackIdx=this.selectedTrackIdx===t?-1:t},selected:this.selectedTrackIdx===t})):[]}createStyleMenuOpts(){const e=Object.keys(this.styleOpts).map(e=>({text:e,onclick:this.createMenu.bind(this,g.styleOpt,e)}));return e.push({text:this.player.i18n("cc.reset","Reset"),onclick:()=>Object.values(this.styleOpts).forEach(e=>e.selected=e.default_value)}),e}createStylePropertyMenuOpts(e){return e.labels.map((t,s)=>({text:t,onclick:()=>{e.selected=e.values[s]},selected:s===e.values.indexOf(e.selected)}))}select_item(e){if(this.state!==g.style)return this.state===g.styleOpt?super.select_item(e):void this.options.forEach((t,s)=>{t.classList.toggle(l,s===e&&!t.classList.contains(l))})}}class FlowplayerIcon extends FlowplayerComponent{constructor(e,t){super(e),this.classList.add("fp-icon",t.name),t.title&&this.setAttribute("title",t.title),t.title&&this.setAttribute("aria-label",t.title),t.translation_key&&this.setAttribute("aria-label",e.i18n(t.translation_key)),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}function k(e){return!document.fullscreenEnabled&&"function"==typeof e.webkitEnterFullScreen&&"function"==typeof e.webkitExitFullScreen}const x="subs:tracks",E="subs:change";var A,w=Object.freeze({__proto__:null,TRACK_UPDATED:"tracks:text:updated",TRACKS:x,SWITCH:E,CUES_PARSED:"cues:parsed",TEXT_TRACKS:"tracks:text:all"});function _(e,t){if(function(e){return Object.values(A).includes(e)}(t=t||A.Anonymous))return e instanceof HTMLVideoElement&&(e.poster="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),"crossOrigin"in e?e.crossOrigin=t:e.setAttribute("crossorigin",t),e}function T(e){const t=document.createElement("a");return t.href=e,t.origin}function C(e,t){const n=document.createElement("track");n.className="fp-track renderable",n.kind=t.kind||"captions",n.label=t.label||t.lang||"",n.lang=t.lang||"",n.id=["fp",t.lang].join("-");const i=n.track;return i.removeCue=s,"string"!=typeof t.crossorigin&&function(e,t){try{return e.src.startsWith("blob:"),T(e.src)!==T(t)}catch(e){return console.error(e),!0}}(e,t.src)&&(_(e),t.crossorigin=e.getAttribute("crossorigin")),"crossorigin"in t&&_(e,t.crossorigin),Object.keys(t).forEach(e=>{"default"!==e&&(n[e]=t[e])}),i.mode=t.default?"hidden":"disabled",e.appendChild(n),n}!function(e){e.Anonymous="anonymous",e.UseCredentials="use-credentials",e.Empty=""}(A||(A={}));const O={translation_key:"cc.menu_title",name:"fp-subtitles-menu"},S={name:"fp-menu-back"};var L;const M=((L=class Subtitles{constructor(e){r(e,"flowplayer-subtitles-menu",FlowplayerSubtitlesMenu),r(e,"flowplayer-subs-menu-icon",class extends FlowplayerIcon{constructor(e){super(e,O)}}),r(e,"flowplayer-menu-back",class extends FlowplayerIcon{constructor(e){super(e,S)}})}init(r,l,c){var u,d;const p=i(c,"flowplayer-subtitles-menu");p instanceof FlowplayerSubtitlesMenu&&p.setMenuAttrs({class:"fp-cc",summaryTitle:c.i18n("cc.button","CC"),menuTitle:c.i18n("cc.menu_title","Subtitles"),options_event:(null===(u=r.subtitles)||void 0===u?void 0:u.native)?x:void 0,item_selected_event:(null===(d=r.subtitles)||void 0===d?void 0:d.native)?E:void 0});const m=function(e){const t=document.createElement("div");return t.classList.add("fp-captions"),t.ontouchend=t=>e.emit(t.type),t.onclick=t=>e.emit(t.type),t}(c);let h,f=[],y=[];function v(){return Array.from(c.textTracks).filter(e=>~["captions","subtitles","descriptions"].indexOf(e.kind)&&!e.removed&&e.label)}function b(){return v().find(e=>e.is_active)}function g(e){Array.from(e.querySelectorAll("track")).forEach(t=>{["captions","subtitles","descriptions"].includes(t.kind)&&e.removeChild(t)})}function A(e,t,s){a(t,x,s.map((function(t){return{text:t.label,onclick:w.bind(0,e,t)}})));const n=b();return n?v().find(e=>e===n)?void a(t,E,{selected_index:s.indexOf(n)}):_():e.emit("tracks:text:updated")}function w(e,t){var s,n;if(t==b())return _();_(),t.is_hls_embedded&&"number"==typeof t.track_id&&e.hls&&(e.hls.subtitleTrack=t.track_id),t.mode=(null===(s=e.opts.subtitles)||void 0===s?void 0:s.native)?"showing":"hidden",t.is_active=!0,e.emit("tracks:text:updated",t),(null===(n=e.opts.subtitles)||void 0===n?void 0:n.native)||e.emit("cuechange",{track:t})}function _(){const e=b();e&&(c.emit("tracks:text:updated"),e.mode="disabled",e.is_active=!1,t(m,[]))}!function(e){if(!k(e))return;e.on("webkitbeginfullscreen",()=>{const e=b();e&&(e.mode="showing")}),e.on("webkitendfullscreen",()=>{var t;const s=v().find(e=>"showing"===e.mode);s&&!(null===(t=e.opts.subtitles)||void 0===t?void 0:t.native)&&(s.mode="hidden"),s!==b()&&(s?w(e,s):_(),a(p,E,{selected_index:s?y.indexOf(s):-1}))})}(c),c.on("mount",(function(){var e,t;const s=o(c,"flowplayer-control");if(!s)return null===(e=o(c,"flowplayer-ui"))||void 0===e?void 0:e.appendChild(m);s.insertAdjacentElement("beforebegin",m),null===(t=c.hasState("is-tv")?o(c,"flowplayer-tv-menu"):s)||void 0===t||t.append(p)})),c.on("config",(function(e){var t,s;const n=null===(s=null===(t=e.data)||void 0===t?void 0:t.subtitles)||void 0===s?void 0:s.tracks;n&&f!==n&&(f=n,g(c),y=v(),A(c,p,y),f.forEach(e=>C(c,e)))})),c.on("tracks:text:all",e=>{const t=e.detail.tracks;t!==h&&(h=t,y=y.flatMap(e=>e.is_hls_embedded?(e.removed=!0,[]):e),A(c,p,y),t.filter(e=>{var t,s;return~["subtitles","captions"].indexOf((null==e?void 0:e.kind)||(null===(s=null===(t=null==e?void 0:e.subtitleTrack)||void 0===t?void 0:t.type)||void 0===s?void 0:s.toLocaleLowerCase())||"")}).forEach(e=>{var t,n,i,r,a,o,l;const u=c.addTextTrack("captions"===e.kind?"captions":"subtitles",(null===(t=e.subtitleTrack)||void 0===t?void 0:t.name)||e.label,null===(n=e.subtitleTrack)||void 0===n?void 0:n.lang);u.is_hls_embedded=!0,u.default=void 0!==(null===(i=e.subtitleTrack)||void 0===i?void 0:i.default)?null===(r=e.subtitleTrack)||void 0===r?void 0:r.default:e.default,u.track_id=null!==(o=null===(a=e.subtitleTrack)||void 0===a?void 0:a.id)&&void 0!==o?o:e._id,u.mode=u.default?"hidden":"disabled",u.removeCue=s,u.attr=null===(l=e.subtitleTrack)||void 0===l?void 0:l.attrs}))}),c.on("cues:parsed",e=>{const t=e.detail,s=y.find(e=>e.is_hls_embedded&&!e.removed&&(e.default&&"default"===t.track||e.track_id===t.track||"subtitles"+e.track_id===t.track||"captions"+e.track_id===t.track));s&&t.cues.forEach(e=>s.addCue(e))}),c.textTracks.addEventListener("addtrack",()=>{const e=v();if(y.length===e.length&&y.every((t,s)=>t===e[s]))return;let t=b();if(e.map((function(e){return~["showing","hidden"].indexOf(e.mode)&&(t=e,e.mode="disabled",e.is_active=!1),e.oncuechange=function(t){var s;if(!(e===b()||k(c)&&c.hasState("is-fullscreen")))return e.mode="disabled";(null===(s=r.subtitles)||void 0===s?void 0:s.native)||c.emit(t.type,{track:t.target})},e})),a(p,x,e.map((function(e){return{text:e.label,onclick:w.bind(0,c,e)}}))),y=e,!t)return _();w(c,t),a(p,E,{selected_index:y.indexOf(t)})}),c.on("cuechange",(function(s){var n;const i=null===(n=s.data)||void 0===n?void 0:n.track;if(!i||!["captions","subtitles","descriptions"].includes(i.kind))return;const r=Array.from(e(i,"activeCues",[])).filter((e,t,s)=>t===s.findIndex(t=>e.id===t.id)).sort((e,t)=>"number"!=typeof e.line||"number"!=typeof t.line?0:e.line-t.line);t(m,r)})),c.on(["playlist/advance","src"],e=>{c.currentSrc&&("src"===e.type&&["is-playlist",n].some(e=>c.root.classList.contains(e))||(delete c.opts.subtitles,g(c),f=[],_(),y=[],h=[],v().forEach(e=>e.removed=!0),a(p,x,[])))})}}).pluginName="subtitles",L.events=w,L);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const s=e.flowplayer;return"function"==typeof s?(s(t),t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t),t)}(window,M)}));
@@ -3,8 +3,6 @@
3
3
  import type { BitrateInfo } from 'dashjs';
4
4
  import type { Get } from 'type-fest';
5
5
  import type { Level } from 'hls.js';
6
- import type { MediaKeyFunc } from 'hls.js';
7
- import type { SetFieldType } from 'type-fest';
8
6
  import type { TupleToUnion } from 'type-fest';
9
7
 
10
8
  /* Excluded from this release type: AnyLoader */
@@ -262,41 +260,6 @@ declare const DESTROYED = "is-destroyed";
262
260
 
263
261
  declare const DISABLED = "is-disabled";
264
262
 
265
- /**
266
- * @public
267
- */
268
- declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
269
-
270
- /**
271
- * @public
272
- */
273
- declare type DRMConfiguration = {
274
- license_server: string;
275
- http_headers?: Record<string, string>;
276
- certificate?: string;
277
- vendor?: string | DRMVendorImplementation;
278
- request_media_key_system_access_function?: MediaKeyFunc;
279
- query_params?: Record<string, string>;
280
- };
281
-
282
- /**
283
- * @public
284
- */
285
- declare type DRMSourceConfiguration = {
286
- [keysystem in DRM_KEYSYSTEM]?: DRMConfiguration;
287
- };
288
-
289
- /**
290
- * @public
291
- */
292
- declare type DRMVendorImplementation = {
293
- fairplay_fetch_certificate: (url: string, cb: (certificate_data: Uint8Array) => void) => void;
294
- fairplay_request_license: (url: string, params: {
295
- message: any;
296
- assetId: string;
297
- }, cb: (license_data: Uint8Array) => void) => void;
298
- };
299
-
300
263
  /**
301
264
  * @public
302
265
  */
@@ -523,13 +486,13 @@ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Co
523
486
  * @param selector - query selector of the HTML element where player will render
524
487
  * @param config - Configuration of the flowplayer and the attached plugins
525
488
  */
526
- (selector: string, config?: ConfigWithPlugins): WithOpts<PluginPlayer, ConfigWithPlugins>;
489
+ (selector: string, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>;
527
490
  /**
528
491
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
529
492
  * @param element - HTML element where player will render
530
493
  * @param config - Configuration of the flowplayer and the attached plugins
531
494
  */
532
- (element: HTMLElement, config?: ConfigWithPlugins): WithOpts<PluginPlayer, ConfigWithPlugins>;
495
+ (element: HTMLElement, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>;
533
496
  }
534
497
 
535
498
  /**
@@ -1146,6 +1109,11 @@ declare type PlayerState = FlowplayerStates[keyof FlowplayerStates];
1146
1109
  */
1147
1110
  declare type PlayerWith<T> = T & Player;
1148
1111
 
1112
+ declare type PlayerWithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = Omit<PluginPlayer, "opts" | "setOpts"> & {
1113
+ opts: PluginConfig;
1114
+ setOpts: (config: PluginConfig) => void;
1115
+ };
1116
+
1149
1117
  declare const PLAYING = "is-playing";
1150
1118
 
1151
1119
  /**
@@ -1176,6 +1144,7 @@ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayer ex
1176
1144
  */
1177
1145
  declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1178
1146
  new (umd: FlowplayerUMD, player: Player): Plugin_2<PluginConfig, PluginPlayer>;
1147
+ pluginName: string;
1179
1148
  }
1180
1149
 
1181
1150
  /* Excluded from this release type: PluginRegisteredEventDetail */
@@ -1474,7 +1443,6 @@ declare type SourceObj<T = unknown> = {
1474
1443
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1475
1444
  */
1476
1445
  type?: string;
1477
- drm?: DRMSourceConfiguration;
1478
1446
  } & T;
1479
1447
 
1480
1448
  /**
@@ -1722,6 +1690,4 @@ declare const WILL_PLAY = "will-play";
1722
1690
 
1723
1691
  declare const WILL_SEEK = "will-seek";
1724
1692
 
1725
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1726
-
1727
1693
  export { }
@@ -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.thumbnails=t())}(this,(function(){"use strict";var e;function t(t,n){if(function(t){return Object.values(e).includes(t)}(n=n||e.Anonymous))return t instanceof HTMLVideoElement&&(t.poster="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),"crossOrigin"in t?t.crossOrigin=n:t.setAttribute("crossorigin",n),t}function n(e){const t=document.createElement("a");return t.href=e,t.origin}!function(e){e.Anonymous="anonymous",e.UseCredentials="use-credentials",e.Empty=""}(e||(e={}));function r(e,t){return e.querySelector("track[id='"+t+"']")}function s(e,r){const s=document.createElement("track");return s.src=r,function(e,t){try{return e.src.startsWith("blob:"),n(e.src)!==n(t)}catch(e){return console.error(e),!0}}(e,r)&&(t(e),t(s)),s}var o=Object.freeze({__proto__:null,THUMBNAILS_RENDER:"thumbnails:render",THUMBNAILS_HIDE:"thumbnails:hide"});function i(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}const u=(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 s=window.customElements.get(n);return"function"!=typeof s?r:s})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class FlowplayerThumbnails extends FlowplayerComponent{constructor(e){super(e),this.className="fp-thumbnail-carousel",this.carousel=this.makeCarousel(),this.addEventListener("thumbnails:render",this.renderCarousel.bind(this,e)),this.addEventListener("thumbnails:hide",()=>e.root.classList.remove("with-thumbnails"))}renderCarousel(e,t){const{previous:n,current:r,next:s}=t.detail;e.root.classList.add("with-thumbnails"),n&&this.renderCarouselItem(this.carousel.previous,n),r&&this.renderCarouselItem(this.carousel.current,r),s&&this.renderCarouselItem(this.carousel.next,s)}makeCarousel(){return{previous:this.makeCarouselItem("previous"),current:this.makeCarouselItem("current"),next:this.makeCarouselItem("next")}}makeCarouselItem(e){const t=document.createElement("div");return t.classList.add("thumbnail",e),this.append(t),t}renderCarouselItem(e,t){const n=e.style;n.backgroundImage=`url("${t.url}")`,n.backgroundPositionX="-"+t.x+"px ",n.backgroundPositionY="-"+t.y+"px",n.height=t.h+"px",n.width=t.w+"px"}}function a(e){const t=document.createElement("a");return t.href=e,t}const c=/#xywh=(\d+),(\d+),(\d+),(\d+)$/,l=/^(https:|https:|\/)/;function m(e,t){const n=a(e.src),r=a(t),[s,o,i,u,l]=(r.hash.match(c)||[]).map(e=>parseInt(e,10));return{x:o,y:i,w:u,h:l,url:d(t,n)}}function d(e,t){if(e.match(l))return e;try{return new URL(e,t.href).toString()}catch(e){return""}}const h="is-source-processing";function f(e,t,n){const r=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(r),e}var p;!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const y=((p=class Thumbnails{static activeThumbnails(e,t){var n,s;const o=r(e,"thumbnails");if(!o)return;const i=Array.from(o.track.cues||{length:0}),u=i.find(e=>e.startTime<=t&&t<=e.endTime);if(!u)return{};const a=i.indexOf(u);return{previous:m(o,(null===(n=i[a-1])||void 0===n?void 0:n.text)||""),current:m(o,(null==u?void 0:u.text)||""),next:m(o,(null===(s=i[a+1])||void 0===s?void 0:s.text)||"")}}constructor(e){((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,"flowplayer-thumbnails-carousel",FlowplayerThumbnails)}init(e,t,n){const o=i(n,"flowplayer-ui"),a=u(n,"flowplayer-thumbnails-carousel"),c=i(n,"flowplayer-control");n.reaper&&o&&c&&(o.insertBefore(a,c),n.once("mount",()=>{this.attachTimelineListeners(n,a)}),n.textTracks.addEventListener("addtrack",(function(e){const t=e.track;"thumbnails"===(null==t?void 0:t.id)&&(t.mode="hidden")})),n.on("config",(function(){var t;const r=null===(t=null==e?void 0:e.thumbnails)||void 0===t?void 0:t.src;if("string"==typeof r)return function(e,t){if(function(e,t){return e.querySelector("track[src='"+t+"']")}(e,t))return;const n=s(e,t);return n.kind="metadata",n.id="thumbnails",n.src=t,e.append(n),n}(n,r)})),n.on(["playlist/advance","src"],t=>{n.currentSrc&&("src"===t.type&&["is-playlist",h].some(e=>n.root.classList.contains(e))||(delete e.thumbnails,function(e){const t=r(e,"thumbnails");t&&t.remove()}(n)))}))}attachTimelineListeners(e,t){e.on("timeline/gesture/move",({data:n})=>{const r=null==n?void 0:n.percent;if("number"!=typeof r)return;if(!Number.isFinite(e.duration))return;const s=Math.max(0,Math.min(e.duration,e.duration*(r/100))),o=p.activeThumbnails(e,s);o&&requestAnimationFrame(()=>f(t,"thumbnails:render",Object.assign(Object.assign({},o),{timestamp:s})))}),e.on("timeline/gesture/end",()=>{e.root.classList.contains("with-thumbnails")&&f(t,"thumbnails:hide")})}}).events=o,p);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,y)}));
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.thumbnails=t())}(this,(function(){"use strict";var e;function t(t,n){if(function(t){return Object.values(e).includes(t)}(n=n||e.Anonymous))return t instanceof HTMLVideoElement&&(t.poster="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),"crossOrigin"in t?t.crossOrigin=n:t.setAttribute("crossorigin",n),t}function n(e){const t=document.createElement("a");return t.href=e,t.origin}!function(e){e.Anonymous="anonymous",e.UseCredentials="use-credentials",e.Empty=""}(e||(e={}));function r(e,t){return e.querySelector("track[id='"+t+"']")}function s(e,r){const s=document.createElement("track");return s.src=r,function(e,t){try{return e.src.startsWith("blob:"),n(e.src)!==n(t)}catch(e){return console.error(e),!0}}(e,r)&&(t(e),t(s)),s}var o=Object.freeze({__proto__:null,THUMBNAILS_RENDER:"thumbnails:render",THUMBNAILS_HIDE:"thumbnails:hide"});function i(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}const u=(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 s=window.customElements.get(n);return"function"!=typeof s?r:s})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class FlowplayerThumbnails extends FlowplayerComponent{constructor(e){super(e),this.className="fp-thumbnail-carousel",this.carousel=this.makeCarousel(),this.addEventListener("thumbnails:render",this.renderCarousel.bind(this,e)),this.addEventListener("thumbnails:hide",()=>e.root.classList.remove("with-thumbnails"))}renderCarousel(e,t){const{previous:n,current:r,next:s}=t.detail;e.root.classList.add("with-thumbnails"),n&&this.renderCarouselItem(this.carousel.previous,n),r&&this.renderCarouselItem(this.carousel.current,r),s&&this.renderCarouselItem(this.carousel.next,s)}makeCarousel(){return{previous:this.makeCarouselItem("previous"),current:this.makeCarouselItem("current"),next:this.makeCarouselItem("next")}}makeCarouselItem(e){const t=document.createElement("div");return t.classList.add("thumbnail",e),this.append(t),t}renderCarouselItem(e,t){const n=e.style;n.backgroundImage=`url("${t.url}")`,n.backgroundPositionX="-"+t.x+"px ",n.backgroundPositionY="-"+t.y+"px",n.height=t.h+"px",n.width=t.w+"px"}}function a(e){const t=document.createElement("a");return t.href=e,t}const c=/#xywh=(\d+),(\d+),(\d+),(\d+)$/,l=/^(https:|https:|\/)/;function m(e,t){const n=a(e.src),r=a(t),[s,o,i,u,l]=(r.hash.match(c)||[]).map(e=>parseInt(e,10));return{x:o,y:i,w:u,h:l,url:d(t,n)}}function d(e,t){if(e.match(l))return e;try{return new URL(e,t.href).toString()}catch(e){return""}}const h="is-source-processing";function f(e,t,n){const r=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(r),e}var p;!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const y=((p=class Thumbnails{static activeThumbnails(e,t){var n,s;const o=r(e,"thumbnails");if(!o)return;const i=Array.from(o.track.cues||{length:0}),u=i.find(e=>e.startTime<=t&&t<=e.endTime);if(!u)return{};const a=i.indexOf(u);return{previous:m(o,(null===(n=i[a-1])||void 0===n?void 0:n.text)||""),current:m(o,(null==u?void 0:u.text)||""),next:m(o,(null===(s=i[a+1])||void 0===s?void 0:s.text)||"")}}constructor(e){((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,"flowplayer-thumbnails-carousel",FlowplayerThumbnails)}init(e,t,n){const o=i(n,"flowplayer-ui"),a=u(n,"flowplayer-thumbnails-carousel"),c=i(n,"flowplayer-control");n.reaper&&o&&c&&(o.insertBefore(a,c),n.once("mount",()=>{this.attachTimelineListeners(n,a)}),n.textTracks.addEventListener("addtrack",(function(e){const t=e.track;"thumbnails"===(null==t?void 0:t.id)&&(t.mode="hidden")})),n.on("config",(function(){var t;const r=null===(t=null==e?void 0:e.thumbnails)||void 0===t?void 0:t.src;if("string"==typeof r)return function(e,t){if(function(e,t){return e.querySelector("track[src='"+t+"']")}(e,t))return;const n=s(e,t);return n.kind="metadata",n.id="thumbnails",n.src=t,e.append(n),n}(n,r)})),n.on(["playlist/advance","src"],t=>{n.currentSrc&&("src"===t.type&&["is-playlist",h].some(e=>n.root.classList.contains(e))||(delete e.thumbnails,function(e){const t=r(e,"thumbnails");t&&t.remove()}(n)))}))}attachTimelineListeners(e,t){e.on("timeline/gesture/move",({data:n})=>{const r=null==n?void 0:n.percent;if("number"!=typeof r)return;if(!Number.isFinite(e.duration))return;const s=Math.max(0,Math.min(e.duration,e.duration*(r/100))),o=p.activeThumbnails(e,s);o&&requestAnimationFrame(()=>f(t,"thumbnails:render",Object.assign(Object.assign({},o),{timestamp:s})))}),e.on("timeline/gesture/end",()=>{e.root.classList.contains("with-thumbnails")&&f(t,"thumbnails:hide")})}}).pluginName="thumbnails",p.events=o,p);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,y)}));
@@ -3,8 +3,6 @@
3
3
  import type { BitrateInfo } from 'dashjs';
4
4
  import type { Get } from 'type-fest';
5
5
  import type { Level } from 'hls.js';
6
- import type { MediaKeyFunc } from 'hls.js';
7
- import type { SetFieldType } from 'type-fest';
8
6
  import type { TupleToUnion } from 'type-fest';
9
7
 
10
8
  /* Excluded from this release type: AnyLoader */
@@ -262,41 +260,6 @@ declare const DESTROYED = "is-destroyed";
262
260
 
263
261
  declare const DISABLED = "is-disabled";
264
262
 
265
- /**
266
- * @public
267
- */
268
- declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
269
-
270
- /**
271
- * @public
272
- */
273
- declare type DRMConfiguration = {
274
- license_server: string;
275
- http_headers?: Record<string, string>;
276
- certificate?: string;
277
- vendor?: string | DRMVendorImplementation;
278
- request_media_key_system_access_function?: MediaKeyFunc;
279
- query_params?: Record<string, string>;
280
- };
281
-
282
- /**
283
- * @public
284
- */
285
- declare type DRMSourceConfiguration = {
286
- [keysystem in DRM_KEYSYSTEM]?: DRMConfiguration;
287
- };
288
-
289
- /**
290
- * @public
291
- */
292
- declare type DRMVendorImplementation = {
293
- fairplay_fetch_certificate: (url: string, cb: (certificate_data: Uint8Array) => void) => void;
294
- fairplay_request_license: (url: string, params: {
295
- message: any;
296
- assetId: string;
297
- }, cb: (license_data: Uint8Array) => void) => void;
298
- };
299
-
300
263
  /**
301
264
  * @public
302
265
  */
@@ -523,13 +486,13 @@ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Co
523
486
  * @param selector - query selector of the HTML element where player will render
524
487
  * @param config - Configuration of the flowplayer and the attached plugins
525
488
  */
526
- (selector: string, config?: ConfigWithPlugins): WithOpts<PluginPlayer, ConfigWithPlugins>;
489
+ (selector: string, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>;
527
490
  /**
528
491
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
529
492
  * @param element - HTML element where player will render
530
493
  * @param config - Configuration of the flowplayer and the attached plugins
531
494
  */
532
- (element: HTMLElement, config?: ConfigWithPlugins): WithOpts<PluginPlayer, ConfigWithPlugins>;
495
+ (element: HTMLElement, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>;
533
496
  }
534
497
 
535
498
  /**
@@ -1146,6 +1109,11 @@ declare type PlayerState = FlowplayerStates[keyof FlowplayerStates];
1146
1109
  */
1147
1110
  declare type PlayerWith<T> = T & Player;
1148
1111
 
1112
+ declare type PlayerWithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = Omit<PluginPlayer, "opts" | "setOpts"> & {
1113
+ opts: PluginConfig;
1114
+ setOpts: (config: PluginConfig) => void;
1115
+ };
1116
+
1149
1117
  declare const PLAYING = "is-playing";
1150
1118
 
1151
1119
  /**
@@ -1176,6 +1144,7 @@ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayer ex
1176
1144
  */
1177
1145
  declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1178
1146
  new (umd: FlowplayerUMD, player: Player): Plugin_2<PluginConfig, PluginPlayer>;
1147
+ pluginName: string;
1179
1148
  }
1180
1149
 
1181
1150
  /* Excluded from this release type: PluginRegisteredEventDetail */
@@ -1474,7 +1443,6 @@ declare type SourceObj<T = unknown> = {
1474
1443
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1475
1444
  */
1476
1445
  type?: string;
1477
- drm?: DRMSourceConfiguration;
1478
1446
  } & T;
1479
1447
 
1480
1448
  /**
@@ -1710,6 +1678,4 @@ declare const WILL_PLAY = "will-play";
1710
1678
 
1711
1679
  declare const WILL_SEEK = "will-seek";
1712
1680
 
1713
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1714
-
1715
1681
  export { }
package/plugins/tizen.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.tizen=t())}(this,(function(){"use strict";var e={BACK:"Back",BACK1:"XF86Back",EXIT:"Exit",ENTER:"Enter",PLAY:"MediaPlay",PAUSE:"MediaPause",REWIND:"MediaRewind",FORWARD:"MediaFastForward",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown"};const t="is-hovered",s=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const n=window.customElements.get(t);if(!n)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?n:i})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class TvMenu extends FlowplayerComponent{constructor(e){super(e),this.classList.add("tv-menu"),e.on("src",()=>this.classList.remove("is-open"))}open(){var e;this.player.emit("tv-menu:will-open"),this.classList.add("is-open"),null===(e=this.getMenus()[0].querySelector("li"))||void 0===e||e.focus()}close(){const e=new CustomEvent("tv-menu:will-close",{cancelable:!0});this.player.dispatchEvent(e),e.defaultPrevented||this.classList.remove("is-open")}append(e){super.append(e.menu)}is_empty(){return!this.getMenus().length}find_focusable_menu(e,t){const s=this.getMenus();return(t?s:s.slice(0).reverse()).find((t,s,n)=>s>n.indexOf(e))}getMenus(){return Array.from(this.children).filter(e=>"none"!==e.style.display)}}const n="is-tv-seeking";let i=void 0;function o(e,t){e.enqueueSeek(t)&&function(e){e.setState("is-kb-active",!0),clearTimeout(i),i=setTimeout((function(){e.setState("is-kb-active",!1)}),2500)}(e)}var r;const a=((r=class Tizen extends class TvPlugin{constructor(e){this.umd=e,this.should_restart=!1,this.previous_current_time=0,((e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)})(e,"flowplayer-tv-menu",TvMenu)}init(e,t,n){n.setState("is-tv",!0),this.menu=s(n,"flowplayer-tv-menu"),t.append(this.menu)}keydown_listener(e,t,s,n,i){const o=this.is_linearAd_on(s);return o||e!==t.ARROW_UP||n.classList.contains("is-open")||n.is_empty()?!o&&n.classList.contains("is-open")?this.menu_handler(e,t,n):void this.main_handler(e,t,s,o,i):n.open()}menu_handler(e,t,s){var n,i,o;if([t.BACK,t.BACK1,t.EXIT].includes(e))return s.close();if([t.ARROW_UP,t.ARROW_DOWN,t.ARROW_RIGHT,t.ARROW_LEFT,t.ENTER].includes(e)){const r=document.activeElement,a=null===(n=document.activeElement)||void 0===n?void 0:n.closest(".fp-menu");if(!r||!a)return;if(e===t.ENTER)return r.dispatchEvent(new Event("click"));if(e===t.ARROW_DOWN&&r.nextSibling)return r.nextSibling.focus();if(e===t.ARROW_UP&&r.previousSibling)return r.previousSibling.focus();if([t.ARROW_RIGHT,t.ARROW_LEFT].includes(e))return null===(o=null===(i=s.find_focusable_menu(a,e===t.ARROW_RIGHT))||void 0===i?void 0:i.querySelector("li"))||void 0===o?void 0:o.focus()}}main_handler(e,t,s,n,i){switch(e){case t.ENTER:return this.on_enter(s,n);case t.PLAY:return this.on_play(s,n);case t.PAUSE:return s.togglePlay(!1);case t.FORWARD:case t.ARROW_RIGHT:return this.on_seek(s,i||10,n);case t.REWIND:case t.ARROW_LEFT:return this.on_seek(s,-(i||10),n);case t.BACK:case t.BACK2:case t.BACK1:case t.EXIT:return this.on_exit(s,n);case t.ARROW_DOWN:return this.on_arrow_down(s,n)}}on_play(e,s){return s?e.togglePlay(!0):(this.is_live_status_focused()&&!e.hasState(t)&&this.live_status_toggle_focus(e,!1),e.hasState(n)?void this.on_seek_end(e,!1):e.togglePlay(!0))}on_enter(e,t){var s;return t?e.togglePlay():this.is_live_status_focused()?(null===(s=e.root.querySelector(".fp-live-status"))||void 0===s||s.dispatchEvent(new Event("click")),this.live_status_toggle_focus(e,!1)):e.hasState(n)?this.on_seek_end(e,!1):e.togglePlay()}on_exit(e,s){return s?e.emit("fullscreen:exit"):this.is_live_status_focused()?this.live_status_toggle_focus(e,!1):e.hasState(n)?this.on_seek_end(e,!0):e.hasState(t)?e.setState(t,!1):e.emit("fullscreen:exit")}on_arrow_down(e,s){if(clearTimeout(this.hover_timeout),this.hover_timeout=setTimeout(()=>{e.setState(t,!1),this.live_status_toggle_focus(e,!1)},2e3),!e.hasState(t)&&!e.hasState("is-paused"))return e.setState(t,!0);s||!e.hasState("is-live")||e.hasState("no-timeline")||this.live_status_toggle_focus(e,!0)}on_seek(e,t,s){s||e.hasState("is-live")&&e.hasState("no-timeline")||(e.hasState(n)||(this.should_restart=!e.hasState("is-paused"),this.previous_current_time=e.currentTime),e.paused||e.togglePlay(!1),e.setState(n,!0),o(e,t))}on_seek_end(e,t){e.setState(n,!1),t&&(e.currentTime=this.previous_current_time),t&&!this.should_restart||e.togglePlay(!0)}live_status_toggle_focus(e,t){const s=e.root.querySelector(".fp-live-status");s&&(t?s.focus():s.blur())}is_live_status_focused(){var e;const t=document.activeElement;return null===(e=null==t?void 0:t.classList)||void 0===e?void 0:e.contains("fp-live-status")}is_linearAd_on(e){var t,s;return!(!e.hasState("ad-paused")&&!e.hasState("ad-playing")||!(null===(s=null===(t=null==e?void 0:e.ads)||void 0===t?void 0:t.adapter)||void 0===s?void 0:s._adLinear))}}{init(t,s,n){(function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",s=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),n=/Android/.test(t)&&!/Firefox/.test(t),i=/^((?!chrome|android).)*safari/i.test(t),o=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),r=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),a=/edg/i.test(t),u=/opr|opera/i.test(t),l=/SamsungBrowser/.test(t),c=l&&/SMART-TV/.test(t);return{controls:!s,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:n,iphone:s,safari:i,edge:a,opera:u,chrome:o,firefox:r,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:l,samsung_tv:l&&c,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}})().tizen&&(super.init(t,s,n),document.addEventListener("keydown",s=>{setTimeout(()=>{var i;!s.defaultPrevented&&Object.values(e).includes(s.key)&&this.keydown_listener(s.key,e,n,this.menu,null===(i=t.tizen)||void 0===i?void 0:i.seek_step)},0)}))}}).events={EXIT_FULLSCREEN:"fullscreen:exit"},r);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const s=e.flowplayer;return"function"==typeof s?(s(t),t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t),t)}(window,a)}));
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.tizen=t())}(this,(function(){"use strict";var e={BACK:"Back",BACK1:"XF86Back",EXIT:"Exit",ENTER:"Enter",PLAY:"MediaPlay",PAUSE:"MediaPause",REWIND:"MediaRewind",FORWARD:"MediaFastForward",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown"};const t="is-hovered",s=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const n=window.customElements.get(t);if(!n)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?n:i})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class TvMenu extends FlowplayerComponent{constructor(e){super(e),this.classList.add("tv-menu"),e.on("src",()=>this.classList.remove("is-open"))}open(){var e;this.player.emit("tv-menu:will-open"),this.classList.add("is-open"),null===(e=this.getMenus()[0].querySelector("li"))||void 0===e||e.focus()}close(){const e=new CustomEvent("tv-menu:will-close",{cancelable:!0});this.player.dispatchEvent(e),e.defaultPrevented||this.classList.remove("is-open")}append(e){super.append(e.menu)}is_empty(){return!this.getMenus().length}find_focusable_menu(e,t){const s=this.getMenus();return(t?s:s.slice(0).reverse()).find((t,s,n)=>s>n.indexOf(e))}getMenus(){return Array.from(this.children).filter(e=>"none"!==e.style.display)}}const n="is-tv-seeking";let i=void 0;function o(e,t){e.enqueueSeek(t)&&function(e){e.setState("is-kb-active",!0),clearTimeout(i),i=setTimeout((function(){e.setState("is-kb-active",!1)}),2500)}(e)}var r;const a=((r=class Tizen extends class TvPlugin{constructor(e){this.umd=e,this.should_restart=!1,this.previous_current_time=0,((e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)})(e,"flowplayer-tv-menu",TvMenu)}init(e,t,n){n.setState("is-tv",!0),this.menu=s(n,"flowplayer-tv-menu"),t.append(this.menu)}keydown_listener(e,t,s,n,i){const o=this.is_linearAd_on(s);return o||e!==t.ARROW_UP||n.classList.contains("is-open")||n.is_empty()?!o&&n.classList.contains("is-open")?this.menu_handler(e,t,n):void this.main_handler(e,t,s,o,i):n.open()}menu_handler(e,t,s){var n,i,o;if([t.BACK,t.BACK1,t.EXIT].includes(e))return s.close();if([t.ARROW_UP,t.ARROW_DOWN,t.ARROW_RIGHT,t.ARROW_LEFT,t.ENTER].includes(e)){const r=document.activeElement,a=null===(n=document.activeElement)||void 0===n?void 0:n.closest(".fp-menu");if(!r||!a)return;if(e===t.ENTER)return r.dispatchEvent(new Event("click"));if(e===t.ARROW_DOWN&&r.nextSibling)return r.nextSibling.focus();if(e===t.ARROW_UP&&r.previousSibling)return r.previousSibling.focus();if([t.ARROW_RIGHT,t.ARROW_LEFT].includes(e))return null===(o=null===(i=s.find_focusable_menu(a,e===t.ARROW_RIGHT))||void 0===i?void 0:i.querySelector("li"))||void 0===o?void 0:o.focus()}}main_handler(e,t,s,n,i){switch(e){case t.ENTER:return this.on_enter(s,n);case t.PLAY:return this.on_play(s,n);case t.PAUSE:return s.togglePlay(!1);case t.FORWARD:case t.ARROW_RIGHT:return this.on_seek(s,i||10,n);case t.REWIND:case t.ARROW_LEFT:return this.on_seek(s,-(i||10),n);case t.BACK:case t.BACK2:case t.BACK1:case t.EXIT:return this.on_exit(s,n);case t.ARROW_DOWN:return this.on_arrow_down(s,n)}}on_play(e,s){return s?e.togglePlay(!0):(this.is_live_status_focused()&&!e.hasState(t)&&this.live_status_toggle_focus(e,!1),e.hasState(n)?void this.on_seek_end(e,!1):e.togglePlay(!0))}on_enter(e,t){var s;return t?e.togglePlay():this.is_live_status_focused()?(null===(s=e.root.querySelector(".fp-live-status"))||void 0===s||s.dispatchEvent(new Event("click")),this.live_status_toggle_focus(e,!1)):e.hasState(n)?this.on_seek_end(e,!1):e.togglePlay()}on_exit(e,s){return s?e.emit("fullscreen:exit"):this.is_live_status_focused()?this.live_status_toggle_focus(e,!1):e.hasState(n)?this.on_seek_end(e,!0):e.hasState(t)?e.setState(t,!1):e.emit("fullscreen:exit")}on_arrow_down(e,s){if(clearTimeout(this.hover_timeout),this.hover_timeout=setTimeout(()=>{e.setState(t,!1),this.live_status_toggle_focus(e,!1)},2e3),!e.hasState(t)&&!e.hasState("is-paused"))return e.setState(t,!0);s||!e.hasState("is-live")||e.hasState("no-timeline")||this.live_status_toggle_focus(e,!0)}on_seek(e,t,s){s||e.hasState("is-live")&&e.hasState("no-timeline")||(e.hasState(n)||(this.should_restart=!e.hasState("is-paused"),this.previous_current_time=e.currentTime),e.paused||e.togglePlay(!1),e.setState(n,!0),o(e,t))}on_seek_end(e,t){e.setState(n,!1),t&&(e.currentTime=this.previous_current_time),t&&!this.should_restart||e.togglePlay(!0)}live_status_toggle_focus(e,t){const s=e.root.querySelector(".fp-live-status");s&&(t?s.focus():s.blur())}is_live_status_focused(){var e;const t=document.activeElement;return null===(e=null==t?void 0:t.classList)||void 0===e?void 0:e.contains("fp-live-status")}is_linearAd_on(e){var t,s;return!(!e.hasState("ad-paused")&&!e.hasState("ad-playing")||!(null===(s=null===(t=null==e?void 0:e.ads)||void 0===t?void 0:t.adapter)||void 0===s?void 0:s._adLinear))}}{init(t,s,n){(function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",s=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),n=/Android/.test(t)&&!/Firefox/.test(t),i=/^((?!chrome|android).)*safari/i.test(t),o=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),r=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),a=/edg/i.test(t),u=/opr|opera/i.test(t),l=/SamsungBrowser/.test(t),c=l&&/SMART-TV/.test(t);return{controls:!s,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:n,iphone:s,safari:i,edge:a,opera:u,chrome:o,firefox:r,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:l,samsung_tv:l&&c,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}})().tizen&&(super.init(t,s,n),document.addEventListener("keydown",s=>{setTimeout(()=>{var i;!s.defaultPrevented&&Object.values(e).includes(s.key)&&this.keydown_listener(s.key,e,n,this.menu,null===(i=t.tizen)||void 0===i?void 0:i.seek_step)},0)}))}}).pluginName="tizen",r.events={EXIT_FULLSCREEN:"fullscreen:exit"},r);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const s=e.flowplayer;return"function"==typeof s?(s(t),t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t),t)}(window,a)}));
@@ -3,8 +3,6 @@
3
3
  import type { BitrateInfo } from 'dashjs';
4
4
  import type { Get } from 'type-fest';
5
5
  import type { Level } from 'hls.js';
6
- import type { MediaKeyFunc } from 'hls.js';
7
- import type { SetFieldType } from 'type-fest';
8
6
  import type { TupleToUnion } from 'type-fest';
9
7
 
10
8
  /* Excluded from this release type: AnyLoader */
@@ -262,41 +260,6 @@ declare const DESTROYED = "is-destroyed";
262
260
 
263
261
  declare const DISABLED = "is-disabled";
264
262
 
265
- /**
266
- * @public
267
- */
268
- declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
269
-
270
- /**
271
- * @public
272
- */
273
- declare type DRMConfiguration = {
274
- license_server: string;
275
- http_headers?: Record<string, string>;
276
- certificate?: string;
277
- vendor?: string | DRMVendorImplementation;
278
- request_media_key_system_access_function?: MediaKeyFunc;
279
- query_params?: Record<string, string>;
280
- };
281
-
282
- /**
283
- * @public
284
- */
285
- declare type DRMSourceConfiguration = {
286
- [keysystem in DRM_KEYSYSTEM]?: DRMConfiguration;
287
- };
288
-
289
- /**
290
- * @public
291
- */
292
- declare type DRMVendorImplementation = {
293
- fairplay_fetch_certificate: (url: string, cb: (certificate_data: Uint8Array) => void) => void;
294
- fairplay_request_license: (url: string, params: {
295
- message: any;
296
- assetId: string;
297
- }, cb: (license_data: Uint8Array) => void) => void;
298
- };
299
-
300
263
  /**
301
264
  * @public
302
265
  */
@@ -530,13 +493,13 @@ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Co
530
493
  * @param selector - query selector of the HTML element where player will render
531
494
  * @param config - Configuration of the flowplayer and the attached plugins
532
495
  */
533
- (selector: string, config?: ConfigWithPlugins): WithOpts<PluginPlayer, ConfigWithPlugins>;
496
+ (selector: string, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>;
534
497
  /**
535
498
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
536
499
  * @param element - HTML element where player will render
537
500
  * @param config - Configuration of the flowplayer and the attached plugins
538
501
  */
539
- (element: HTMLElement, config?: ConfigWithPlugins): WithOpts<PluginPlayer, ConfigWithPlugins>;
502
+ (element: HTMLElement, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>;
540
503
  }
541
504
 
542
505
  /**
@@ -1155,6 +1118,11 @@ declare type PlayerState = FlowplayerStates[keyof FlowplayerStates];
1155
1118
  */
1156
1119
  declare type PlayerWith<T> = T & Player;
1157
1120
 
1121
+ declare type PlayerWithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = Omit<PluginPlayer, "opts" | "setOpts"> & {
1122
+ opts: PluginConfig;
1123
+ setOpts: (config: PluginConfig) => void;
1124
+ };
1125
+
1158
1126
  declare const PLAYING = "is-playing";
1159
1127
 
1160
1128
  /**
@@ -1185,6 +1153,7 @@ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayer ex
1185
1153
  */
1186
1154
  declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1187
1155
  new (umd: FlowplayerUMD, player: Player): Plugin_2<PluginConfig, PluginPlayer>;
1156
+ pluginName: string;
1188
1157
  }
1189
1158
 
1190
1159
  /* Excluded from this release type: PluginRegisteredEventDetail */
@@ -1483,7 +1452,6 @@ declare type SourceObj<T = unknown> = {
1483
1452
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1484
1453
  */
1485
1454
  type?: string;
1486
- drm?: DRMSourceConfiguration;
1487
1455
  } & T;
1488
1456
 
1489
1457
  /**
@@ -1803,6 +1771,4 @@ declare const WILL_PLAY = "will-play";
1803
1771
 
1804
1772
  declare const WILL_SEEK = "will-seek";
1805
1773
 
1806
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1807
-
1808
1774
  export { }
package/plugins/vtsel.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.vtsel=t())}(this,(function(){"use strict";const e=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const s=window.customElements.get(t);if(!s)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const t="fp-on",n="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.menuHeader=document.createElement("div"),this.menuTitle=document.createElement("h3"),this.olEle=document.createElement("ol"),this.olEle.id=i(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menuHeader.classList.add("fp-menu-header"),this.menuHeader.append(this.menuTitle,this.closeEle),this.menu.classList.add("fp-menu"),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add("fp-menu-container"),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",t=>{if(t.defaultPrevented)return;t.preventDefault();const n=this.menuContainer.open;n||(s(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,e.root.classList.toggle("has-menu-opened",!n),this.summaryEle.setAttribute("aria-expanded",n?"false":"true")}),this.addEventListener("focusin",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","true")}),this.addEventListener("focusout",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","false")}),this.append(this.menuContainer),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("aria-expanded","false"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(t){if(this.className=t.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=t.id||i()),this.summaryEle.setAttribute("aria-label",t.menuTitle||"Menu"),t.summaryTitle&&(this.summaryEle.textContent=t.summaryTitle),t.summaryIcon){const n=e(this.player,t.summaryIcon);n.setAttribute("tabindex",""),this.summaryEle.append(n)}t.menuTitle&&(this.menuTitle.textContent=t.menuTitle),this.menu.classList.toggle("fp-icons",!!t.icons),this.addEventListener(t.options_event,e=>{this.render(e.data)}),t.item_selected_event&&this.addEventListener(t.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.toggle_visibility(!(null==e?void 0:e.length)))}menuOption(e,t){const n=document.createElement("li");n.setAttribute("role","menuitem"),n.setAttribute("aria-selected","false"),n.setAttribute("tabindex","0"),e.icon&&n.append(e.icon);const s=document.createElement("span");s.textContent=e.text,n.append(s),n.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(n),e.selected&&this.select_item(t)}select_item(e){this.options.forEach((n,s)=>{n.classList.toggle(t,s===e)})}unselect_item(){this.options.forEach(e=>{e.classList.remove(t)})}toggle_visibility(e){this.classList.toggle(n,e),this.menu.style.setProperty("display",e?"none":"flex")}}function s(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector("details[open].fp-menu-container");n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}function i(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(s(),this.active_menu=void 0)}));function r(e,t,n){const s=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(s),e}var o;!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}(),function(e){e[e.Idle=0]="Idle",e[e.Receiving=1]="Receiving",e[e.Starting=2]="Starting"}(o||(o={}));var a=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){var n,s,i,r,o;n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var r=o.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return n.alwaysNormalize?(r.path=o.normalizePath(r.path),o.buildURLFromParts(r)):t;var a=o.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var l=s.exec(a.path);a.netLoc=l[1],a.path=l[2]}a.netLoc&&!a.path&&(a.path="/");var c={scheme:a.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(c.netLoc=a.netLoc,"/"!==r.path[0]))if(r.path){var u=a.path,d=u.substring(0,u.lastIndexOf("/")+1)+r.path;c.path=o.normalizePath(d)}else c.path=a.path,r.params||(c.params=a.params,r.query||(c.query=a.query));return null===c.path&&(c.path=n.alwaysNormalize?o.normalizePath(r.path):r.path),o.buildURLFromParts(c)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(i,"");e.length!==(e=e.replace(r,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=o}));const l=/#EXT-X-MEDIA:(.*)/g,c=/(.+?)=(".*?"|.*?)(?:,|$)/g;function u(e,t,n,s){let i=n;const r={name:e,default:n,data:s||[]};return Object.defineProperty(r,"selected",{get:()=>i,set(e){var n;"boolean"==typeof e&&i!==e&&(i&&1===(null===(n=t.tracks)||void 0===n?void 0:n.filter(e=>e.selected).length)||(i=e,e&&t.emit("tracks:video:select",{track:r})))}})}class AttrList{constructor(e){"string"==typeof e&&(e=AttrList.parseAttrList(e)),Object.keys(e).forEach(t=>{e.hasOwnProperty(t)&&("X-"===t.substring(0,2)&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])})}bool(e){return"YES"===this[e]}static parseAttrList(e){let t;const n={};for(c.lastIndex=0;null!==(t=c.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1));n[t[1].trim()]=e}return n}}var d,m=Object.freeze({__proto__:null,PARSE_TRACKS:"parse:video:tracks",VIDEO_TRACK_SELECT:"tracks:video:select",VIDEO_TRACKS:"videoTracks",TRACKS:"video:tracks",SWITCH:"video:update"});const p=((d=class Vtsel{constructor(e){((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,"flowplayer-video-menu",FlowplayerMenu)}init(t,n,s){const i=e(s,"flowplayer-video-menu");i instanceof FlowplayerMenu&&i.setMenuAttrs({summaryTitle:s.i18n("vtsel.button_txt","Video"),menuTitle:s.i18n("vtsel.menu_title","Video Track"),class:"fp-vsel",options_event:d.events.TRACKS,item_selected_event:d.events.SWITCH}),s.on("parse:video:tracks",e=>{const t=e.detail;t&&function(e,t,n){var s,i,r,o,c,d,m;let p,h=0;for(l.lastIndex=0;null!==(p=l.exec(t));){const t=new AttrList(p[1]);if("VIDEO"===t.TYPE){let l=null===(s=e.tracks)||void 0===s?void 0:s.find(e=>e.name===(t.NAME||t.LANGUAGE||"Track "+h));if(l||(l=u(t.NAME||t.LANGUAGE||h+++"",e,t.bool("DEFAULT")),t.bool("DEFAULT")&&(l.data=null===(i=e.hls)||void 0===i?void 0:i.levels.slice(0)),null===(r=e.tracks)||void 0===r||r.push(l)),t.bool("DEFAULT"))continue;const p={details:void 0,audioGroupIds:null===(o=e.hls)||void 0===o?void 0:o.levels[0].audioGroupIds,attrs:{},urlId:0,url:[t.URI?a.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):""],uri:t.URI?a.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):"",level:null===(c=l.data)||void 0===c?void 0:c.length,name:"level "+(null===(d=l.data)||void 0===d?void 0:d.length)};null===(m=l.data)||void 0===m||m.push(p)}}}(s,t.manifest,t.url)}),s.on("loadeddata",()=>{if(s.tracks&&s.tracks.length)return s.emit("videoTracks",s.tracks);s.tracks=s.videoTracks?Array.from(s.videoTracks).map((e,t)=>u(e.label?e.label:"track "+t,s,e.selected)):[u("default",s,!0)],s.emit("videoTracks",s.tracks)}),s.on("mount",(function(){var e;null===(e=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(s,s.hasState("is-tv")?"flowplayer-tv-menu":"flowplayer-control"))||void 0===e||e.append(i)})),s.on("src",()=>{s.tracks=[],r(i,d.events.TRACKS,[])}),s.on("videoTracks",()=>{const e=s.tracks;e&&Array.isArray(e)&&(r(i,d.events.TRACKS,e.map(e=>({text:e.name,onclick:()=>e.selected=!0}))),r(i,d.events.SWITCH,{selected_index:e.findIndex(e=>e.default)}),i instanceof FlowplayerMenu&&i.toggle_visibility((null==e?void 0:e.length)<2))}),s.on("tracks:video:select",e=>{const t=e.detail.track,n=s.tracks;if(!t||!n||!Array.isArray(n))return;if(r(i,d.events.SWITCH,{selected_index:n.indexOf(t)}),!s.opts.is_native||!s.videoTracks)return;s.videoTracks[n.indexOf(t)].selected=!0;const o=n.find(e=>e.selected&&e!==t);o&&(o.selected=!1,s.videoTracks[n.indexOf(o)].selected=!1)}),s.on("rts/status",e=>{var t;const n=e.detail.status,a=e.detail.data;if(n===o.Idle)return r(i,d.events.TRACKS,[]),s.tracks=[];n===o.Receiving&&(null===(t=null==s?void 0:s.tracks)||void 0===t||t.push(u((null==a?void 0:a.sourceId)||"Main",s,!(null==a?void 0:a.sourceId),a)))})}}).events=m,d);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,p)}));
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.vtsel=t())}(this,(function(){"use strict";const e=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const s=window.customElements.get(t);if(!s)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const t="fp-on",n="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.menuHeader=document.createElement("div"),this.menuTitle=document.createElement("h3"),this.olEle=document.createElement("ol"),this.olEle.id=i(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menuHeader.classList.add("fp-menu-header"),this.menuHeader.append(this.menuTitle,this.closeEle),this.menu.classList.add("fp-menu"),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add("fp-menu-container"),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",t=>{if(t.defaultPrevented)return;t.preventDefault();const n=this.menuContainer.open;n||(s(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,e.root.classList.toggle("has-menu-opened",!n),this.summaryEle.setAttribute("aria-expanded",n?"false":"true")}),this.addEventListener("focusin",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","true")}),this.addEventListener("focusout",e=>{const t=e.target;t instanceof HTMLLIElement&&t.setAttribute("aria-selected","false")}),this.append(this.menuContainer),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("aria-expanded","false"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(t){if(this.className=t.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=t.id||i()),this.summaryEle.setAttribute("aria-label",t.menuTitle||"Menu"),t.summaryTitle&&(this.summaryEle.textContent=t.summaryTitle),t.summaryIcon){const n=e(this.player,t.summaryIcon);n.setAttribute("tabindex",""),this.summaryEle.append(n)}t.menuTitle&&(this.menuTitle.textContent=t.menuTitle),this.menu.classList.toggle("fp-icons",!!t.icons),this.addEventListener(t.options_event,e=>{this.render(e.data)}),t.item_selected_event&&this.addEventListener(t.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.toggle_visibility(!(null==e?void 0:e.length)))}menuOption(e,t){const n=document.createElement("li");n.setAttribute("role","menuitem"),n.setAttribute("aria-selected","false"),n.setAttribute("tabindex","0"),e.icon&&n.append(e.icon);const s=document.createElement("span");s.textContent=e.text,n.append(s),n.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(n),e.selected&&this.select_item(t)}select_item(e){this.options.forEach((n,s)=>{n.classList.toggle(t,s===e)})}unselect_item(){this.options.forEach(e=>{e.classList.remove(t)})}toggle_visibility(e){this.classList.toggle(n,e),this.menu.style.setProperty("display",e?"none":"flex")}}function s(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector("details[open].fp-menu-container");n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}function i(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(s(),this.active_menu=void 0)}));function r(e,t,n){const s=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(s),e}var o;!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}(),function(e){e[e.Idle=0]="Idle",e[e.Receiving=1]="Receiving",e[e.Starting=2]="Starting"}(o||(o={}));var a=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){var n,s,i,r,o;n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var r=o.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return n.alwaysNormalize?(r.path=o.normalizePath(r.path),o.buildURLFromParts(r)):t;var a=o.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var l=s.exec(a.path);a.netLoc=l[1],a.path=l[2]}a.netLoc&&!a.path&&(a.path="/");var c={scheme:a.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(c.netLoc=a.netLoc,"/"!==r.path[0]))if(r.path){var u=a.path,d=u.substring(0,u.lastIndexOf("/")+1)+r.path;c.path=o.normalizePath(d)}else c.path=a.path,r.params||(c.params=a.params,r.query||(c.query=a.query));return null===c.path&&(c.path=n.alwaysNormalize?o.normalizePath(r.path):r.path),o.buildURLFromParts(c)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(i,"");e.length!==(e=e.replace(r,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=o}));const l=/#EXT-X-MEDIA:(.*)/g,c=/(.+?)=(".*?"|.*?)(?:,|$)/g;function u(e,t,n,s){let i=n;const r={name:e,default:n,data:s||[]};return Object.defineProperty(r,"selected",{get:()=>i,set(e){var n;"boolean"==typeof e&&i!==e&&(i&&1===(null===(n=t.tracks)||void 0===n?void 0:n.filter(e=>e.selected).length)||(i=e,e&&t.emit("tracks:video:select",{track:r})))}})}class AttrList{constructor(e){"string"==typeof e&&(e=AttrList.parseAttrList(e)),Object.keys(e).forEach(t=>{e.hasOwnProperty(t)&&("X-"===t.substring(0,2)&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])})}bool(e){return"YES"===this[e]}static parseAttrList(e){let t;const n={};for(c.lastIndex=0;null!==(t=c.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1));n[t[1].trim()]=e}return n}}var d,m=Object.freeze({__proto__:null,PARSE_TRACKS:"parse:video:tracks",VIDEO_TRACK_SELECT:"tracks:video:select",VIDEO_TRACKS:"videoTracks",TRACKS:"video:tracks",SWITCH:"video:update"});const p=((d=class Vtsel{constructor(e){((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,"flowplayer-video-menu",FlowplayerMenu)}init(t,n,s){const i=e(s,"flowplayer-video-menu");i instanceof FlowplayerMenu&&i.setMenuAttrs({summaryTitle:s.i18n("vtsel.button_txt","Video"),menuTitle:s.i18n("vtsel.menu_title","Video Track"),class:"fp-vsel",options_event:d.events.TRACKS,item_selected_event:d.events.SWITCH}),s.on("parse:video:tracks",e=>{const t=e.detail;t&&function(e,t,n){var s,i,r,o,c,d,m;let p,h=0;for(l.lastIndex=0;null!==(p=l.exec(t));){const t=new AttrList(p[1]);if("VIDEO"===t.TYPE){let l=null===(s=e.tracks)||void 0===s?void 0:s.find(e=>e.name===(t.NAME||t.LANGUAGE||"Track "+h));if(l||(l=u(t.NAME||t.LANGUAGE||h+++"",e,t.bool("DEFAULT")),t.bool("DEFAULT")&&(l.data=null===(i=e.hls)||void 0===i?void 0:i.levels.slice(0)),null===(r=e.tracks)||void 0===r||r.push(l)),t.bool("DEFAULT"))continue;const p={details:void 0,audioGroupIds:null===(o=e.hls)||void 0===o?void 0:o.levels[0].audioGroupIds,attrs:{},urlId:0,url:[t.URI?a.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):""],uri:t.URI?a.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):"",level:null===(c=l.data)||void 0===c?void 0:c.length,name:"level "+(null===(d=l.data)||void 0===d?void 0:d.length)};null===(m=l.data)||void 0===m||m.push(p)}}}(s,t.manifest,t.url)}),s.on("loadeddata",()=>{if(s.tracks&&s.tracks.length)return s.emit("videoTracks",s.tracks);s.tracks=s.videoTracks?Array.from(s.videoTracks).map((e,t)=>u(e.label?e.label:"track "+t,s,e.selected)):[u("default",s,!0)],s.emit("videoTracks",s.tracks)}),s.on("mount",(function(){var e;null===(e=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(s,s.hasState("is-tv")?"flowplayer-tv-menu":"flowplayer-control"))||void 0===e||e.append(i)})),s.on("src",()=>{s.tracks=[],r(i,d.events.TRACKS,[])}),s.on("videoTracks",()=>{const e=s.tracks;e&&Array.isArray(e)&&(r(i,d.events.TRACKS,e.map(e=>({text:e.name,onclick:()=>e.selected=!0}))),r(i,d.events.SWITCH,{selected_index:e.findIndex(e=>e.default)}),i instanceof FlowplayerMenu&&i.toggle_visibility((null==e?void 0:e.length)<2))}),s.on("tracks:video:select",e=>{const t=e.detail.track,n=s.tracks;if(!t||!n||!Array.isArray(n))return;if(r(i,d.events.SWITCH,{selected_index:n.indexOf(t)}),!s.opts.is_native||!s.videoTracks)return;s.videoTracks[n.indexOf(t)].selected=!0;const o=n.find(e=>e.selected&&e!==t);o&&(o.selected=!1,s.videoTracks[n.indexOf(o)].selected=!1)}),s.on("rts/status",e=>{var t;const n=e.detail.status,a=e.detail.data;if(n===o.Idle)return r(i,d.events.TRACKS,[]),s.tracks=[];n===o.Receiving&&(null===(t=null==s?void 0:s.tracks)||void 0===t||t.push(u((null==a?void 0:a.sourceId)||"Main",s,!(null==a?void 0:a.sourceId),a)))})}}).pluginName="vtsel",d.events=m,d);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,p)}));
@@ -3,8 +3,6 @@
3
3
  import type { BitrateInfo } from 'dashjs';
4
4
  import type { Get } from 'type-fest';
5
5
  import type { Level } from 'hls.js';
6
- import type { MediaKeyFunc } from 'hls.js';
7
- import type { SetFieldType } from 'type-fest';
8
6
  import type { TupleToUnion } from 'type-fest';
9
7
 
10
8
  /* Excluded from this release type: AnyLoader */
@@ -262,41 +260,6 @@ declare const DESTROYED = "is-destroyed";
262
260
 
263
261
  declare const DISABLED = "is-disabled";
264
262
 
265
- /**
266
- * @public
267
- */
268
- declare type DRM_KEYSYSTEM = "com.widevine.alpha" | "com.microsoft.playready" | "org.w3.clearkey" | "com.apple.fps.1_0";
269
-
270
- /**
271
- * @public
272
- */
273
- declare type DRMConfiguration = {
274
- license_server: string;
275
- http_headers?: Record<string, string>;
276
- certificate?: string;
277
- vendor?: string | DRMVendorImplementation;
278
- request_media_key_system_access_function?: MediaKeyFunc;
279
- query_params?: Record<string, string>;
280
- };
281
-
282
- /**
283
- * @public
284
- */
285
- declare type DRMSourceConfiguration = {
286
- [keysystem in DRM_KEYSYSTEM]?: DRMConfiguration;
287
- };
288
-
289
- /**
290
- * @public
291
- */
292
- declare type DRMVendorImplementation = {
293
- fairplay_fetch_certificate: (url: string, cb: (certificate_data: Uint8Array) => void) => void;
294
- fairplay_request_license: (url: string, params: {
295
- message: any;
296
- assetId: string;
297
- }, cb: (license_data: Uint8Array) => void) => void;
298
- };
299
-
300
263
  /**
301
264
  * @public
302
265
  */
@@ -523,13 +486,13 @@ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Co
523
486
  * @param selector - query selector of the HTML element where player will render
524
487
  * @param config - Configuration of the flowplayer and the attached plugins
525
488
  */
526
- (selector: string, config?: ConfigWithPlugins): WithOpts<PluginPlayer, ConfigWithPlugins>;
489
+ (selector: string, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>;
527
490
  /**
528
491
  * Configure flowplayer, it's attached plugins and display flowplayer it in the UI
529
492
  * @param element - HTML element where player will render
530
493
  * @param config - Configuration of the flowplayer and the attached plugins
531
494
  */
532
- (element: HTMLElement, config?: ConfigWithPlugins): WithOpts<PluginPlayer, ConfigWithPlugins>;
495
+ (element: HTMLElement, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>;
533
496
  }
534
497
 
535
498
  /**
@@ -1146,6 +1109,11 @@ declare type PlayerState = FlowplayerStates[keyof FlowplayerStates];
1146
1109
  */
1147
1110
  declare type PlayerWith<T> = T & Player;
1148
1111
 
1112
+ declare type PlayerWithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = Omit<PluginPlayer, "opts" | "setOpts"> & {
1113
+ opts: PluginConfig;
1114
+ setOpts: (config: PluginConfig) => void;
1115
+ };
1116
+
1149
1117
  declare const PLAYING = "is-playing";
1150
1118
 
1151
1119
  /**
@@ -1176,6 +1144,7 @@ declare interface Plugin_2<PluginConfig extends Config = Config, PluginPlayer ex
1176
1144
  */
1177
1145
  declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer extends Player = Player> {
1178
1146
  new (umd: FlowplayerUMD, player: Player): Plugin_2<PluginConfig, PluginPlayer>;
1147
+ pluginName: string;
1179
1148
  }
1180
1149
 
1181
1150
  /* Excluded from this release type: PluginRegisteredEventDetail */
@@ -1474,7 +1443,6 @@ declare type SourceObj<T = unknown> = {
1474
1443
  * the MIME type (example `video/mp4` or `application/x-mpegurl`)
1475
1444
  */
1476
1445
  type?: string;
1477
- drm?: DRMSourceConfiguration;
1478
1446
  } & T;
1479
1447
 
1480
1448
  /**
@@ -1710,6 +1678,4 @@ declare const WILL_PLAY = "will-play";
1710
1678
 
1711
1679
  declare const WILL_SEEK = "will-seek";
1712
1680
 
1713
- declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1714
-
1715
1681
  export { }