@flowplayer/player 3.29.0 → 3.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/core.js +1 -1
  2. package/default.js +1 -1
  3. package/embed.js +2 -2
  4. package/index.d.ts +4 -4
  5. package/package.json +2 -2
  6. package/plugins/ads.d.ts +4 -4
  7. package/plugins/ads.js +2 -2
  8. package/plugins/airplay.d.ts +4 -4
  9. package/plugins/airplay.js +1 -1
  10. package/plugins/analytics.d.ts +4 -4
  11. package/plugins/analytics.js +1 -1
  12. package/plugins/asel.d.ts +4 -4
  13. package/plugins/asel.js +1 -1
  14. package/plugins/audio.d.ts +4 -4
  15. package/plugins/audio.js +1 -1
  16. package/plugins/chapters.d.ts +4 -4
  17. package/plugins/chapters.js +1 -1
  18. package/plugins/chromecast.d.ts +4 -4
  19. package/plugins/chromecast.js +1 -1
  20. package/plugins/comscore.d.ts +4 -4
  21. package/plugins/comscore.js +1 -1
  22. package/plugins/consent.d.ts +4 -4
  23. package/plugins/consent.js +1 -1
  24. package/plugins/context-menu.d.ts +4 -4
  25. package/plugins/context-menu.js +1 -1
  26. package/plugins/cuepoints.d.ts +4 -4
  27. package/plugins/cuepoints.js +1 -1
  28. package/plugins/dash.d.ts +4 -4
  29. package/plugins/dash.js +2 -5
  30. package/plugins/drm.d.ts +4 -4
  31. package/plugins/drm.js +1 -1
  32. package/plugins/endscreen.d.ts +4 -4
  33. package/plugins/endscreen.js +1 -1
  34. package/plugins/fas.d.ts +4 -4
  35. package/plugins/fas.js +1 -1
  36. package/plugins/float-on-scroll.d.ts +4 -4
  37. package/plugins/float-on-scroll.js +1 -1
  38. package/plugins/ga4.d.ts +4 -4
  39. package/plugins/ga4.js +1 -1
  40. package/plugins/gemius.d.ts +4 -4
  41. package/plugins/gemius.js +1 -1
  42. package/plugins/google-analytics.d.ts +4 -4
  43. package/plugins/google-analytics.js +1 -1
  44. package/plugins/hls.d.ts +4 -4
  45. package/plugins/hls.js +1 -1
  46. package/plugins/id3.d.ts +4 -4
  47. package/plugins/id3.js +1 -1
  48. package/plugins/iframe.d.ts +4 -4
  49. package/plugins/iframe.js +1 -1
  50. package/plugins/keyboard.d.ts +4 -4
  51. package/plugins/keyboard.js +1 -1
  52. package/plugins/media-session.d.ts +4 -4
  53. package/plugins/media-session.js +1 -1
  54. package/plugins/message.d.ts +4 -4
  55. package/plugins/message.js +1 -1
  56. package/plugins/ovp.d.ts +10 -4
  57. package/plugins/ovp.js +1 -1
  58. package/plugins/playlist.d.ts +4 -4
  59. package/plugins/playlist.js +1 -1
  60. package/plugins/preview.d.ts +4 -4
  61. package/plugins/preview.js +1 -1
  62. package/plugins/qsel.d.ts +4 -4
  63. package/plugins/qsel.js +1 -1
  64. package/plugins/qul.d.ts +4 -4
  65. package/plugins/qul.js +1 -1
  66. package/plugins/rts.d.ts +4 -4
  67. package/plugins/rts.js +7 -7
  68. package/plugins/share.d.ts +4 -4
  69. package/plugins/share.js +1 -1
  70. package/plugins/speed.d.ts +4 -4
  71. package/plugins/speed.js +1 -1
  72. package/plugins/ssai.d.ts +4 -4
  73. package/plugins/ssai.js +2 -2
  74. package/plugins/subtitles.d.ts +4 -4
  75. package/plugins/subtitles.js +1 -1
  76. package/plugins/thumbnails.d.ts +4 -4
  77. package/plugins/thumbnails.js +1 -1
  78. package/plugins/tizen.d.ts +4 -4
  79. package/plugins/tizen.js +1 -1
  80. package/plugins/vtsel.d.ts +4 -4
  81. package/plugins/vtsel.js +1 -1
  82. package/plugins/webos.d.ts +4 -4
  83. package/plugins/webos.js +1 -1
  84. package/util/loader.d.ts +4 -4
