2 lines
2.6 KiB
JavaScript
2 lines
2.6 KiB
JavaScript
/*! @silvermine/videojs-airplay 2024-09-06 v1.3.0-8-gdbf8f7d */
|
|
!function n(a,r,o){function l(i,t){if(!r[i]){if(!a[i]){var e="function"==typeof require&&require;if(!t&&e)return e(i,!0);if(s)return s(i,!0);throw(t=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",t}e=r[i]={exports:{}},a[i][0].call(e.exports,function(t){return l(a[i][1][t]||t)},e,e.exports,n,a,r,o)}return r[i].exports}for(var s="function"==typeof require&&require,t=0;t<o.length;t++)l(o[t]);return l}({1:[function(t,i,e){var n=t("../lib/hasAirPlayAPISupport");i.exports=function(t){var i=t.getComponent("Button");class e extends i{constructor(t,i){super(t,i),n()||this.hide(),this._reactToAirPlayAvailableEvents(),i.addAirPlayLabelToButton?(this.el().classList.add("vjs-airplay-button-lg"),this._labelEl=document.createElement("span"),this._labelEl.classList.add("vjs-airplay-button-label"),this._labelEl.textContent=this.localize("AirPlay"),this.el().appendChild(this._labelEl)):this.controlText("Start AirPlay")}buildCSSClass(){return"vjs-airplay-button "+super.buildCSSClass()}handleClick(){this.player().trigger("airPlayRequested")}_getMediaEl(){return this.player().el().querySelector("video, audio")}_reactToAirPlayAvailableEvents(){var t=this._getMediaEl(),i=this;function e(t){"available"===t.availability?i.show():i.hide()}t&&n()&&(t.addEventListener("webkitplaybacktargetavailabilitychanged",e),this.on("dispose",function(){t.removeEventListener("webkitplaybacktargetavailabilitychanged",e)}))}}t.registerComponent("airPlayButton",e)}},{"../lib/hasAirPlayAPISupport":4}],2:[function(t,i,e){var n=t("./lib/hasAirPlayAPISupport");function a(t){t.on("airPlayRequested",function(t){(t=t.el().querySelector("video, audio"))&&t.webkitShowPlaybackTargetPicker&&t.webkitShowPlaybackTargetPicker()}.bind(null,t))}i.exports=function(t){t.registerPlugin("airPlay",function(t){t=Object.assign({addButtonToControlBar:!0},t||{});this.ready(function(t,i){var e;t.controlBar&&n()&&(a(t),i=i,e=(t=t).controlBar.getChild("airPlayButton"),i.addButtonToControlBar)&&!e&&(e=t.controlBar.children().length,void 0!==i.buttonPositionIndex&&(e=0<=i.buttonPositionIndex?i.buttonPositionIndex:t.controlBar.children().length+i.buttonPositionIndex),t.controlBar.addChild("airPlayButton",i,e))}.bind(this,this,t))})}},{"./lib/hasAirPlayAPISupport":4}],3:[function(t,i,e){var n=t("./components/AirPlayButton"),a=t("./enableAirPlay");i.exports=function(t){t=t||window.videojs,n(t),a(t)}},{"./components/AirPlayButton":1,"./enableAirPlay":2}],4:[function(t,i,e){i.exports=function(){return!!window.WebKitPlaybackTargetAvailabilityEvent}},{}],5:[function(t,i,e){t("./index")()},{"./index":3}]},{},[5]); |