Current Path : C:/xampp/htdocs/moodle/media/player/videojs/amd/build/ |
Current File : C:/xampp/htdocs/moodle/media/player/videojs/amd/build/Youtube-lazy.min.js |
function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}(function(a,b){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module){var c=require("video.js");module.exports=b(c.default||c)}else if("function"==typeof define&&define.amd){define ("media_videojs/Youtube-lazy",["media_videojs/video-lazy"],function(c){return a.Youtube=b(c)})}else{a.Youtube=b(a.videojs)}})(this,function(a){'use strict';var e=a.browser.IS_IOS||a.browser.IS_NATIVE_ANDROID,f=a.getTech("Tech"),g=a.extend(f,{constructor:function constructor(a,b){f.call(this,a,b);this.setPoster(a.poster);this.setSrc(this.options_.source,!0);this.setTimeout(function(){if(this.el_){this.el_.parentNode.className+=" vjs-youtube";if(e){this.el_.parentNode.className+=" vjs-youtube-mobile"}if(g.isApiReady){this.initYTPlayer()}else{g.apiReadyQueue.push(this)}}}.bind(this))},dispose:function dispose(){if(this.ytPlayer){if(this.ytPlayer.stopVideo){this.ytPlayer.stopVideo()}if(this.ytPlayer.destroy){this.ytPlayer.destroy()}}else{var a=g.apiReadyQueue.indexOf(this);if(-1!==a){g.apiReadyQueue.splice(a,1)}}this.ytPlayer=null;this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-youtube","").replace(" vjs-youtube-mobile","");this.el_.parentNode.removeChild(this.el_);f.prototype.dispose.call(this)},createEl:function createEl(){var a=document.createElement("div");a.setAttribute("id",this.options_.techId);a.setAttribute("style","width:100%;height:100%;top:0;left:0;position:absolute");a.setAttribute("class","vjs-tech");var b=document.createElement("div");b.appendChild(a);if(!e&&!this.options_.ytControls){var c=document.createElement("div");c.setAttribute("class","vjs-iframe-blocker");c.setAttribute("style","position:absolute;top:0;left:0;width:100%;height:100%");c.onclick=function(){this.pause()}.bind(this);b.appendChild(c)}return b},initYTPlayer:function initYTPlayer(){var a={controls:0,modestbranding:1,rel:0,showinfo:0,loop:this.options_.loop?1:0};if("undefined"!=typeof this.options_.autohide){a.autohide=this.options_.autohide}if("undefined"!=typeof this.options_.cc_load_policy){a.cc_load_policy=this.options_.cc_load_policy}if("undefined"!=typeof this.options_.ytControls){a.controls=this.options_.ytControls}if("undefined"!=typeof this.options_.disablekb){a.disablekb=this.options_.disablekb}if("undefined"!=typeof this.options_.color){a.color=this.options_.color}if(!a.controls){a.fs=0}else if("undefined"!=typeof this.options_.fs){a.fs=this.options_.fs}if(-1!==this.options_.source.src.indexOf("end=")){var b=this.options_.source.src.match(/end=([0-9]*)/);this.options_.end=parseInt(b[1])}if("undefined"!=typeof this.options_.end){a.end=this.options_.end}if("undefined"!=typeof this.options_.hl){a.hl=this.options_.hl}else if("undefined"!=typeof this.options_.language){a.hl=this.options_.language.substr(0,2)}if("undefined"!=typeof this.options_.iv_load_policy){a.iv_load_policy=this.options_.iv_load_policy}if("undefined"!=typeof this.options_.list){a.list=this.options_.list}else if(this.url&&"undefined"!=typeof this.url.listId){a.list=this.url.listId}if("undefined"!=typeof this.options_.listType){a.listType=this.options_.listType}if("undefined"!=typeof this.options_.modestbranding){a.modestbranding=this.options_.modestbranding}if("undefined"!=typeof this.options_.playlist){a.playlist=this.options_.playlist}if("undefined"!=typeof this.options_.playsinline){a.playsinline=this.options_.playsinline}if("undefined"!=typeof this.options_.rel){a.rel=this.options_.rel}if("undefined"!=typeof this.options_.showinfo){a.showinfo=this.options_.showinfo}if(-1!==this.options_.source.src.indexOf("start=")){var c=this.options_.source.src.match(/start=([0-9]*)/);this.options_.start=parseInt(c[1])}if("undefined"!=typeof this.options_.start){a.start=this.options_.start}if("undefined"!=typeof this.options_.theme){a.theme=this.options_.theme}if("undefined"!=typeof this.options_.customVars){var d=this.options_.customVars;Object.keys(d).forEach(function(b){a[b]=d[b]})}this.activeVideoId=this.url?this.url.videoId:null;this.activeList=a.list;var e={videoId:this.activeVideoId,playerVars:a,events:{onReady:this.onPlayerReady.bind(this),onPlaybackQualityChange:this.onPlayerPlaybackQualityChange.bind(this),onPlaybackRateChange:this.onPlayerPlaybackRateChange.bind(this),onStateChange:this.onPlayerStateChange.bind(this),onVolumeChange:this.onPlayerVolumeChange.bind(this),onError:this.onPlayerError.bind(this)}};if("undefined"!=typeof this.options_.enablePrivacyEnhancedMode&&this.options_.enablePrivacyEnhancedMode){e.host="https://www.youtube-nocookie.com"}this.ytPlayer=new YT.Player(this.options_.techId,e)},onPlayerReady:function onPlayerReady(){if(this.options_.muted){this.ytPlayer.mute()}var a=this.ytPlayer.getAvailablePlaybackRates();if(1<a.length){this.featuresPlaybackRate=!0}this.playerReady_=!0;this.triggerReady();if(this.playOnReady){this.play()}else if(this.cueOnReady){this.cueVideoById_(this.url.videoId);this.activeVideoId=this.url.videoId}},onPlayerPlaybackQualityChange:function onPlayerPlaybackQualityChange(){},onPlayerPlaybackRateChange:function onPlayerPlaybackRateChange(){this.trigger("ratechange")},onPlayerStateChange:function onPlayerStateChange(a){var b=a.data;if(b===this.lastState||this.errorNumber){return}this.lastState=b;switch(b){case-1:this.trigger("loadstart");this.trigger("loadedmetadata");this.trigger("durationchange");this.trigger("ratechange");break;case YT.PlayerState.ENDED:this.trigger("ended");break;case YT.PlayerState.PLAYING:this.trigger("timeupdate");this.trigger("durationchange");this.trigger("playing");this.trigger("play");if(this.isSeeking){this.onSeeked()}break;case YT.PlayerState.PAUSED:this.trigger("canplay");if(this.isSeeking){this.onSeeked()}else{this.trigger("pause")}break;case YT.PlayerState.BUFFERING:this.player_.trigger("timeupdate");this.player_.trigger("waiting");break;}},onPlayerVolumeChange:function onPlayerVolumeChange(){this.trigger("volumechange")},onPlayerError:function onPlayerError(a){this.errorNumber=a.data;this.trigger("pause");this.trigger("error")},error:function error(){var a=1e3+this.errorNumber;switch(this.errorNumber){case 5:return{code:a,message:"Error while trying to play the video"};case 2:case 100:return{code:a,message:"Unable to find the video"};case 101:case 150:return{code:a,message:"Playback on other Websites has been disabled by the video owner."};}return{code:a,message:"YouTube unknown error ("+this.errorNumber+")"}},loadVideoById_:function loadVideoById_(a){var b={videoId:a};if(this.options_.start){b.startSeconds=this.options_.start}if(this.options_.end){b.endSeconds=this.options_.end}this.ytPlayer.loadVideoById(b)},cueVideoById_:function cueVideoById_(a){var b={videoId:a};if(this.options_.start){b.startSeconds=this.options_.start}if(this.options_.end){b.endSeconds=this.options_.end}this.ytPlayer.cueVideoById(b)},src:function src(a){if(a){this.setSrc({src:a})}return this.source},poster:function poster(){if(e){return null}return this.poster_},setPoster:function setPoster(a){this.poster_=a},setSrc:function setSrc(a){if(!a||!a.src){return}delete this.errorNumber;this.source=a;this.url=g.parseUrl(a.src);if(!this.options_.poster){if(this.url.videoId){this.poster_="https://img.youtube.com/vi/"+this.url.videoId+"/0.jpg";this.trigger("posterchange");this.checkHighResPoster()}}if(this.options_.autoplay&&!e){if(this.isReady_){this.play()}else{this.playOnReady=!0}}else if(this.activeVideoId!==this.url.videoId){if(this.isReady_){this.cueVideoById_(this.url.videoId);this.activeVideoId=this.url.videoId}else{this.cueOnReady=!0}}},autoplay:function autoplay(){return this.options_.autoplay},setAutoplay:function setAutoplay(a){this.options_.autoplay=a},loop:function loop(){return this.options_.loop},setLoop:function setLoop(a){this.options_.loop=a},play:function play(){if(!this.url||!this.url.videoId){return}this.wasPausedBeforeSeek=!1;if(this.isReady_){if(this.url.listId){if(this.activeList===this.url.listId){this.ytPlayer.playVideo()}else{this.ytPlayer.loadPlaylist(this.url.listId);this.activeList=this.url.listId}}if(this.activeVideoId===this.url.videoId){this.ytPlayer.playVideo()}else{this.loadVideoById_(this.url.videoId);this.activeVideoId=this.url.videoId}}else{this.trigger("waiting");this.playOnReady=!0}},pause:function pause(){if(this.ytPlayer){this.ytPlayer.pauseVideo()}},paused:function paused(){return this.ytPlayer?this.lastState!==YT.PlayerState.PLAYING&&this.lastState!==YT.PlayerState.BUFFERING:!0},currentTime:function currentTime(){return this.ytPlayer?this.ytPlayer.getCurrentTime():0},setCurrentTime:function setCurrentTime(a){if(this.lastState===YT.PlayerState.PAUSED){this.timeBeforeSeek=this.currentTime()}if(!this.isSeeking){this.wasPausedBeforeSeek=this.paused()}this.ytPlayer.seekTo(a,!0);this.trigger("timeupdate");this.trigger("seeking");this.isSeeking=!0;if(this.lastState===YT.PlayerState.PAUSED&&this.timeBeforeSeek!==a){clearInterval(this.checkSeekedInPauseInterval);this.checkSeekedInPauseInterval=setInterval(function(){if(this.lastState!==YT.PlayerState.PAUSED||!this.isSeeking){clearInterval(this.checkSeekedInPauseInterval)}else if(this.currentTime()!==this.timeBeforeSeek){this.trigger("timeupdate");this.onSeeked()}}.bind(this),250)}},seeking:function seeking(){return this.isSeeking},seekable:function seekable(){if(!this.ytPlayer){return a.createTimeRange()}return a.createTimeRange(0,this.ytPlayer.getDuration())},onSeeked:function onSeeked(){clearInterval(this.checkSeekedInPauseInterval);this.isSeeking=!1;if(this.wasPausedBeforeSeek){this.pause()}this.trigger("seeked")},playbackRate:function playbackRate(){return this.ytPlayer?this.ytPlayer.getPlaybackRate():1},setPlaybackRate:function setPlaybackRate(a){if(!this.ytPlayer){return}this.ytPlayer.setPlaybackRate(a)},duration:function duration(){return this.ytPlayer?this.ytPlayer.getDuration():0},currentSrc:function currentSrc(){return this.source&&this.source.src},ended:function ended(){return this.ytPlayer?this.lastState===YT.PlayerState.ENDED:!1},volume:function volume(){return this.ytPlayer?this.ytPlayer.getVolume()/100:1},setVolume:function setVolume(a){if(!this.ytPlayer){return}this.ytPlayer.setVolume(100*a)},muted:function muted(){return this.ytPlayer?this.ytPlayer.isMuted():!1},setMuted:function setMuted(a){if(!this.ytPlayer){return}else{this.muted(!0)}if(a){this.ytPlayer.mute()}else{this.ytPlayer.unMute()}this.setTimeout(function(){this.trigger("volumechange")},50)},buffered:function buffered(){if(!this.ytPlayer||!this.ytPlayer.getVideoLoadedFraction){return a.createTimeRange()}var b=this.ytPlayer.getVideoLoadedFraction()*this.ytPlayer.getDuration();return a.createTimeRange(0,b)},preload:function preload(){},load:function load(){},reset:function reset(){},networkState:function networkState(){if(!this.ytPlayer){return 0}switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 3:return 2;default:return 1;}},readyState:function readyState(){if(!this.ytPlayer){return 0}switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 5:return 1;case 3:return 2;default:return 4;}},supportsFullScreen:function supportsFullScreen(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled},checkHighResPoster:function checkHighResPoster(){var a="https://img.youtube.com/vi/"+this.url.videoId+"/maxresdefault.jpg";try{var b=new Image;b.onload=function(){if("naturalHeight"in b){if(90>=b.naturalHeight||120>=b.naturalWidth){return}}else if(90>=b.height||120>=b.width){return}this.poster_=a;this.trigger("posterchange")}.bind(this);b.onerror=function(){};b.src=a}catch(a){}}});g.isSupported=function(){return!0};g.canPlaySource=function(a){return g.canPlayType(a.type)};g.canPlayType=function(a){return"video/youtube"===a};g.parseUrl=function(a){var b={videoId:null},c=a.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);if(c&&11===c[2].length){b.videoId=c[2]}c=a.match(/[?&]list=([^#\&\?]+)/);if(c&&c[1]){b.listId=c[1]}return b};function b(){YT.ready(function(){g.isApiReady=!0;for(var a=0;a<g.apiReadyQueue.length;++a){g.apiReadyQueue[a].initYTPlayer()}})}function c(a,b){var c=!1,d=document.createElement("script"),e=document.getElementsByTagName("script")[0];if(!e){return}e.parentNode.insertBefore(d,e);d.onload=function(){if(!c){c=!0;b()}};d.onreadystatechange=function(){if(!c&&("complete"===this.readyState||"loaded"===this.readyState)){c=!0;b()}};d.src=a}function d(){var a=document.head||document.getElementsByTagName("head")[0],b=document.createElement("style");b.type="text/css";if(b.styleSheet){b.styleSheet.cssText=".vjs-youtube .vjs-iframe-blocker { display: none; }.vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }.vjs-youtube .vjs-poster { background-size: cover; }.vjs-youtube-mobile .vjs-big-play-button { display: none; }"}else{b.appendChild(document.createTextNode(".vjs-youtube .vjs-iframe-blocker { display: none; }.vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }.vjs-youtube .vjs-poster { background-size: cover; }.vjs-youtube-mobile .vjs-big-play-button { display: none; }"))}a.appendChild(b)}g.apiReadyQueue=[];if("undefined"!=typeof document){c("https://www.youtube.com/iframe_api",b);d()}if("undefined"!=typeof a.registerTech){a.registerTech("Youtube",g)}else{a.registerComponent("Youtube",g)}}); //# sourceMappingURL=Youtube-lazy.min.js.map