@@ -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,[])))})}}).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)}));
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-tv",i="has-menu-opened",r="is-source-processing",o="mount",a="click",l=(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),c=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};function u(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 d(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){}}();const p="flowplayer-subtitles-menu",m="flowplayer-subs-menu-icon",h="flowplayer-menu-back";class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const f="fp-menu",y="fp-menu-container",v="fp-on",b="fp-invis",g="details[open]."+y;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=E(),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(f),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add(y),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener(a,t=>{if(t.defaultPrevented)return;t.preventDefault();const s=this.menuContainer.open;s||(k(),document.active_menu=this.menuContainer),this.menuContainer.open=!s,e.root.classList.toggle(i,!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||E()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=l(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(a,()=>{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(v,s===e)})}unselect_item(){this.options.forEach(e=>{e.classList.remove(v)})}toggle_visibility(e){this.classList.toggle(b,e),this.menu.style.setProperty("display",e?"none":"flex")}}function k(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const s=e.root.querySelector(g);s&&(s.open=!1,null===(t=s.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle(i,!1))})}function E(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}document.addEventListener(a,function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(k(),this.active_menu=void 0)});const x=["255, 255, 255","255, 255, 0","0, 255, 0","0, 255, 255","0, 0, 255","255, 0, 255","255, 0, 0","0, 0, 0"],A=[.25,.5,.75,1,1.25,1.5,1.75,2,3,4],w=["White","Yellow","Green","Cyan","Blue","Magenta","Red","Black"],_=["Monospaced Serif","Proportional Serif","Monospaced Sans-Serif","Proportional Sans-Serif","Casual","Cursive"],T=["Courier New, monospace","serif","Andale Mono, Lucida Console, monospace","sans-serif","Comic Sans MS, Impact, fantasy","Monotype Corsiva, cursive"],C=["None","Drop shadow","Raised","Depressed","Outline"],O=["","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 S;!function(e){e[e.main=0]="main",e[e.tracks=1]="tracks",e[e.style=2]="style",e[e.styleOpt=3]="styleOpt"}(S||(S={}));class FlowplayerSubtitlesMenu extends FlowplayerMenu{constructor(e){if(super(e),this.state=S.main,this.selectedTrackIdx=-1,this.isTV=!1,this.styleOpts=function(e){return{[e.i18n("cc.properties.fontSize","Font size")]:new StyleOpt(e,A.map(e=>100*e+"%"),A.map(e=>100*e+"%"),"--fp-sub-font-size","100%"),[e.i18n("cc.properties.fontFamily","Font family")]:new StyleOpt(e,_.map(t=>e.i18n(`cc.fontFamily.${t}`,t)),T,"--fp-sub-font-family","sans-serif"),[e.i18n("cc.properties.fontColor","Font color")]:new StyleOpt(e,w.map(t=>e.i18n(`cc.colors.${t}`,t)),x,"--fp-sub-font-color",x[0]),[e.i18n("cc.properties.fontOpacity","Font opacity")]:new StyleOpt(e,A.flatMap(e=>e>1?[]:100*e+"%"),A.flatMap(e=>e>1?[]:e+""),"--fp-sub-font-opacity","1"),[e.i18n("cc.properties.backgroundColor","Background color")]:new StyleOpt(e,w.map(t=>e.i18n(`cc.colors.${t}`,t)),x,"--fp-sub-background-color",x[7]),[e.i18n("cc.properties.backgroundOpacity","Background opacity")]:new StyleOpt(e,A.flatMap(e=>e>1?[]:100*e+"%"),A.flatMap(e=>e>1?[]:e+""),"--fp-sub-background-opacity","0.5"),[e.i18n("cc.properties.characterEdgeStyle","Character edge style")]:new StyleOpt(e,C.map(t=>e.i18n(`cc.edgeStyle.${t}`,t)),O,"--fp-sub-edge-style","")}}(e),e.on(o,()=>{setTimeout(()=>this.isTV=e.hasState(n),0),this.classList.toggle("subs-native",!!e.opt("subtitles.native"))}),e.on(N.events.TRACK_UPDATED,e=>this.summaryEle.classList.toggle("fp-color-text",!!e.detail)),e.opt("subtitles.native"))return;const t=l(this.player,h);t.setAttribute("aria-label","Back to previous menu"),this.menuHeader.prepend(t),t.addEventListener("click",()=>this.navigateBack());const s=l(this.player,m);s.setAttribute("aria-label","Open style menu"),s.addEventListener("click",()=>this.createMenu(S.style)),this.menuHeader.insertBefore(s,this.menuTitle),this.summaryEle.addEventListener("click",()=>{this.menuContainer.open||this.createMenu(S.main)}),this.menu.addEventListener("click",e=>{(e.target===s||e.target===t||this.state!==S.main&&e.target!==this.closeEle)&&e.preventDefault()}),this.addEventListener(N.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?S.tracks:S.main)&&this.createMenu(this.isTV?S.tracks:S.main)}),this.addEventListener(N.events.SWITCH,e=>{this.selectedTrackIdx=e.detail.selected_index,this.state===(this.isTV?S.tracks:S.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(S.main)}),this.player.on(["tv-menu:will-close","keyboard:close:menus"],e=>{var t;this.state!==S.main&&(null===(t=document.activeElement)||void 0===t?void 0:t.closest(`.${f}`))===this.menu&&(this.navigateBack(),e.preventDefault())})}navigateBack(){switch(this.state){case S.style:case S.tracks:return this.createMenu(S.main);case S.styleOpt:return this.createMenu(S.style)}}getMenuTitle(){switch(this.state){case S.main:return this.player.i18n("cc.menu_title","Subtitles");case S.tracks:return this.player.i18n("cc.tracks","Tracks");case S.style:return this.player.i18n("cc.options","Options");default:return""}}createMenuOpts(e){switch(this.state){case S.main:return this.isTV?this.createTvMainMenuOpts():this.createTracksMenuOpts();case S.tracks:return this.createTracksMenuOpts();case S.style:return this.createStyleMenuOpts();case S.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,S.tracks)},{text:this.player.i18n("cc.options","Options"),onclick:this.createMenu.bind(this,S.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,S.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!==S.style)return this.state===S.styleOpt?super.select_item(e):void this.options.forEach((t,s)=>{t.classList.toggle(v,s===e&&!t.classList.contains(v))})}}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 L(e){return!document.fullscreenEnabled&&"function"==typeof e.webkitEnterFullScreen&&"function"==typeof e.webkitExitFullScreen}const M="tracks:text:updated",I="subs:tracks",F="subs:change",P="cues:parsed",H="tracks:text:all";var j,B=Object.freeze({__proto__:null,TRACK_UPDATED:M,TRACKS:I,SWITCH:F,CUES_PARSED:P,TEXT_TRACKS:H});function R(e,t){if(function(e){return Object.values(j).includes(e)}(t=t||j.Anonymous))return e instanceof HTMLVideoElement&&(e.poster="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),"crossOrigin"in e?e.crossOrigin=t:e.setAttribute("crossorigin",t),e}function V(e){const t=document.createElement("a");return t.href=e,t.origin}function D(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:"),V(e.src)!==V(t)}catch(e){return console.error(e),!0}}(e,t.src)&&(R(e),t.crossorigin=e.getAttribute("crossorigin")),"crossorigin"in t&&R(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=""}(j||(j={}));const q={translation_key:"cc.menu_title",name:"fp-subtitles-menu"},z={name:"fp-menu-back"};var K;const N=((K=class Subtitles{constructor(e){c(e,p,FlowplayerSubtitlesMenu),c(e,m,class extends FlowplayerIcon{constructor(e){super(e,q)}}),c(e,h,class extends FlowplayerIcon{constructor(e){super(e,z)}})}init(i,a,c){var m,h;const f=l(c,p);f instanceof FlowplayerSubtitlesMenu&&f.setMenuAttrs({class:"fp-cc",summaryTitle:c.i18n("cc.button","CC"),menuTitle:c.i18n("cc.menu_title","Subtitles"),options_event:(null===(m=i.subtitles)||void 0===m?void 0:m.native)?I:void 0,item_selected_event:(null===(h=i.subtitles)||void 0===h?void 0:h.native)?F:void 0});const y=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 v,b=[],g=[];function k(){return Array.from(c.textTracks).filter(e=>~["captions","subtitles","descriptions"].indexOf(e.kind)&&!e.removed&&e.label)}function E(){return k().find(e=>e.is_active)}function x(e){Array.from(e.querySelectorAll("track")).forEach(t=>{["captions","subtitles","descriptions"].includes(t.kind)&&e.removeChild(t)})}function A(e,t,s){u(t,I,s.map(function(t){return{text:t.label,onclick:w.bind(0,e,t)}}));const n=E();return n?k().find(e=>e===n)?void u(t,F,{selected_index:s.indexOf(n)}):_():e.emit(M)}function w(e,t){var s,n;if(t==E())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(M,t),(null===(n=e.opts.subtitles)||void 0===n?void 0:n.native)||e.emit("cuechange",{track:t})}function _(){const e=E();e&&(c.emit(M),e.mode="disabled",e.is_active=!1,t(y,[]))}!function(e){if(!L(e))return;e.on("webkitbeginfullscreen",()=>{const e=E();e&&(e.mode="showing")}),e.on("webkitendfullscreen",()=>{var t;const s=k().find(e=>"showing"===e.mode);s&&!(null===(t=e.opts.subtitles)||void 0===t?void 0:t.native)&&(s.mode="hidden"),s!==E()&&(s?w(e,s):_(),u(f,F,{selected_index:s?g.indexOf(s):-1}))})}(c),c.on(o,function(){var e,t;const s=d(c,"flowplayer-control");if(!s)return null===(e=d(c,"flowplayer-ui"))||void 0===e?void 0:e.appendChild(y);s.insertAdjacentElement("beforebegin",y),null===(t=c.hasState(n)?d(c,"flowplayer-tv-menu"):s)||void 0===t||t.append(f)}),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&&b!==n&&(b=n,x(c),g=k(),A(c,f,g),b.forEach(e=>D(c,e)))}),c.on(H,e=>{const t=e.detail.tracks;t!==v&&(v=t,g=g.flatMap(e=>e.is_hls_embedded?(e.removed=!0,[]):e),A(c,f,g),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,o,a,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!==(a=null===(o=e.subtitleTrack)||void 0===o?void 0:o.id)&&void 0!==a?a: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(P,e=>{const t=e.detail,s=g.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=k();if(g.length===e.length&&g.every((t,s)=>t===e[s]))return;let t=E();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===E()||L(c)&&c.hasState("is-fullscreen")))return e.mode="disabled";(null===(s=i.subtitles)||void 0===s?void 0:s.native)||c.emit(t.type,{track:t.target})},e}),u(f,I,e.map(function(e){return{text:e.label,onclick:w.bind(0,c,e)}})),g=e,!t)return _();w(c,t),u(f,F,{selected_index:g.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(y,r)}),c.on(["playlist/advance","src"],e=>{t(y,[]),c.currentSrc&&("src"===e.type&&["is-playlist",r].some(e=>c.root.classList.contains(e))||(delete c.opts.subtitles,x(c),b=[],_(),g=[],v=[],k().forEach(e=>e.removed=!0),u(f,I,[])))})}}).pluginName="subtitles",K.events=B,K);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,N)});
@@ -1,6 +1,6 @@
1
- import type { BitrateInfo } from 'dashjs';
2
1
  import type { Get } from 'type-fest';
