@flowplayer/player 3.32.1-rc → 3.32.1-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) 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 +126 -1
  5. package/package.json +2 -2
  6. package/plugins/ads.d.ts +126 -1
  7. package/plugins/ads.js +2 -2
  8. package/plugins/airplay.d.ts +126 -1
  9. package/plugins/analytics.d.ts +126 -1
  10. package/plugins/analytics.js +1 -1
  11. package/plugins/asel.d.ts +126 -1
  12. package/plugins/asel.js +1 -1
  13. package/plugins/audio.d.ts +126 -1
  14. package/plugins/chapters.d.ts +126 -1
  15. package/plugins/chromecast.d.ts +126 -1
  16. package/plugins/comscore.d.ts +126 -1
  17. package/plugins/consent.d.ts +126 -1
  18. package/plugins/context-menu.d.ts +126 -1
  19. package/plugins/cuepoints.d.ts +126 -1
  20. package/plugins/dash.d.ts +126 -1
  21. package/plugins/drm.d.ts +126 -1
  22. package/plugins/endscreen.d.ts +126 -1
  23. package/plugins/fas.d.ts +126 -1
  24. package/plugins/float-on-scroll.d.ts +126 -1
  25. package/plugins/ga4.d.ts +126 -1
  26. package/plugins/gemius.d.ts +126 -1
  27. package/plugins/google-analytics.d.ts +126 -1
  28. package/plugins/hls.d.ts +126 -1
  29. package/plugins/id3.d.ts +126 -1
  30. package/plugins/iframe.d.ts +126 -1
  31. package/plugins/keyboard.d.ts +126 -1
  32. package/plugins/media-session.d.ts +126 -1
  33. package/plugins/message.d.ts +126 -1
  34. package/plugins/message.js +1 -1
  35. package/plugins/ovp.d.ts +126 -1
  36. package/plugins/playlist.d.ts +126 -1
  37. package/plugins/preview.d.ts +126 -1
  38. package/plugins/qsel.d.ts +126 -1
  39. package/plugins/qsel.js +1 -1
  40. package/plugins/qul.d.ts +126 -1
  41. package/plugins/rts.d.ts +126 -1
  42. package/plugins/rts.js +1 -1
  43. package/plugins/share.d.ts +126 -1
  44. package/plugins/share.js +1 -1
  45. package/plugins/speed.d.ts +126 -1
  46. package/plugins/speed.js +1 -1
  47. package/plugins/ssai.d.ts +126 -1
  48. package/plugins/ssai.js +1 -1
  49. package/plugins/subtitles.d.ts +126 -1
  50. package/plugins/subtitles.js +1 -1
  51. package/plugins/thumbnails.d.ts +126 -1
  52. package/plugins/tizen.d.ts +126 -1
  53. package/plugins/vtsel.d.ts +126 -1
  54. package/plugins/vtsel.js +1 -1
  55. package/plugins/webos.d.ts +126 -1
  56. package/util/loader.d.ts +126 -1
@@ -1,6 +1,8 @@
1
1
  import type { Get } from 'type-fest';
2
2
  import type { Level } from 'hls.js';
3
+ import type { Paths } from 'type-fest';
3
4
  import type { Representation } from 'dashjs';
5
+ import type { Translation } from '@flowplayer/translations';
4
6
  import type { TupleToUnion } from 'type-fest';
5
7
 
6
8
  /* Excluded from this release type: AnyLoader */
@@ -765,6 +767,13 @@ declare interface FlowplayerUMDBase {
765
767
  /* Excluded from this release type: support */
766
768
  /* Excluded from this release type: jwt */
767
769
  /* Excluded from this release type: loaders */
770
+ /**
771
+ * @public
772
+ * Translations dictionaries to be used with `@flowplayer/translations` package
773
+ *
774
+ * See [official documentation](https://developer.wowza.com/docs/wowza-flowplayer/player/translations/)
775
+ */
776
+ i18n: typeof I18n;
768
777
  }
769
778
 
