@flowplayer/player
Version:
video player for the future
2 lines (1 loc) • 2.93 kB
JavaScript
!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.airplay=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 i=window.customElements.get(t);if(!i)throw new Error(`no default flowplayer component with the name ${t} exists`);const r=window.customElements.get(n);return"function"!=typeof r?i:r})(e._customElements,t))(e);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 t="flowplayer-airplay-icon";var n=Object.freeze({__proto__:null,START:"airplay:start",STOP:"airplay:stop"});const i={name:"fp-airplay"};var r;const s=((r=class Airplay{static unsupported(){return!("WebKitPlaybackTargetAvailabilityEvent"in window)}static update(e,t){const n=t.availability===r.AVAILABLE&&!!e.currentSrc&&0!==e.currentSrc.indexOf("blob");e.setState(r.AVAILABLE_CLASS,n)}static render(n){var i;const r=e(n,t);null===(i=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(n,"flowplayer-header-right-zone"))||void 0===i||i.prepend(r)}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 FlowplayerIcon{constructor(e){super(e,i),this.addEventListener("click",function(){e.webkitShowPlaybackTargetPicker()})}})}init({airplay:e,hls:t},n,i){r.unsupported()||!1===e||(i.setOpts({hls:Object.assign({},{native:!0},t)}),r.render(i),i.setAttribute("x-webkit-airplay","allow"),i.on(r.AVAILABILITY_CHANGE,function(e){r.update(i,e)}),i.on(r.WIRELESS_CHANGE,function(){return i.emit(i.webkitCurrentPlaybackTargetIsWireless?r.events.START:r.events.STOP),i.setState(r.ACTIVE_CLASS,i.webkitCurrentPlaybackTargetIsWireless)}))}}).pluginName="airplay",r.ACTIVE_CLASS="is-airplay",r.AVAILABLE_CLASS="is-airplay-available",r.AVAILABILITY_CHANGE="webkitplaybacktargetavailabilitychanged",r.WIRELESS_CHANGE="webkitcurrentplaybacktargetiswirelesschanged",r.AVAILABLE="available",r.events=n,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 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)});