3
2
  import type { Level } from 'hls.js';
3
+ import type { Representation } from 'dashjs';
4
4
  import type { TupleToUnion } from 'type-fest';
5
5
 
6
6
  /* Excluded from this release type: AnyLoader */
@@ -1466,7 +1466,7 @@ PROGRESS = "progress";
1466
1466
  */
1467
1467
  declare type QselOption = (Level & {
1468
1468
  level: number;
1469
- }) | BitrateInfo | {
1469
+ }) | Representation | {
1470
1470
  name: string | number;
1471
1471
  encodingId: string;
1472
1472
  spatialLayerId: number;
@@ -1514,8 +1514,8 @@ QUALITY_CHANGE = "qualitychange";
1514
1514
  * @public
1515
1515
  */
1516
1516
  declare type QualityChangeEventDetail = {
1517
- before?: Level | BitrateInfo;
1518
- after?: Level | BitrateInfo;
1517
+ before?: Level | Representation;
1518
+ after?: Level | Representation;
1519
1519
  plugin: string;
1520
1520
  automatic: boolean;
1521
1521
  /* Excluded from this release type: downscale */
@@ -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")})}}).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)}));
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={}));const r="thumbnails";function s(e,t){return e.querySelector("track[id='"+t+"']")}function o(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}const i="thumbnails:render",c="thumbnails:hide";var u=Object.freeze({__proto__:null,THUMBNAILS_RENDER:i,THUMBNAILS_HIDE:c});function a(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}const l="flowplayer-thumbnails-carousel",d=(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}}const m="with-thumbnails";class FlowplayerThumbnails extends FlowplayerComponent{constructor(e){super(e),this.className="fp-thumbnail-carousel",this.carousel=this.makeCarousel(),this.addEventListener(i,this.renderCarousel.bind(this,e)),this.addEventListener(c,()=>e.root.classList.remove(m))}renderCarousel(e,t){const{previous:n,current:r,next:s}=t.detail;e.root.classList.add(m),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 f(e){const t=document.createElement("a");return t.href=e,t}const h=/#xywh=(\d+),(\d+),(\d+),(\d+)$/,p=/^(https:|https:|\/)/;function y(e,t){const n=f(e.src),r=f(t),[s,o,i,c,u]=(r.hash.match(h)||[]).map(e=>parseInt(e,10));return{x:o,y:i,w:c,h:u,url:w(t,n)}}function w(e,t){if(e.match(p))return e;try{return new URL(e,t.href).toString()}catch(e){return""}}const A="is-source-processing";function v(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 b;!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 g=((b=class Thumbnails{static activeThumbnails(e,t){var n,o;const i=s(e,r);if(!i)return;const c=Array.from(i.track.cues||{length:0}),u=c.find(e=>e.startTime<=t&&t<=e.endTime);if(!u)return{};const a=c.indexOf(u);return{previous:y(i,(null===(n=c[a-1])||void 0===n?void 0:n.text)||""),current:y(i,(null==u?void 0:u.text)||""),next:y(i,(null===(o=c[a+1])||void 0===o?void 0:o.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,l,FlowplayerThumbnails)}init(e,t,n){const i=a(n,"flowplayer-ui"),c=d(n,l),u=a(n,"flowplayer-control");n.reaper&&i&&u&&(i.insertBefore(c,u),n.once("mount",()=>{this.attachTimelineListeners(n,c)}),n.textTracks.addEventListener("addtrack",function(e){const t=e.track;(null==t?void 0:t.id)===r&&(t.mode="hidden")}),n.on("config",function(){var t;const s=null===(t=null==e?void 0:e.thumbnails)||void 0===t?void 0:t.src;if("string"==typeof s)return function(e,t){if(function(e,t){return e.querySelector("track[src='"+t+"']")}(e,t))return;const n=o(e,t);return n.kind="metadata",n.id=r,n.src=t,e.append(n),n}(n,s)}),n.on(["playlist/advance","src"],t=>{n.currentSrc&&("src"===t.type&&["is-playlist",A].some(e=>n.root.classList.contains(e))||(delete e.thumbnails,function(e){const t=s(e,r);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=b.activeThumbnails(e,s);o&&requestAnimationFrame(()=>v(t,i,Object.assign(Object.assign({},o),{timestamp:s})))}),e.on("timeline/gesture/end",()=>{e.root.classList.contains(m)&&v(t,c)})}}).pluginName="thumbnails",b.events=u,b);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,g)});
@@ -1,6 +1,6 @@
1
- import type { BitrateInfo } from 'dashjs';
2
1
  import type { Get } from 'type-fest';
3
2
  import type { Level } from 'hls.js';
3
+ import type { Representation } from 'dashjs';
4
4
  import type { TupleToUnion } from 'type-fest';
5
5
 
6
6
  /* Excluded from this release type: AnyLoader */
@@ -1466,7 +1466,7 @@ PROGRESS = "progress";
1466
1466
  */
1467
1467
  declare type QselOption = (Level & {
1468
1468
  level: number;
1469
- }) | BitrateInfo | {
1469
+ }) | Representation | {
1470
1470
  name: string | number;
1471
1471
  encodingId: string;
1472
1472
  spatialLayerId: number;
@@ -1514,8 +1514,8 @@ QUALITY_CHANGE = "qualitychange";
1514
1514
  * @public
1515
1515
  */
1516
1516
  declare type QualityChangeEventDetail = {
1517
- before?: Level | BitrateInfo;
1518
- after?: Level | BitrateInfo;
1517
+ before?: Level | Representation;
1518
+ after?: Level | Representation;
1519
1519
  plugin: string;
1520
1520
  automatic: boolean;
1521
1521
  /* Excluded from this release type: downscale */
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)}))}}).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)}));
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="fullscreen:exit",s="flowplayer-tv-menu",n="is-paused",i="is-live",o="no-timeline",r="is-hovered",a=(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}}const u="is-open";class TvMenu extends FlowplayerComponent{constructor(e){super(e),this.classList.add("tv-menu"),e.on("src",()=>this.classList.remove(u))}open(){var e;this.player.emit("tv-menu:will-open"),this.classList.add(u),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(u)}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 l="is-tv-seeking",c="is-kb-active";let d;function _(e,t){e.enqueueSeek(t)&&function(e){e.setState(c,!0),clearTimeout(d),d=setTimeout(function(){e.setState(c,!1)},2500)}(e)}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,s,TvMenu)}init(e,t,n){n.setState("is-tv",!0),this.menu=a(n,s),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(u)||n.is_empty()?!o&&n.classList.contains(u)?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,t){return t?e.togglePlay(!0):(this.is_live_status_focused()&&!e.hasState(r)&&this.live_status_toggle_focus(e,!1),e.hasState(l)?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(l)?this.on_seek_end(e,!1):e.togglePlay()}on_exit(e,s){return s?e.emit(t):this.is_live_status_focused()?this.live_status_toggle_focus(e,!1):e.hasState(l)?this.on_seek_end(e,!0):e.hasState(r)?e.setState(r,!1):e.emit(t)}on_arrow_down(e,t){if(clearTimeout(this.hover_timeout),this.hover_timeout=setTimeout(()=>{e.setState(r,!1),this.live_status_toggle_focus(e,!1)},2e3),!e.hasState(r)&&!e.hasState(n))return e.setState(r,!0);t||!e.hasState(i)||e.hasState(o)||this.live_status_toggle_focus(e,!0)}on_seek(e,t,s){s||e.hasState(i)&&e.hasState(o)||(e.hasState(l)||(this.should_restart=!e.hasState(n),this.previous_current_time=e.currentTime),e.paused||e.togglePlay(!1),e.setState(l,!0),_(e,t))}on_seek_end(e,t){e.setState(l,!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))}}var h;const f=((h=class Tizen extends TvPlugin{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",h.events={EXIT_FULLSCREEN:t},h);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,f)});
@@ -1,6 +1,6 @@
1
- import type { BitrateInfo } from 'dashjs';
2
1
  import type { Get } from 'type-fest';
3
2
  import type { Level } from 'hls.js';
3
+ import type { Representation } from 'dashjs';
4
4
  import type { TupleToUnion } from 'type-fest';
5
5
 
6
6
  /* Excluded from this release type: AnyLoader */
@@ -1475,7 +1475,7 @@ PROGRESS = "progress";
1475
1475
  */
1476
1476
  declare type QselOption = (Level & {
1477
1477
  level: number;
1478
- }) | BitrateInfo | {
1478
+ }) | Representation | {
1479
1479
  name: string | number;
1480
1480
  encodingId: string;
1481
1481
  spatialLayerId: number;
@@ -1523,8 +1523,8 @@ QUALITY_CHANGE = "qualitychange";
1523
1523
  * @public
1524
1524
  */
1525
1525
  declare type QualityChangeEventDetail = {
1526
- before?: Level | BitrateInfo;
1527
- after?: Level | BitrateInfo;
1526
+ before?: Level | Representation;
1527
+ after?: Level | Representation;
1528
1528
  plugin: string;
1529
1529
  automatic: boolean;
1530
1530
  /* Excluded from this release type: downscale */
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 a;!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"}(a||(a={}));var o=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){var n,s,i,r,a;n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=a.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=a.normalizePath(i.path),a.buildURLFromParts(i)}var r=a.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return n.alwaysNormalize?(r.path=a.normalizePath(r.path),a.buildURLFromParts(r)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=s.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var c={scheme:o.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(c.netLoc=o.netLoc,"/"!==r.path[0]))if(r.path){var u=o.path,d=u.substring(0,u.lastIndexOf("/")+1)+r.path;c.path=a.normalizePath(d)}else c.path=o.path,r.params||(c.params=o.params,r.query||(c.query=o.query));return null===c.path&&(c.path=n.alwaysNormalize?a.normalizePath(r.path):r.path),a.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=a}));const l=/#EXT-X-MEDIA:(.*)/g,c=/(.+?)=(".*?"|.*?)(?:,|$)/g;function u(e,t,n,s){let i=n;const r={label: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){var i;const c=e(s,"flowplayer-video-menu");c instanceof FlowplayerMenu&&c.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("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(c)})),s.on("src",()=>{s.tracks=[],r(c,d.events.TRACKS,[])}),s.on("parse:video:tracks",e=>{const t=e.detail;t&&function(e,t,n){var s,i,r,a,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.label===(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===(a=e.hls)||void 0===a?void 0:a.levels[0].audioGroupIds,attrs:{},urlId:0,url:[t.URI?o.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):""],uri:t.URI?o.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)}),null===(i=s.videoTracks)||void 0===i||i.addEventListener("addtrack",()=>{t.is_native&&(s.tracks=Array.from(s.videoTracks||[]).map((e,t)=>u(e.label?e.label:"track "+t,s,e.selected)),s.emit("videoTracks",s.tracks))}),s.on("loadeddata",()=>{var e;if(!t.is_native||!s.videoTracks){if(null===(e=s.tracks)||void 0===e?void 0:e.length)return s.emit("videoTracks",s.tracks);s.tracks=[u("default",s,!0)],s.emit("videoTracks",s.tracks)}}),s.on("videoTracks",()=>{const e=s.tracks;e&&Array.isArray(e)&&(r(c,d.events.TRACKS,e.map(e=>({text:e.label,onclick:()=>e.selected=!0}))),r(c,d.events.SWITCH,{selected_index:e.findIndex(e=>e.default)}),c instanceof FlowplayerMenu&&c.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(c,d.events.SWITCH,{selected_index:n.indexOf(t)}),!s.opts.is_native||!s.videoTracks)return;s.videoTracks[n.indexOf(t)].selected=!0;const i=n.find(e=>e.selected&&e!==t);i&&(i.selected=!1,s.videoTracks[n.indexOf(i)].selected=!1)}),s.on("rts/status",e=>{var t;const n=e.detail.status,i=e.detail.data;if(n===a.Idle)return r(c,d.events.TRACKS,[]),s.tracks=[];n===a.Receiving&&(null===(t=null==s?void 0:s.tracks)||void 0===t||t.push(u((null==i?void 0:i.sourceId)||"Main",s,!(null==i?void 0:i.sourceId),i)))})}}).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)}));
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),t="flowplayer-video-menu";class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const n="click",s="videoTracks",i="tracks:video:select",r="has-menu-opened",a="fp-menu-container",o="fp-on",l="fp-invis",c="details[open]."+a;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(a),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener(n,t=>{if(t.defaultPrevented)return;t.preventDefault();const n=this.menuContainer.open;n||(u(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,e.root.classList.toggle(r,!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||d()),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 s=document.createElement("li");s.setAttribute("role","menuitem"),s.setAttribute("aria-selected","false"),s.setAttribute("tabindex","0"),e.icon&&s.append(e.icon);const i=document.createElement("span");i.textContent=e.text,s.append(i),s.addEventListener(n,()=>{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,n)=>{t.classList.toggle(o,n===e)})}unselect_item(){this.options.forEach(e=>{e.classList.remove(o)})}toggle_visibility(e){this.classList.toggle(l,e),this.menu.style.setProperty("display",e?"none":"flex")}}function u(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector(c);n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle(r,!1))})}function d(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}document.addEventListener(n,function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(u(),this.active_menu=void 0)});function m(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 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){}}(),function(e){e[e.Idle=0]="Idle",e[e.Receiving=1]="Receiving",e[e.Starting=2]="Starting"}(p||(p={}));var h=function(e){var t={exports:{}};return e(t,t.exports),t.exports}(function(e,t){var n,s,i,r,a;n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=a.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=a.normalizePath(i.path),a.buildURLFromParts(i)}var r=a.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return n.alwaysNormalize?(r.path=a.normalizePath(r.path),a.buildURLFromParts(r)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=s.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var c={scheme:o.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(c.netLoc=o.netLoc,"/"!==r.path[0]))if(r.path){var u=o.path,d=u.substring(0,u.lastIndexOf("/")+1)+r.path;c.path=a.normalizePath(d)}else c.path=o.path,r.params||(c.params=o.params,r.query||(c.query=o.query));return null===c.path&&(c.path=n.alwaysNormalize?a.normalizePath(r.path):r.path),a.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=a});const f=/#EXT-X-MEDIA:(.*)/g,v=/(.+?)=(".*?"|.*?)(?:,|$)/g;function y(e,t,n,s){let r=n;const a={label:e,default:n,data:s||[]};return Object.defineProperty(a,"selected",{get:()=>r,set(e){var n;"boolean"==typeof e&&r!==e&&(r&&1===(null===(n=t.tracks)||void 0===n?void 0:n.filter(e=>e.selected).length)||(r=e,e&&t.emit(i,{track:a})))}})}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(v.lastIndex=0;null!==(t=v.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}}const E="parse:video:tracks",g=i,b=s;var L,A=Object.freeze({__proto__:null,PARSE_TRACKS:E,VIDEO_TRACK_SELECT:g,VIDEO_TRACKS:b,TRACKS:"video:tracks",SWITCH:"video:update"});const w=((L=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,t,class extends FlowplayerMenu{})}init(n,r,a){var o;const l=e(a,t);l instanceof FlowplayerMenu&&l.setMenuAttrs({summaryTitle:a.i18n("vtsel.button_txt","Video"),menuTitle:a.i18n("vtsel.menu_title","Video Track"),class:"fp-vsel",options_event:L.events.TRACKS,item_selected_event:L.events.SWITCH}),a.on("mount",function(){var e;null===(e=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(a,a.hasState("is-tv")?"flowplayer-tv-menu":"flowplayer-control"))||void 0===e||e.append(l)}),a.on("src",()=>{a.tracks=[],m(l,L.events.TRACKS,[])}),a.on(E,e=>{const t=e.detail;t&&function(e,t,n){var s,i,r,a,o,l,c;let u,d=0;for(f.lastIndex=0;null!==(u=f.exec(t));){const t=new AttrList(u[1]);if("VIDEO"===t.TYPE){let u=null===(s=e.tracks)||void 0===s?void 0:s.find(e=>e.label===(t.NAME||t.LANGUAGE||"Track "+d));if(u||(u=y(t.NAME||t.LANGUAGE||d+++"",e,t.bool("DEFAULT")),t.bool("DEFAULT")&&(u.data=null===(i=e.hls)||void 0===i?void 0:i.levels.slice(0)),null===(r=e.tracks)||void 0===r||r.push(u)),t.bool("DEFAULT"))continue;const m={details:void 0,audioGroupIds:null===(a=e.hls)||void 0===a?void 0:a.levels[0].audioGroupIds,attrs:{},urlId:0,url:[t.URI?h.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):""],uri:t.URI?h.buildAbsoluteURL(n,t.URI,{alwaysNormalize:!0}):"",level:null===(o=u.data)||void 0===o?void 0:o.length,name:"level "+(null===(l=u.data)||void 0===l?void 0:l.length)};null===(c=u.data)||void 0===c||c.push(m)}}}(a,t.manifest,t.url)}),null===(o=a.videoTracks)||void 0===o||o.addEventListener("addtrack",()=>{n.is_native&&(a.tracks=Array.from(a.videoTracks||[]).map((e,t)=>y(e.label?e.label:"track "+t,a,e.selected)),a.emit(s,a.tracks))}),a.on("loadeddata",()=>{var e;if(!n.is_native||!a.videoTracks){if(null===(e=a.tracks)||void 0===e?void 0:e.length)return a.emit(s,a.tracks);a.tracks=[y("default",a,!0)],a.emit(s,a.tracks)}}),a.on(s,()=>{const e=a.tracks;e&&Array.isArray(e)&&(m(l,L.events.TRACKS,e.map(e=>({text:e.label,onclick:()=>e.selected=!0}))),m(l,L.events.SWITCH,{selected_index:e.findIndex(e=>e.default)}),l instanceof FlowplayerMenu&&l.toggle_visibility((null==e?void 0:e.length)<2))}),a.on(i,e=>{const t=e.detail.track,n=a.tracks;if(!t||!n||!Array.isArray(n))return;if(m(l,L.events.SWITCH,{selected_index:n.indexOf(t)}),!a.opts.is_native||!a.videoTracks)return;a.videoTracks[n.indexOf(t)].selected=!0;const s=n.find(e=>e.selected&&e!==t);s&&(s.selected=!1,a.videoTracks[n.indexOf(s)].selected=!1)}),a.on("rts/status",e=>{var t;const n=e.detail.status,s=e.detail.data;if(n===p.Idle)return m(l,L.events.TRACKS,[]),a.tracks=[];n===p.Receiving&&(null===(t=null==a?void 0:a.tracks)||void 0===t||t.push(y((null==s?void 0:s.sourceId)||"Main",a,!(null==s?void 0:s.sourceId),s)))})}}).pluginName="vtsel",L.events=A,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 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,w)});
@@ -1,6 +1,6 @@
1
- import type { BitrateInfo } from 'dashjs';
2
1
  import type { Get } from 'type-fest';