770
779
  /**
@@ -842,6 +851,112 @@ declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnio
842
851
 
843
852
  declare const HOVERED = "is-hovered";
844
853
 
854
+ declare class I18n implements Plugin_2 {
855
+ static pluginName: string;
856
+ static en: {
857
+ ads: {
858
+ ad: string;
859
+ ads: string;
860
+ advertisement: string;
861
+ indicator: string;
862
+ adchoices: string;
863
+ };
864
+ audio: {
865
+ button_txt: string;
866
+ menu_title: string;
867
+ };
868
+ cc: {
869
+ button: string;
870
+ menu_title: string;
871
+ options: string;
872
+ tracks: string;
873
+ reset: string;
874
+ colors: {
875
+ Black: string;
876
+ Blue: string;
877
+ Cyan: string;
878
+ Green: string;
879
+ Magenta: string;
880
+ Red: string;
881
+ White: string;
882
+ Yellow: string;
883
+ };
884
+ edgeStyle: {
885
+ None: string;
886
+ "Drop shadow": string;
887
+ Raised: string;
888
+ Depressed: string;
889
+ Outline: string;
890
+ };
891
+ fontFamily: {
892
+ "Monospaced Serif": string;
893
+ "Proportional Serif": string;
894
+ "Monospaced Sans-Serif": string;
895
+ "Proportional Sans-Serif": string;
896
+ Casual: string;
897
+ Cursive: string;
898
+ };
899
+ properties: {
900
+ fontFamily: string;
901
+ fontSize: string;
902
+ fontColor: string;
903
+ fontOpacity: string;
904
+ backgroundColor: string;
905
+ backgroundOpacity: string;
906
+ characterEdgeStyle: string;
907
+ };
908
+ };
909
+ chromecast: {
910
+ start: string;
911
+ stop: string;
912
+ };
913
+ core: {
914
+ exit_fullscreen: string;
915
+ fullscreen: string;
916
+ mute: string;
917
+ muted: string;
918
+ pause: string;
919
+ play: string;
920
+ seconds: string;
921
+ timeline_aria_label: string;
922
+ unmute: string;
923
+ volume: string;
924
+ close: string;
925
+ "skip-next": string;
926
+ "skip-prev": string;
927
+ };
928
+ ovp: {
929
+ starting_in: string;
930
+ };
931
+ playlist: {
932
+ cancel: string;
933
+ up_next: string;
934
+ autoplay: string;
935
+ now_playing: string;
936
+ turn_off_autoplay: string;
937
+ playlist: string;
938
+ };
939
+ qsel: {
940
+ menu_title: string;
941
+ };
942
+ share: {
943
+ clipboard_failure: string;
944
+ clipboard_success: string;
945
+ embed: string;
946
+ link: string;
947
+ menu_title: string;
948
+ };
949
+ speed: {
950
+ menu_title: string;
951
+ };
952
+ vtsel: {
953
+ button_txt: string;
954
+ menu_title: string;
955
+ };
956
+ };
957
+ init(config: Config, _root: never, video: Player): void;
958
+ }
959
+
845
960
  declare const IN_VIEWPORT = "is-in-viewport";
846
961
 
847
962
  /* Excluded from this release type: INTERSECTIONCHANGE */
@@ -1202,7 +1317,8 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
1202
1317
  /**
1203
1318
  * Adds a language to the project. See {@link https://developer.wowza.com/docs/wowza-flowplayer/player/translations/#using-npm| Official documentation}
1204
1319
  */
1205
- i18n(k: string, fallback?: string): string;
1320
+ i18n(k: TranslationKey): string;
1321
+ i18n(k: string, fallback: string): string;
1206
1322
  /* Excluded from this release type: deviceId */
1207
1323
  /* Excluded from this release type: live_state */
1208
1324
  /**
@@ -1942,6 +2058,15 @@ TOUCH_START = "touchstart";
1942
2058
 
1943
2059
  declare const TOUCHED = "is-touched";
1944
2060
 
2061
+ /**
2062
+ * @public
2063
+ * All possible full paths to each translation, i.e. "core.mute"| "core.play" | "ads.ad" etc.
2064
+ * This type is useful for developers using translation querying based on path, like in lodash's get()
2065
+ */
2066
+ declare type TranslationKey = Paths<Translation, {
2067
+ leavesOnly: true;
2068
+ }>;
2069
+
1945
2070
  declare type TSampleRate = typeof SampleRate;
1946
2071
 
1947
2072
  declare const TV = "is-tv";
