Files
pgsql-jellyfin/publish_test2/wwwroot/youtubePlayer-plugin.c07fa18848798922d354.chunk.js
T

1 line
6.1 KiB
JavaScript

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[70555],{8255:function(e,t,r){r.r(t),r(29305),r(32733),r(84701),r(81678),r(84734),r(44962),r(4754),r(94),r(36947),r(78557),r(90076),r(83994),r(82367),r(99102);var n=r(34789),o=r(70267),i=r(8566),u=r(89166),a=r(38783),l=r(44797);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function d(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}var y={2:"YoutubeBadRequest",5:"YoutubePlaybackError",100:"YoutubeNotFound",101:"YoutubeDenied",150:"YoutubeDenied"};function f(){var e=this.currentYoutubePlayer,t=this.videoDialog;e&&t&&e.setSize(t.offsetWidth,t.offsetHeight)}function v(e){e.timeUpdateInterval&&clearInterval(e.timeUpdateInterval),e.timeUpdateInterval=null}function m(e){v(e);var t=e.resizeListener;t&&(window.removeEventListener("resize",t),window.removeEventListener("orientationChange",t),e.resizeListener=null);var r={src:e._currentSrc};l.A.trigger(e,"stopped",[r]),e._currentSrc=null,e.currentYoutubePlayer&&e.currentYoutubePlayer.destroy(),e.currentYoutubePlayer=null}function h(e){e.target.playVideo()}function p(){l.A.trigger(this,"timeupdate")}function b(e,t,r){e.started||(e.started=!0,r(),v(e),e.timeUpdateInterval=setInterval(p.bind(e),500),t.fullscreen?o.appRouter.showVideoOsd().then((function(){e.videoDialog.classList.remove("onTop")})):((0,u.FB)(u.KH.Backdrop),e.videoDialog.classList.remove("onTop")),i.Ay.hide())}var P=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="Youtube Player",this.type=a.Q.MediaPlayer,this.id="youtubeplayer",this.priority=1},t=[{key:"play",value:function(e){this.started=!1;var t=this;return function(e,t){return new Promise((function(o){var u=document.querySelector(".youtubePlayerContainer");u?(t.fullscreen&&document.body.classList.add("hide-scroll"),o(u.querySelector("#player"))):r.e(49890).then(r.bind(r,47312)).then((function(){i.Ay.show();var r=document.createElement("div");r.classList.add("youtubePlayerContainer"),t.fullscreen&&r.classList.add("onTop"),r.innerHTML='<div id="player"></div>';var u,a,l=r.querySelector("#player");document.body.insertBefore(r,document.body.firstChild),e.videoDialog=r,t.fullscreen&&document.body.classList.add("hide-scroll"),t.fullscreen&&r.animate&&!n.A.slow?(u=r,a={duration:240,iterations:1},u.animate([{transform:"scale3d(.2, .2, .2) ",opacity:".6",offset:0},{transform:"none",opacity:"1",offset:1}],a)).onfinish=function(){o(l)}:o(l)}))}))}(this,e).then((function(r){return function(e,t,r){return new Promise((function(t,n){e._currentSrc=r.url;var o=new URLSearchParams(r.url.split("?")[1]);if(window.onYouTubeIframeAPIReady=function(){e.currentYoutubePlayer=new YT.Player("player",{height:e.videoDialog.offsetHeight,width:e.videoDialog.offsetWidth,videoId:o.get("v"),events:{onReady:h,onStateChange:function(n){n.data===YT.PlayerState.PLAYING?b(e,r,t):n.data===YT.PlayerState.ENDED?m(e):n.data===YT.PlayerState.PAUSED&&l.A.trigger(e,"pause")},onError:function(e){return n(y[e.data]||"ErrorDefault")}},playerVars:{controls:0,enablejsapi:1,modestbranding:1,rel:0,showinfo:0,fs:0,playsinline:1}});var i=e.resizeListener;i?(window.removeEventListener("resize",i),window.addEventListener("resize",i)):(i=e.resizeListener=f.bind(e),window.addEventListener("resize",i)),window.removeEventListener("orientationChange",i),window.addEventListener("orientationChange",i)},window.YT)window.onYouTubeIframeAPIReady();else{var i=document.createElement("script");i.src="https://www.youtube.com/iframe_api";var u=document.getElementsByTagName("script")[0];u.parentNode.insertBefore(i,u)}}))}(t,0,e)}))}},{key:"stop",value:function(e){return this._currentSrc&&(this.currentYoutubePlayer&&this.currentYoutubePlayer.stopVideo(),m(this),e&&this.destroy()),Promise.resolve()}},{key:"destroy",value:function(){(0,u.FB)(u.KH.None),document.body.classList.remove("hide-scroll");var e=this.videoDialog;e&&(this.videoDialog=null,e.parentNode.removeChild(e))}},{key:"canPlayMediaType",value:function(e){return"audio"===(e=(e||"").toLowerCase())||"video"===e}},{key:"canPlayItem",value:function(){return!1}},{key:"canPlayUrl",value:function(e){return-1!==e.toLowerCase().indexOf("youtube.com")}},{key:"getDeviceProfile",value:function(){return Promise.resolve({})}},{key:"currentSrc",value:function(){return this._currentSrc}},{key:"setSubtitleStreamIndex",value:function(){}},{key:"canSetAudioStreamIndex",value:function(){return!1}},{key:"setAudioStreamIndex",value:function(){}},{key:"currentTime",value:function(e){var t=this.currentYoutubePlayer;if(t)return null!=e?void t.seekTo(e/1e3,!0):1e3*t.getCurrentTime()}},{key:"duration",value:function(){var e=this.currentYoutubePlayer;return e?1e3*e.getDuration():null}},{key:"pause",value:function(){var e=this.currentYoutubePlayer;if(e){e.pauseVideo();var t=this;setTimeout((function(){l.A.trigger(t,"pause")}),200)}}},{key:"unpause",value:function(){var e=this.currentYoutubePlayer;if(e){e.playVideo();var t=this;setTimeout((function(){l.A.trigger(t,"unpause")}),200)}}},{key:"paused",value:function(){var e=this.currentYoutubePlayer;return!!e&&2===e.getPlayerState()}},{key:"volume",value:function(e){return null!=e?this.setVolume(e):this.getVolume()}},{key:"setVolume",value:function(e){var t=this.currentYoutubePlayer;t&&null!=e&&t.setVolume(e)}},{key:"getVolume",value:function(){var e=this.currentYoutubePlayer;if(e)return e.getVolume()}},{key:"setMute",value:function(e){var t=this.currentYoutubePlayer;e?t&&t.mute():t&&t.unMute()}},{key:"isMuted",value:function(){var e=this.currentYoutubePlayer;if(e)return e.isMuted()}}],t&&c(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();t.default=P}}]);