3
2
  import type { Level } from 'hls.js';
3
+ import type { Representation } from 'dashjs';
4
4
  import type { TupleToUnion } from 'type-fest';
5
5
 
6
6
  /* Excluded from this release type: AnyLoader */
@@ -1466,7 +1466,7 @@ PROGRESS = "progress";
1466
1466
  */
1467
1467
  declare type QselOption = (Level & {
1468
1468
  level: number;
1469
- }) | BitrateInfo | {
1469
+ }) | Representation | {
1470
1470
  name: string | number;
1471
1471
  encodingId: string;
1472
1472
  spatialLayerId: number;
@@ -1514,8 +1514,8 @@ QUALITY_CHANGE = "qualitychange";
1514
1514
  * @public
1515
1515
  */
1516
1516
  declare type QualityChangeEventDetail = {
1517
- before?: Level | BitrateInfo;
1518
- after?: Level | BitrateInfo;
1517
+ before?: Level | Representation;
1518
+ after?: Level | Representation;
1519
1519
  plugin: string;
1520
1520
  automatic: boolean;
1521
1521
  /* Excluded from this release type: downscale */
package/plugins/webos.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.webos=t())}(this,(function(){"use strict";const e="is-hovered",t=(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 s="is-tv-seeking";let n=void 0;function i(e,t){e.enqueueSeek(t)&&function(e){e.setState("is-kb-active",!0),clearTimeout(n),n=setTimeout((function(){e.setState("is-kb-active",!1)}),2500)}(e)}var o,r={EXIT:461,ENTER:13,PLAY:415,PAUSE:19,REWIND:412,FORWARD:417,ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40};const a=((o=class Webos 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,s,n){n.setState("is-tv",!0),this.menu=t(n,"flowplayer-tv-menu"),s.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(t,n){return n?t.togglePlay(!0):(this.is_live_status_focused()&&!t.hasState(e)&&this.live_status_toggle_focus(t,!1),t.hasState(s)?void this.on_seek_end(t,!1):t.togglePlay(!0))}on_enter(e,t){var n;return t?e.togglePlay():this.is_live_status_focused()?(null===(n=e.root.querySelector(".fp-live-status"))||void 0===n||n.dispatchEvent(new Event("click")),this.live_status_toggle_focus(e,!1)):e.hasState(s)?this.on_seek_end(e,!1):e.togglePlay()}on_exit(t,n){return n?t.emit("fullscreen:exit"):this.is_live_status_focused()?this.live_status_toggle_focus(t,!1):t.hasState(s)?this.on_seek_end(t,!0):t.hasState(e)?t.setState(e,!1):t.emit("fullscreen:exit")}on_arrow_down(t,s){if(clearTimeout(this.hover_timeout),this.hover_timeout=setTimeout(()=>{t.setState(e,!1),this.live_status_toggle_focus(t,!1)},2e3),!t.hasState(e)&&!t.hasState("is-paused"))return t.setState(e,!0);s||!t.hasState("is-live")||t.hasState("no-timeline")||this.live_status_toggle_focus(t,!0)}on_seek(e,t,n){n||e.hasState("is-live")&&e.hasState("no-timeline")||(e.hasState(s)||(this.should_restart=!e.hasState("is-paused"),this.previous_current_time=e.currentTime),e.paused||e.togglePlay(!1),e.setState(s,!0),i(e,t))}on_seek_end(e,t){e.setState(s,!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(e,t,s){(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}})().webOS&&(super.init(e,t,s),document.addEventListener("keydown",t=>{setTimeout(()=>{var n;!t.defaultPrevented&&Object.values(r).includes(t.keyCode)&&this.keydown_listener(t.keyCode,r,s,this.menu,null===(n=e.webos)||void 0===n?void 0:n.seek_step)},0)}))}}).pluginName="webos",o.events={EXIT_FULLSCREEN:"fullscreen:exit"},o);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.webos=t())}(this,function(){"use strict";const e="fullscreen:exit",t="flowplayer-tv-menu",s="is-paused",n="is-live",i="no-timeline",o="is-hovered",r=(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}}const a="is-open";class TvMenu extends FlowplayerComponent{constructor(e){super(e),this.classList.add("tv-menu"),e.on("src",()=>this.classList.remove(a))}open(){var e;this.player.emit("tv-menu:will-open"),this.classList.add(a),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(a)}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 u="is-tv-seeking",l="is-kb-active";let c;function d(e,t){e.enqueueSeek(t)&&function(e){e.setState(l,!0),clearTimeout(c),c=setTimeout(function(){e.setState(l,!1)},2500)}(e)}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,t,TvMenu)}init(e,s,n){n.setState("is-tv",!0),this.menu=r(n,t),s.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(a)||n.is_empty()?!o&&n.classList.contains(a)?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,t){return t?e.togglePlay(!0):(this.is_live_status_focused()&&!e.hasState(o)&&this.live_status_toggle_focus(e,!1),e.hasState(u)?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(u)?this.on_seek_end(e,!1):e.togglePlay()}on_exit(t,s){return s?t.emit(e):this.is_live_status_focused()?this.live_status_toggle_focus(t,!1):t.hasState(u)?this.on_seek_end(t,!0):t.hasState(o)?t.setState(o,!1):t.emit(e)}on_arrow_down(e,t){if(clearTimeout(this.hover_timeout),this.hover_timeout=setTimeout(()=>{e.setState(o,!1),this.live_status_toggle_focus(e,!1)},2e3),!e.hasState(o)&&!e.hasState(s))return e.setState(o,!0);t||!e.hasState(n)||e.hasState(i)||this.live_status_toggle_focus(e,!0)}on_seek(e,t,o){o||e.hasState(n)&&e.hasState(i)||(e.hasState(u)||(this.should_restart=!e.hasState(s),this.previous_current_time=e.currentTime),e.paused||e.togglePlay(!1),e.setState(u,!0),d(e,t))}on_seek_end(e,t){e.setState(u,!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))}}var _,h={EXIT:461,ENTER:13,PLAY:415,PAUSE:19,REWIND:412,FORWARD:417,ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40};const f=((_=class Webos extends TvPlugin{init(e,t,s){(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}})().webOS&&(super.init(e,t,s),document.addEventListener("keydown",t=>{setTimeout(()=>{var n;!t.defaultPrevented&&Object.values(h).includes(t.keyCode)&&this.keydown_listener(t.keyCode,h,s,this.menu,null===(n=e.webos)||void 0===n?void 0:n.seek_step)},0)}))}}).pluginName="webos",_.events={EXIT_FULLSCREEN:e},_);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,f)});
package/util/loader.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { BitrateInfo } from 'dashjs';
2
1
  import type { Get } from 'type-fest';
3
2
  import type { Level } from 'hls.js';
3
+ import type { Representation } from 'dashjs';
4
4
  import type { TupleToUnion } from 'type-fest';
5
5
 
6
6
  /* Excluded from this release type: AnyLoader */
@@ -1484,7 +1484,7 @@ PROGRESS = "progress";
1484
1484
  */
1485
1485
  declare type QselOption = (Level & {
1486
1486
  level: number;
1487
- }) | BitrateInfo | {
1487
+ }) | Representation | {
1488
1488
  name: string | number;
1489
1489
  encodingId: string;
1490
1490
  spatialLayerId: number;
@@ -1532,8 +1532,8 @@ QUALITY_CHANGE = "qualitychange";
1532
1532
  * @public
1533
1533
  */
1534
1534
  declare type QualityChangeEventDetail = {
1535
- before?: Level | BitrateInfo;
1536
- after?: Level | BitrateInfo;
1535
+ before?: Level | Representation;
1536
+ after?: Level | Representation;
1537
1537
  plugin: string;
1538
1538
  automatic: boolean;
1539
1539
  /* Excluded from this release type: downscale */