package/plugins/share.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.share=t())}(this,function(){"use strict";const e="click";const t={name:"fp-facebook"},n={name:"fp-link"},s={name:"fp-share"},i={name:"fp-embed"},o={name:"fp-twitter"};function r(e,t,n){const s=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;s.length;){if(null==e)return n;const t=s.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}const a="webshare-enabled";function l(){try{return(document.querySelector("meta[name='description']")||{content:""}).content}catch(e){return""}}function c(e){if("string"==typeof e.link)return e.link;const t=document.querySelector("link[rel=canonical]");return t?t.href:window.location.toString()}class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}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")}}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 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),d=(e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)},m="has-menu-opened",h="fp-menu-container",p="fp-on",f="fp-invis",y="details[open]."+h;class FlowplayerMenu extends FlowplayerComponent{constructor(t){super(t),this.player=t,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=b(),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(h),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener(e,e=>{if(e.defaultPrevented)return;e.preventDefault();const n=this.menuContainer.open;n||(w(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,t.root.classList.toggle(m,!n),this.summaryEle.setAttribute("aria-expanded",n?"false":"true")}),this.addEventListener("focusin",e=>{e.target;HTMLLIElement}),this.addEventListener("focusout",e=>{e.target;HTMLLIElement}),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||b()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=u(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(t,n){const s=document.createElement("li");s.setAttribute("tabindex","0"),t.icon&&s.append(t.icon);const i=document.createElement("span");i.textContent=t.text,s.append(i),this.olEle.appendChild(s),t.isButton?(s.setAttribute("role","menuitem"),s.addEventListener(e,()=>{"function"==typeof t.onclick&&t.onclick()})):(s.setAttribute("role","menuitemradio"),s.setAttribute("aria-checked","false"),s.addEventListener(e,()=>{this.select_item(n),"function"==typeof t.onclick&&t.onclick()}),t.selected&&this.select_item(n))}select_item(e){var t;if(!(null===(t=this.options[e])||void 0===t?void 0:t.hasAttribute("aria-checked")))throw new Error("Cannot select a button-only item");this.options.forEach((t,n)=>{t.hasAttribute("aria-checked")&&(t.classList.toggle(p,n===e),t.setAttribute("aria-checked",n===e?"true":"false"))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(p),e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false")})}toggle_visibility(e){this.classList.toggle(f,e),this.menu.style.setProperty("display",e?"none":"flex")}}function w(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector(y);n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle(m,!1))})}function b(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function E(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}function g(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}document.addEventListener(e,function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(w(),this.active_menu=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 v="flowplayer-share-menu",_="flowplayer-share-icon",x="flowplayer-facebook-icon",A="flowplayer-twitter-icon",L="flowplayer-link-icon",k="flowplayer-embed-icon";var C;const S=((C=class Share{constructor(e){this.umd=e,this.share_options=[],d(e,v,class extends FlowplayerMenu{}),d(this.umd,x,class extends FlowplayerIcon{constructor(e){super(e,t)}}),d(this.umd,A,class extends FlowplayerIcon{constructor(e){super(e,o)}}),d(this.umd,L,class extends FlowplayerIcon{constructor(e){super(e,n)}}),d(this.umd,k,class extends FlowplayerIcon{constructor(e){super(e,i)}}),d(this.umd,_,class extends FlowplayerIcon{constructor(e){super(e,s)}})}init(t,n,s){const i=u(s,v);i instanceof FlowplayerMenu&&i.setMenuAttrs({menuTitle:s.i18n("share.menu_title"),class:"fp-share-menu fp-togglable",summaryIcon:_,icons:!0,options_event:C.events.OPTIONS});const o={prev_config:0,webshare_listener:0};s.on("mount",function(){var e;null===(e=g(s,"flowplayer-header-left-zone"))||void 0===e||e.append(i),i instanceof FlowplayerMenu&&i.menuContainer.addEventListener("toggle",function(){n.classList.toggle("is-share-menu",this.open);const e=g(s,"flowplayer-control");this.open&&(n.classList.contains("is-small")?s.pause():e&&function(e,t){if(!t)return;e.menu.style.maxHeight=t.getBoundingClientRect().top+parseFloat(window.getComputedStyle(t).getPropertyValue("padding"))-e.menuContainer.getBoundingClientRect().bottom+"px"}(i,e))})}),s.on("config",n=>{const d=r(n,"data.share",{});if(!1===d)return i instanceof FlowplayerMenu&&void i.classList.remove(a);if(o.prev_config===d)return;if(o.prev_config=d,i instanceof FlowplayerMenu&&function(){try{return"https:"===window.location.protocol&&"function"==typeof navigator.share}catch(e){return!1}}()&&r(d,"web_share",!0))return function(e){e.classList.add(a)}(i),o.webshare_listener||function(t,n,s){s.webshare_listener=!0,n.addEventListener(e,function(){n.classList.contains(a)&&(n.menuContainer.open=!1,navigator.share({title:r(t,"share.title",document.title),text:r(t,"share.text",l()),url:c(r(t,"share",{}))}).catch(function(){}))})}(t,i,o);this.share_options=[];const m="string"==typeof d.link?d.link:window.location.toString();if(d.iframe){const e="string"==typeof d.iframe?d.iframe:m;this.share_options.push(I(s,i,"share.embed",M.bind(null,e,s),u(s,k)))}d.link&&this.share_options.push(I(s,i,"share.link",O.bind(null,m),u(s,L))),d.facebook&&this.share_options.push(I(s,i,"Facebook",H.bind(null,m),u(s,x))),d.twitter&&this.share_options.push(I(s,i,"Twitter",P.bind(null,m),u(s,A))),E(i,C.events.OPTIONS,this.share_options)})}add_options(e,...t){const n=e.root.querySelector(v);n&&t.forEach(t=>{const s=I(e,n,t.text,t.onclick,t.icon);n.menuOption(s,n.options.length)})}}).pluginName="share",C.events={OPTIONS:"share:options"},C);function I(e,t,n,s,i){return{text:T(e,n),icon:i,onclick:F.bind(null,e,t,s),isButton:!0}}function T(e,t){return 0===t.indexOf("share.")?e.i18n(t):t}function F(e,t,n){t instanceof FlowplayerMenu&&t.unselect_item();const s=n();s.success&&s.message&&e.message&&e.emit(e.message.events.SHOW_MESSAGE,{message:s.message})}function M(e,t){const n=t.videoHeight/t.videoWidth;return O('<div style="position:relative;width:100%;display:inline-block;"><iframe src="__IFRAME_SRC__" allowfullscreen style="border:none;position:absolute;top:0;left:0;width:100%;height:100%;"></iframe><div style="padding-top: __RATIO__%;"></div></div>'.replace("__IFRAME_SRC__",encodeURI(e)).replace("__RATIO__",""+100*n))}function O(e){const t=document.createElement("textarea");t.setAttribute("style","position:absolute;opacity:0"),t.value=e;const n=document.body;n.append(t),t.select();const s=document.execCommand("copy");return n.removeChild(t),{success:s,message:s?"<trans share.clipboard_success trans>":"<trans share.clipboard_failure trans>"}}function H(e){return R("https://www.facebook.com/sharer.php?u="+encodeURIComponent(e)),{success:!0}}function P(e){return R("https://twitter.com/intent/tweet?url="+encodeURIComponent(e)),{success:!0}}function R(e){let t;const n=screen.height,s=screen.width,i=Math.round(s/2-275);t=0,n>420&&(t=Math.round(n/2-210)),window.open(e,"sharer","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left="+i+",top="+t)}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,S)});
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.share=t())}(this,function(){"use strict";const e="click";const t={name:"fp-facebook"},n={name:"fp-link"},s={name:"fp-share"},i={name:"fp-embed"},o={name:"fp-twitter"};function r(e,t,n){const s=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;s.length;){if(null==e)return n;const t=s.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}const a="webshare-enabled";function l(){try{return(document.querySelector("meta[name='description']")||{content:""}).content}catch(e){return""}}function c(e){if("string"==typeof e.link)return e.link;const t=document.querySelector("link[rel=canonical]");return t?t.href:window.location.toString()}class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}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")}}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 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),d=(e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)},m="has-menu-opened",h="fp-menu-container",p="fp-on",f="fp-invis",y="details[open]."+h;class FlowplayerMenu extends FlowplayerComponent{constructor(t){super(t),this.player=t,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=b(),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(h),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener(e,e=>{if(e.defaultPrevented)return;e.preventDefault();const n=this.menuContainer.open;n||(w(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,t.root.classList.toggle(m,!n),this.summaryEle.setAttribute("aria-expanded",n?"false":"true")}),this.addEventListener("focusin",e=>{e.target;HTMLLIElement}),this.addEventListener("focusout",e=>{e.target;HTMLLIElement}),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||b()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=u(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(t,n){const s=document.createElement("li");s.setAttribute("tabindex","0"),t.icon&&s.append(t.icon);const i=document.createElement("span");i.textContent=t.text,s.append(i),this.olEle.appendChild(s),t.isButton?(s.setAttribute("role","menuitem"),s.addEventListener(e,()=>{"function"==typeof t.onclick&&t.onclick()})):(s.setAttribute("role","menuitemradio"),s.setAttribute("aria-checked","false"),s.addEventListener(e,()=>{this.select_item(n),"function"==typeof t.onclick&&t.onclick()}),t.selected&&this.select_item(n))}select_item(e){var t;if(this.options[e]&&!(null===(t=this.options[e])||void 0===t?void 0:t.hasAttribute("aria-checked")))throw new Error("Cannot select a button-only item");this.options.forEach((t,n)=>{t.hasAttribute("aria-checked")&&(t.classList.toggle(p,n===e),t.setAttribute("aria-checked",n===e?"true":"false"))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(p),e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false")})}toggle_visibility(e){this.classList.toggle(f,e),this.menu.style.setProperty("display",e?"none":"flex")}}function w(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector(y);n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle(m,!1))})}function b(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function E(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}function g(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}document.addEventListener(e,function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(w(),this.active_menu=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 v="flowplayer-share-menu",_="flowplayer-share-icon",x="flowplayer-facebook-icon",A="flowplayer-twitter-icon",L="flowplayer-link-icon",k="flowplayer-embed-icon";var C;const S=((C=class Share{constructor(e){this.umd=e,this.share_options=[],d(e,v,class extends FlowplayerMenu{}),d(this.umd,x,class extends FlowplayerIcon{constructor(e){super(e,t)}}),d(this.umd,A,class extends FlowplayerIcon{constructor(e){super(e,o)}}),d(this.umd,L,class extends FlowplayerIcon{constructor(e){super(e,n)}}),d(this.umd,k,class extends FlowplayerIcon{constructor(e){super(e,i)}}),d(this.umd,_,class extends FlowplayerIcon{constructor(e){super(e,s)}})}init(t,n,s){const i=u(s,v);i instanceof FlowplayerMenu&&i.setMenuAttrs({menuTitle:s.i18n("share.menu_title"),class:"fp-share-menu fp-togglable",summaryIcon:_,icons:!0,options_event:C.events.OPTIONS});const o={prev_config:0,webshare_listener:0};s.on("mount",function(){var e;null===(e=g(s,"flowplayer-header-left-zone"))||void 0===e||e.append(i),i instanceof FlowplayerMenu&&i.menuContainer.addEventListener("toggle",function(){n.classList.toggle("is-share-menu",this.open);const e=g(s,"flowplayer-control");this.open&&(n.classList.contains("is-small")?s.pause():e&&function(e,t){if(!t)return;e.menu.style.maxHeight=t.getBoundingClientRect().top+parseFloat(window.getComputedStyle(t).getPropertyValue("padding"))-e.menuContainer.getBoundingClientRect().bottom+"px"}(i,e))})}),s.on("config",n=>{const d=r(n,"data.share",{});if(!1===d)return i instanceof FlowplayerMenu&&void i.classList.remove(a);if(o.prev_config===d)return;if(o.prev_config=d,i instanceof FlowplayerMenu&&function(){try{return"https:"===window.location.protocol&&"function"==typeof navigator.share}catch(e){return!1}}()&&r(d,"web_share",!0))return function(e){e.classList.add(a)}(i),o.webshare_listener||function(t,n,s){s.webshare_listener=!0,n.addEventListener(e,function(){n.classList.contains(a)&&(n.menuContainer.open=!1,navigator.share({title:r(t,"share.title",document.title),text:r(t,"share.text",l()),url:c(r(t,"share",{}))}).catch(function(){}))})}(t,i,o);this.share_options=[];const m="string"==typeof d.link?d.link:window.location.toString();if(d.iframe){const e="string"==typeof d.iframe?d.iframe:m;this.share_options.push(I(s,i,"share.embed",M.bind(null,e,s),u(s,k)))}d.link&&this.share_options.push(I(s,i,"share.link",O.bind(null,m),u(s,L))),d.facebook&&this.share_options.push(I(s,i,"Facebook",H.bind(null,m),u(s,x))),d.twitter&&this.share_options.push(I(s,i,"Twitter",P.bind(null,m),u(s,A))),E(i,C.events.OPTIONS,this.share_options)})}add_options(e,...t){const n=e.root.querySelector(v);n&&t.forEach(t=>{const s=I(e,n,t.text,t.onclick,t.icon);n.menuOption(s,n.options.length)})}}).pluginName="share",C.events={OPTIONS:"share:options"},C);function I(e,t,n,s,i){return{text:T(e,n),icon:i,onclick:F.bind(null,e,t,s),isButton:!0}}function T(e,t){return e.i18n(t,t)}function F(e,t,n){t instanceof FlowplayerMenu&&t.unselect_item();const s=n();s.success&&s.message&&e.message&&e.emit(e.message.events.SHOW_MESSAGE,{message:s.message})}function M(e,t){const n=t.videoHeight/t.videoWidth;return O('<div style="position:relative;width:100%;display:inline-block;"><iframe src="__IFRAME_SRC__" allowfullscreen style="border:none;position:absolute;top:0;left:0;width:100%;height:100%;"></iframe><div style="padding-top: __RATIO__%;"></div></div>'.replace("__IFRAME_SRC__",encodeURI(e)).replace("__RATIO__",""+100*n))}function O(e){const t=document.createElement("textarea");t.setAttribute("style","position:absolute;opacity:0"),t.value=e;const n=document.body;n.append(t),t.select();const s=document.execCommand("copy");return n.removeChild(t),{success:s,message:s?"<trans share.clipboard_success trans>":"<trans share.clipboard_failure trans>"}}function H(e){return R("https://www.facebook.com/sharer.php?u="+encodeURIComponent(e)),{success:!0}}function P(e){return R("https://twitter.com/intent/tweet?url="+encodeURIComponent(e)),{success:!0}}function R(e){let t;const n=screen.height,s=screen.width,i=Math.round(s/2-275);t=0,n>420&&(t=Math.round(n/2-210)),window.open(e,"sharer","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left="+i+",top="+t)}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,S)});
@@ -1,6 +1,8 @@
1
1
  import type { Get } from 'type-fest';
2
2
  import type { Level } from 'hls.js';
3
+ import type { Paths } from 'type-fest';
3
4
  import type { Representation } from 'dashjs';
5
+ import type { Translation } from '@flowplayer/translations';
4
6
  import type { TupleToUnion } from 'type-fest';
5
7
 
6
8
  /* Excluded from this release type: AnyLoader */
@@ -765,6 +767,13 @@ declare interface FlowplayerUMDBase {
765
767
  /* Excluded from this release type: support */
766
768
  /* Excluded from this release type: jwt */
767
769
  /* Excluded from this release type: loaders */
770
+ /**
771
+ * @public
772
+ * Translations dictionaries to be used with `@flowplayer/translations` package
773
+ *
774
+ * See [official documentation](https://developer.wowza.com/docs/wowza-flowplayer/player/translations/)
775
+ */
776
+ i18n: typeof I18n;
768
777
  }
769
778
 
770
779
  /**
@@ -842,6 +851,112 @@ declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnio
842
851
 
843
852
  declare const HOVERED = "is-hovered";
844
853
 
854
+ declare class I18n implements Plugin_2 {
855
+ static pluginName: string;
856
+ static en: {
857
+ ads: {
858
+ ad: string;
859
+ ads: string;
860
+ advertisement: string;
861
+ indicator: string;
862
+ adchoices: string;
863
+ };
864
+ audio: {
865
+ button_txt: string;
866
+ menu_title: string;
867
+ };
868
+ cc: {
869
+ button: string;
870
+ menu_title: string;
871
+ options: string;
872
+ tracks: string;
873
+ reset: string;
874
+ colors: {
875
+ Black: string;
876
+ Blue: string;
877
+ Cyan: string;
878
+ Green: string;
879
+ Magenta: string;
880
+ Red: string;
881
+ White: string;
882
+ Yellow: string;
883
+ };
884
+ edgeStyle: {
885
+ None: string;
886
+ "Drop shadow": string;
887
+ Raised: string;
888
+ Depressed: string;
889
+ Outline: string;
890
+ };
891
+ fontFamily: {
892
+ "Monospaced Serif": string;
893
+ "Proportional Serif": string;
894
+ "Monospaced Sans-Serif": string;
895
+ "Proportional Sans-Serif": string;
896
+ Casual: string;
897
+ Cursive: string;
898
+ };
899
+ properties: {
900
+ fontFamily: string;
901
+ fontSize: string;
902
+ fontColor: string;
903
+ fontOpacity: string;
904
+ backgroundColor: string;
905
+ backgroundOpacity: string;
906
+ characterEdgeStyle: string;
907
+ };
908
+ };
909
+ chromecast: {
910
+ start: string;
911
+ stop: string;
912
+ };
913
+ core: {
914
+ exit_fullscreen: string;
915
+ fullscreen: string;
916
+ mute: string;
917
+ muted: string;
918
+ pause: string;
919
+ play: string;
920
+ seconds: string;
921
+ timeline_aria_label: string;
922
+ unmute: string;
923
+ volume: string;
924
+ close: string;
925
+ "skip-next": string;
926
+ "skip-prev": string;
927
+ };
928
+ ovp: {
929
+ starting_in: string;
930
+ };
931
+ playlist: {
932
+ cancel: string;
933
+ up_next: string;
934
+ autoplay: string;
935
+ now_playing: string;
936
+ turn_off_autoplay: string;
937
+ playlist: string;
938
+ };
939
+ qsel: {
940
+ menu_title: string;
941
+ };
942
+ share: {
943
+ clipboard_failure: string;
944
+ clipboard_success: string;
945
+ embed: string;
946
+ link: string;
947
+ menu_title: string;
948
+ };
949
+ speed: {
950
+ menu_title: string;
951
+ };
952
+ vtsel: {
953
+ button_txt: string;
954
+ menu_title: string;
955
+ };
956
+ };
957
+ init(config: Config, _root: never, video: Player): void;
958
+ }
959
+
845
960
  declare const IN_VIEWPORT = "is-in-viewport";
846
961
 
847
962
  /* Excluded from this release type: INTERSECTIONCHANGE */
@@ -1202,7 +1317,8 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
1202
1317
  /**
1203
1318
  * Adds a language to the project. See {@link https://developer.wowza.com/docs/wowza-flowplayer/player/translations/#using-npm| Official documentation}
1204
1319
  */
1205
- i18n(k: string, fallback?: string): string;
1320
+ i18n(k: TranslationKey): string;
1321
+ i18n(k: string, fallback: string): string;
1206
1322
  /* Excluded from this release type: deviceId */
1207
1323
  /* Excluded from this release type: live_state */
1208
1324
  /**
@@ -1934,6 +2050,15 @@ TOUCH_START = "touchstart";
1934
2050
 
1935
2051
  declare const TOUCHED = "is-touched";
1936
2052
 
2053
+ /**
2054
+ * @public
2055
+ * All possible full paths to each translation, i.e. "core.mute"| "core.play" | "ads.ad" etc.
2056
+ * This type is useful for developers using translation querying based on path, like in lodash's get()
2057
+ */
2058
+ declare type TranslationKey = Paths<Translation, {
2059
+ leavesOnly: true;
2060
+ }>;
2061
+
1937
2062
  declare type TSampleRate = typeof SampleRate;
1938
2063
 
1939
2064
  declare const TV = "is-tv";
package/plugins/speed.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.speed=t())}(this,function(){"use strict";const e="click";class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const t="has-menu-opened",n=(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),s="fp-menu-container",i="fp-on",o="fp-invis",l="details[open]."+s;class FlowplayerMenu extends FlowplayerComponent{constructor(n){super(n),this.player=n,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=a(),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(s),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener(e,e=>{if(e.defaultPrevented)return;e.preventDefault();const s=this.menuContainer.open;s||(r(),document.active_menu=this.menuContainer),this.menuContainer.open=!s,n.root.classList.toggle(t,!s),this.summaryEle.setAttribute("aria-expanded",s?"false":"true")}),this.addEventListener("focusin",e=>{e.target;HTMLLIElement}),this.addEventListener("focusout",e=>{e.target;HTMLLIElement}),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||a()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=n(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(t,n){const s=document.createElement("li");s.setAttribute("tabindex","0"),t.icon&&s.append(t.icon);const i=document.createElement("span");i.textContent=t.text,s.append(i),this.olEle.appendChild(s),t.isButton?(s.setAttribute("role","menuitem"),s.addEventListener(e,()=>{"function"==typeof t.onclick&&t.onclick()})):(s.setAttribute("role","menuitemradio"),s.setAttribute("aria-checked","false"),s.addEventListener(e,()=>{this.select_item(n),"function"==typeof t.onclick&&t.onclick()}),t.selected&&this.select_item(n))}select_item(e){var t;if(!(null===(t=this.options[e])||void 0===t?void 0:t.hasAttribute("aria-checked")))throw new Error("Cannot select a button-only item");this.options.forEach((t,n)=>{t.hasAttribute("aria-checked")&&(t.classList.toggle(i,n===e),t.setAttribute("aria-checked",n===e?"true":"false"))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(i),e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false")})}toggle_visibility(e){this.classList.toggle(o,e),this.menu.style.setProperty("display",e?"none":"flex")}}function r(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var n;const s=e.root.querySelector(l);s&&(s.open=!1,null===(n=s.querySelector("summary"))||void 0===n||n.removeAttribute("aria-expanded"),e.root.classList.toggle(t,!1))})}function a(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function u(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}document.addEventListener(e,function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(r(),this.active_menu=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 c="flowplayer-speed-menu";var d;const m=((d=class Speed{constructor(e){this.selectedRate=1,((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,c,class extends FlowplayerMenu{})}init(e,t,s){let i;const o=n(s,c);o instanceof FlowplayerMenu&&o.setMenuAttrs({menuTitle:s.i18n("speed.menu_title"),summaryTitle:"1x",class:"fp-speed",options_event:d.events.OPTIONS,item_selected_event:d.events.SWITCH}),s.on("loadstart",()=>this.select_speed(s,this.selectedRate)),s.on("config",()=>{var t;const n=null===(t=e.speed)||void 0===t||t;if(n===i)return;if(i=n,0==n)return this.select_speed(s,1),u(o,d.events.OPTIONS,[]);const l="boolean"!=typeof n&&n.options?n.options:d.DEFAULT_SPEED_OPTIONS,r="boolean"!=typeof n&&n.labels?n.labels:[];Array.isArray(l)&&(u(o,d.events.OPTIONS,Array.from({length:l.length}).map((e,t)=>{const n=l[t];return{text:r[t]||n+"x",onclick:this.select_speed.bind(this,s,n)}})),u(o,d.events.SWITCH,{selected_index:l.findIndex(e=>1===e)}))}),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(o)})}select_speed(e,t){var n;if(isNaN(t))return;const s=null===(n=e.root.querySelector(c))||void 0===n?void 0:n.summaryEle;s&&(s.textContent=t+"x"),e.playbackRate=this.selectedRate=t}}).pluginName="speed",d.DEFAULT_SPEED_OPTIONS=[.2,.5,1,2,10],d.events={OPTIONS:"speed:options",SWITCH:"speed:switch"},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,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.speed=t())}(this,function(){"use strict";const e="click";class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const t="has-menu-opened",n=(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),s="fp-menu-container",i="fp-on",o="fp-invis",l="details[open]."+s;class FlowplayerMenu extends FlowplayerComponent{constructor(n){super(n),this.player=n,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=a(),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(s),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener(e,e=>{if(e.defaultPrevented)return;e.preventDefault();const s=this.menuContainer.open;s||(r(),document.active_menu=this.menuContainer),this.menuContainer.open=!s,n.root.classList.toggle(t,!s),this.summaryEle.setAttribute("aria-expanded",s?"false":"true")}),this.addEventListener("focusin",e=>{e.target;HTMLLIElement}),this.addEventListener("focusout",e=>{e.target;HTMLLIElement}),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||a()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=n(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(t,n){const s=document.createElement("li");s.setAttribute("tabindex","0"),t.icon&&s.append(t.icon);const i=document.createElement("span");i.textContent=t.text,s.append(i),this.olEle.appendChild(s),t.isButton?(s.setAttribute("role","menuitem"),s.addEventListener(e,()=>{"function"==typeof t.onclick&&t.onclick()})):(s.setAttribute("role","menuitemradio"),s.setAttribute("aria-checked","false"),s.addEventListener(e,()=>{this.select_item(n),"function"==typeof t.onclick&&t.onclick()}),t.selected&&this.select_item(n))}select_item(e){var t;if(this.options[e]&&!(null===(t=this.options[e])||void 0===t?void 0:t.hasAttribute("aria-checked")))throw new Error("Cannot select a button-only item");this.options.forEach((t,n)=>{t.hasAttribute("aria-checked")&&(t.classList.toggle(i,n===e),t.setAttribute("aria-checked",n===e?"true":"false"))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(i),e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false")})}toggle_visibility(e){this.classList.toggle(o,e),this.menu.style.setProperty("display",e?"none":"flex")}}function r(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var n;const s=e.root.querySelector(l);s&&(s.open=!1,null===(n=s.querySelector("summary"))||void 0===n||n.removeAttribute("aria-expanded"),e.root.classList.toggle(t,!1))})}function a(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function u(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}document.addEventListener(e,function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(r(),this.active_menu=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 c="flowplayer-speed-menu";var d;const m=((d=class Speed{constructor(e){this.selectedRate=1,((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,c,class extends FlowplayerMenu{})}init(e,t,s){let i;const o=n(s,c);o instanceof FlowplayerMenu&&o.setMenuAttrs({menuTitle:s.i18n("speed.menu_title"),summaryTitle:"1x",class:"fp-speed",options_event:d.events.OPTIONS,item_selected_event:d.events.SWITCH}),s.on("loadstart",()=>this.select_speed(s,this.selectedRate)),s.on("config",()=>{var t;const n=null===(t=e.speed)||void 0===t||t;if(n===i)return;if(i=n,0==n)return this.select_speed(s,1),u(o,d.events.OPTIONS,[]);const l="boolean"!=typeof n&&n.options?n.options:d.DEFAULT_SPEED_OPTIONS,r="boolean"!=typeof n&&n.labels?n.labels:[];Array.isArray(l)&&(u(o,d.events.OPTIONS,Array.from({length:l.length}).map((e,t)=>{const n=l[t];return{text:r[t]||n+"x",onclick:this.select_speed.bind(this,s,n)}})),u(o,d.events.SWITCH,{selected_index:l.findIndex(e=>1===e)}))}),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(o)})}select_speed(e,t){var n;if(isNaN(t))return;const s=null===(n=e.root.querySelector(c))||void 0===n?void 0:n.summaryEle;s&&(s.textContent=t+"x"),e.playbackRate=this.selectedRate=t}}).pluginName="speed",d.DEFAULT_SPEED_OPTIONS=[.2,.5,1,2,10],d.events={OPTIONS:"speed:options",SWITCH:"speed:switch"},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,m)});
package/plugins/ssai.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { FragParsingMetadataData } from 'hls.js';
2
2
  import type { Get } from 'type-fest';
3
3
  import type { Level } from 'hls.js';
4
+ import type { Paths } from 'type-fest';
4
5
  import type { Representation } from 'dashjs';
6
+ import type { Translation } from '@flowplayer/translations';
5
7
  import type { TupleToUnion } from 'type-fest';
6
8
 
7
9
  declare interface Ad {
@@ -841,6 +843,13 @@ declare interface FlowplayerUMDBase {
841
843
  /* Excluded from this release type: support */
842
844
  /* Excluded from this release type: jwt */
843
845
  /* Excluded from this release type: loaders */
846
+ /**
847
+ * @public
848
+ * Translations dictionaries to be used with `@flowplayer/translations` package
849
+ *
850
+ * See [official documentation](https://developer.wowza.com/docs/wowza-flowplayer/player/translations/)
851
+ */
852
+ i18n: typeof I18n;
844
853
  }
845
854
 
846
855
  /**
@@ -924,6 +933,112 @@ declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnio
924
933
 
925
934
  declare const HOVERED = "is-hovered";
926
935
 
936
+ declare class I18n implements Plugin_2 {
937
+ static pluginName: string;
938
+ static en: {
939
+ ads: {
940
+ ad: string;
941
+ ads: string;
942
+ advertisement: string;
943
+ indicator: string;
944
+ adchoices: string;
945
+ };
946
+ audio: {
947
+ button_txt: string;
948
+ menu_title: string;
949
+ };
950
+ cc: {
951
+ button: string;
952
+ menu_title: string;
953
+ options: string;
954
+ tracks: string;
955
+ reset: string;
956
+ colors: {
957
+ Black: string;
958
+ Blue: string;
959
+ Cyan: string;
960
+ Green: string;
961
+ Magenta: string;
962
+ Red: string;
963
+ White: string;
964
+ Yellow: string;
965
+ };
966
+ edgeStyle: {
967
+ None: string;
968
+ "Drop shadow": string;
969
+ Raised: string;
970
+ Depressed: string;
971
+ Outline: string;
972
+ };
973
+ fontFamily: {
974
+ "Monospaced Serif": string;
975
+ "Proportional Serif": string;
976
+ "Monospaced Sans-Serif": string;
977
+ "Proportional Sans-Serif": string;
978
+ Casual: string;
979
+ Cursive: string;
980
+ };
981
+ properties: {
982
+ fontFamily: string;
983
+ fontSize: string;
984
+ fontColor: string;
985
+ fontOpacity: string;
986
+ backgroundColor: string;
987
+ backgroundOpacity: string;
988
+ characterEdgeStyle: string;
989
+ };
990
+ };
991
+ chromecast: {
992
+ start: string;
993
+ stop: string;
994
+ };
995
+ core: {
996
+ exit_fullscreen: string;
997
+ fullscreen: string;
998
+ mute: string;
999
+ muted: string;
1000
+ pause: string;
1001
+ play: string;
1002
+ seconds: string;
1003
+ timeline_aria_label: string;
1004
+ unmute: string;
1005
+ volume: string;
1006
+ close: string;
1007
+ "skip-next": string;
1008
+ "skip-prev": string;
1009
+ };
1010
+ ovp: {
1011
+ starting_in: string;
1012
+ };
1013
+ playlist: {
1014
+ cancel: string;
1015
+ up_next: string;
1016
+ autoplay: string;
1017
+ now_playing: string;
1018
+ turn_off_autoplay: string;
1019
+ playlist: string;
1020
+ };
1021
+ qsel: {
1022
+ menu_title: string;
1023
+ };
1024
+ share: {
1025
+ clipboard_failure: string;
1026
+ clipboard_success: string;
1027
+ embed: string;
1028
+ link: string;
1029
+ menu_title: string;
1030
+ };
1031
+ speed: {
1032
+ menu_title: string;
1033
+ };
1034
+ vtsel: {
1035
+ button_txt: string;
1036
+ menu_title: string;
1037
+ };
1038
+ };
1039
+ init(config: Config, _root: never, video: Player): void;
1040
+ }
1041
+
927
1042
  declare const IN_VIEWPORT = "is-in-viewport";
928
1043
 
929
1044
  /* Excluded from this release type: INTERSECTIONCHANGE */
@@ -1288,7 +1403,8 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
1288
1403
  /**
1289
1404
  * Adds a language to the project. See {@link https://developer.wowza.com/docs/wowza-flowplayer/player/translations/#using-npm| Official documentation}
1290
1405
  */
1291
- i18n(k: string, fallback?: string): string;
1406
+ i18n(k: TranslationKey): string;
1407
+ i18n(k: string, fallback: string): string;
1292
1408
  /* Excluded from this release type: deviceId */
1293
1409
  /* Excluded from this release type: live_state */
1294
1410
  /**
@@ -2246,6 +2362,15 @@ TOUCH_START = "touchstart";
2246
2362
 
2247
2363
  declare const TOUCHED = "is-touched";
2248
2364
 
2365
+ /**
2366
+ * @public
2367
+ * All possible full paths to each translation, i.e. "core.mute"| "core.play" | "ads.ad" etc.
2368
+ * This type is useful for developers using translation querying based on path, like in lodash's get()
2369
+ */
2370
+ declare type TranslationKey = Paths<Translation, {
2371
+ leavesOnly: true;
2372
+ }>;
2373
+
2249
2374
  declare type TSampleRate = typeof SampleRate;
2250
2375
 
2251
2376
  declare const TV = "is-tv";