From f1ecd6a940c585d124b01b0e7b0d949287c86913 Mon Sep 17 00:00:00 2001 From: Huong Nguyen Date: Wed, 14 Jun 2023 14:24:15 +0700 Subject: [PATCH] MDL-76917 Libraries: Upgrade YouTube Playback Technology to 3.0.0 --- .../videojs/amd/build/Youtube-lazy.min.js | 2 +- .../videojs/amd/build/Youtube-lazy.min.js.map | 2 +- media/player/videojs/amd/src/Youtube-lazy.js | 204 +++++++++--------- media/player/videojs/readme_moodle.txt | 13 +- media/player/videojs/thirdpartylibs.xml | 2 +- 5 files changed, 116 insertions(+), 107 deletions(-) diff --git a/media/player/videojs/amd/build/Youtube-lazy.min.js b/media/player/videojs/amd/build/Youtube-lazy.min.js index 0f35fbf6e2e..a6dd6b704da 100644 --- a/media/player/videojs/amd/build/Youtube-lazy.min.js +++ b/media/player/videojs/amd/build/Youtube-lazy.min.js @@ -1,3 +1,3 @@ -!function(root,factory){if("object"==typeof exports&&"undefined"!=typeof module){var videojs=require("video.js");module.exports=factory(videojs.default||videojs)}else"function"==typeof define&&define.amd?define("media_videojs/Youtube-lazy",["media_videojs/video-lazy"],(function(videojs){return root.Youtube=factory(videojs)})):root.Youtube=factory(root.videojs)}(window,(function(videojs){var css,head,style,src,callback,loaded,tag,firstScriptTag,_isOnMobile=videojs.browser.IS_IOS||videojs.browser.IS_NATIVE_ANDROID,Tech=videojs.getTech("Tech"),Youtube=videojs.extend(Tech,{constructor:function(options,ready){Tech.call(this,options,ready),this.setPoster(options.poster),this.setSrc(this.options_.source,!0),this.setTimeout(function(){this.el_&&(this.el_.parentNode.className+=" vjs-youtube",_isOnMobile&&(this.el_.parentNode.className+=" vjs-youtube-mobile"),Youtube.isApiReady?this.initYTPlayer():Youtube.apiReadyQueue.push(this))}.bind(this))},dispose:function(){if(this.ytPlayer)this.ytPlayer.stopVideo&&this.ytPlayer.stopVideo(),this.ytPlayer.destroy&&this.ytPlayer.destroy();else{var index=Youtube.apiReadyQueue.indexOf(this);-1!==index&&Youtube.apiReadyQueue.splice(index,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_),Tech.prototype.dispose.call(this)},createEl:function(){var div=document.createElement("div");div.setAttribute("id",this.options_.techId),div.setAttribute("style","width:100%;height:100%;top:0;left:0;position:absolute"),div.setAttribute("class","vjs-tech");var divWrapper=document.createElement("div");if(divWrapper.appendChild(div),!_isOnMobile&&!this.options_.ytControls){var divBlocker=document.createElement("div");divBlocker.setAttribute("class","vjs-iframe-blocker"),divBlocker.setAttribute("style","position:absolute;top:0;left:0;width:100%;height:100%"),divBlocker.onclick=function(){this.pause()}.bind(this),divWrapper.appendChild(divBlocker)}return divWrapper},initYTPlayer:function(){var playerVars={controls:0,modestbranding:1,rel:0,showinfo:0,loop:this.options_.loop?1:0};if(void 0!==this.options_.autohide&&(playerVars.autohide=this.options_.autohide),void 0!==this.options_.cc_load_policy&&(playerVars.cc_load_policy=this.options_.cc_load_policy),void 0!==this.options_.ytControls&&(playerVars.controls=this.options_.ytControls),void 0!==this.options_.disablekb&&(playerVars.disablekb=this.options_.disablekb),void 0!==this.options_.color&&(playerVars.color=this.options_.color),playerVars.controls?void 0!==this.options_.fs&&(playerVars.fs=this.options_.fs):playerVars.fs=0,-1!==this.options_.source.src.indexOf("end=")){var srcEndTime=this.options_.source.src.match(/end=([0-9]*)/);this.options_.end=parseInt(srcEndTime[1])}if(void 0!==this.options_.end&&(playerVars.end=this.options_.end),void 0!==this.options_.hl?playerVars.hl=this.options_.hl:void 0!==this.options_.language&&(playerVars.hl=this.options_.language.substr(0,2)),void 0!==this.options_.iv_load_policy&&(playerVars.iv_load_policy=this.options_.iv_load_policy),void 0!==this.options_.list?playerVars.list=this.options_.list:this.url&&void 0!==this.url.listId&&(playerVars.list=this.url.listId),void 0!==this.options_.listType&&(playerVars.listType=this.options_.listType),void 0!==this.options_.modestbranding&&(playerVars.modestbranding=this.options_.modestbranding),void 0!==this.options_.playlist&&(playerVars.playlist=this.options_.playlist),void 0!==this.options_.playsinline&&(playerVars.playsinline=this.options_.playsinline),void 0!==this.options_.rel&&(playerVars.rel=this.options_.rel),void 0!==this.options_.showinfo&&(playerVars.showinfo=this.options_.showinfo),-1!==this.options_.source.src.indexOf("start=")){var srcStartTime=this.options_.source.src.match(/start=([0-9]*)/);this.options_.start=parseInt(srcStartTime[1])}if(void 0!==this.options_.start&&(playerVars.start=this.options_.start),void 0!==this.options_.theme&&(playerVars.theme=this.options_.theme),void 0!==this.options_.customVars){var customVars=this.options_.customVars;Object.keys(customVars).forEach((function(key){playerVars[key]=customVars[key]}))}this.activeVideoId=this.url?this.url.videoId:null,this.activeList=playerVars.list;var playerConfig={videoId:this.activeVideoId,playerVars:playerVars,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)}};void 0!==this.options_.enablePrivacyEnhancedMode&&this.options_.enablePrivacyEnhancedMode&&(playerConfig.host="https://www.youtube-nocookie.com"),this.ytPlayer=new YT.Player(this.options_.techId,playerConfig)},onPlayerReady:function(){this.options_.muted&&this.ytPlayer.mute(),this.ytPlayer.getAvailablePlaybackRates().length>1&&(this.featuresPlaybackRate=!0),this.playerReady_=!0,this.triggerReady(),this.playOnReady?this.play():this.cueOnReady&&(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)},onPlayerPlaybackQualityChange:function(){},onPlayerPlaybackRateChange:function(){this.trigger("ratechange")},onPlayerStateChange:function(e){var state=e.data;if(state!==this.lastState&&!this.errorNumber)switch(this.lastState=state,state){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"),this.isSeeking&&this.onSeeked();break;case YT.PlayerState.PAUSED:this.trigger("canplay"),this.isSeeking?this.onSeeked():this.trigger("pause");break;case YT.PlayerState.BUFFERING:this.player_.trigger("timeupdate"),this.player_.trigger("waiting")}},onPlayerVolumeChange:function(){this.trigger("volumechange")},onPlayerError:function(e){this.errorNumber=e.data,this.trigger("pause"),this.trigger("error")},error:function(){var code=1e3+this.errorNumber;switch(this.errorNumber){case 5:return{code:code,message:"Error while trying to play the video"};case 2:case 100:return{code:code,message:"Unable to find the video"};case 101:case 150:return{code:code,message:"Playback on other Websites has been disabled by the video owner."}}return{code:code,message:"YouTube unknown error ("+this.errorNumber+")"}},loadVideoById_:function(id){var options={videoId:id};this.options_.start&&(options.startSeconds=this.options_.start),this.options_.end&&(options.endSeconds=this.options_.end),this.ytPlayer.loadVideoById(options)},cueVideoById_:function(id){var options={videoId:id};this.options_.start&&(options.startSeconds=this.options_.start),this.options_.end&&(options.endSeconds=this.options_.end),this.ytPlayer.cueVideoById(options)},src:function(src){return src&&this.setSrc({src:src}),this.source},poster:function(){return _isOnMobile?null:this.poster_},setPoster:function(poster){this.poster_=poster},setSrc:function(source){source&&source.src&&(delete this.errorNumber,this.source=source,this.url=Youtube.parseUrl(source.src),this.options_.poster||this.url.videoId&&(this.poster_="https://img.youtube.com/vi/"+this.url.videoId+"/0.jpg",this.trigger("posterchange"),this.checkHighResPoster()),this.options_.autoplay&&!_isOnMobile?this.isReady_?this.play():this.playOnReady=!0:this.activeVideoId!==this.url.videoId&&(this.isReady_?(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId):this.cueOnReady=!0))},autoplay:function(){return this.options_.autoplay},setAutoplay:function(val){this.options_.autoplay=val},loop:function(){return this.options_.loop},setLoop:function(val){this.options_.loop=val},play:function(){this.url&&this.url.videoId&&(this.wasPausedBeforeSeek=!1,this.isReady_?(this.url.listId&&(this.activeList===this.url.listId?this.ytPlayer.playVideo():(this.ytPlayer.loadPlaylist(this.url.listId),this.activeList=this.url.listId)),this.activeVideoId===this.url.videoId?this.ytPlayer.playVideo():(this.loadVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)):(this.trigger("waiting"),this.playOnReady=!0))},pause:function(){this.ytPlayer&&this.ytPlayer.pauseVideo()},paused:function(){return!this.ytPlayer||this.lastState!==YT.PlayerState.PLAYING&&this.lastState!==YT.PlayerState.BUFFERING},currentTime:function(){return this.ytPlayer?this.ytPlayer.getCurrentTime():0},setCurrentTime:function(seconds){this.lastState===YT.PlayerState.PAUSED&&(this.timeBeforeSeek=this.currentTime()),this.isSeeking||(this.wasPausedBeforeSeek=this.paused()),this.ytPlayer.seekTo(seconds,!0),this.trigger("timeupdate"),this.trigger("seeking"),this.isSeeking=!0,this.lastState===YT.PlayerState.PAUSED&&this.timeBeforeSeek!==seconds&&(clearInterval(this.checkSeekedInPauseInterval),this.checkSeekedInPauseInterval=setInterval(function(){this.lastState===YT.PlayerState.PAUSED&&this.isSeeking?this.currentTime()!==this.timeBeforeSeek&&(this.trigger("timeupdate"),this.onSeeked()):clearInterval(this.checkSeekedInPauseInterval)}.bind(this),250))},seeking:function(){return this.isSeeking},seekable:function(){return this.ytPlayer?videojs.createTimeRange(0,this.ytPlayer.getDuration()):videojs.createTimeRange()},onSeeked:function(){clearInterval(this.checkSeekedInPauseInterval),this.isSeeking=!1,this.wasPausedBeforeSeek&&this.pause(),this.trigger("seeked")},playbackRate:function(){return this.ytPlayer?this.ytPlayer.getPlaybackRate():1},setPlaybackRate:function(suggestedRate){this.ytPlayer&&this.ytPlayer.setPlaybackRate(suggestedRate)},duration:function(){return this.ytPlayer?this.ytPlayer.getDuration():0},currentSrc:function(){return this.source&&this.source.src},ended:function(){return!!this.ytPlayer&&this.lastState===YT.PlayerState.ENDED},volume:function(){return this.ytPlayer?this.ytPlayer.getVolume()/100:1},setVolume:function(percentAsDecimal){this.ytPlayer&&this.ytPlayer.setVolume(100*percentAsDecimal)},muted:function(){return!!this.ytPlayer&&this.ytPlayer.isMuted()},setMuted:function(mute){this.ytPlayer&&(this.muted(!0),mute?this.ytPlayer.mute():this.ytPlayer.unMute(),this.setTimeout((function(){this.trigger("volumechange")}),50))},buffered:function(){if(!this.ytPlayer||!this.ytPlayer.getVideoLoadedFraction)return videojs.createTimeRange();var bufferedEnd=this.ytPlayer.getVideoLoadedFraction()*this.ytPlayer.getDuration();return videojs.createTimeRange(0,bufferedEnd)},preload:function(){},load:function(){},reset:function(){},networkState:function(){if(!this.ytPlayer)return 0;switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 3:return 2;default:return 1}},readyState:function(){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(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled},checkHighResPoster:function(){var uri="https://img.youtube.com/vi/"+this.url.videoId+"/maxresdefault.jpg";try{var image=new Image;image.onload=function(){if("naturalHeight"in image){if(image.naturalHeight<=90||image.naturalWidth<=120)return}else if(image.height<=90||image.width<=120)return;this.poster_=uri,this.trigger("posterchange")}.bind(this),image.onerror=function(){},image.src=uri}catch(e){}}});Youtube.isSupported=function(){return!0},Youtube.canPlaySource=function(e){return Youtube.canPlayType(e.type)},Youtube.canPlayType=function(e){return"video/youtube"===e},Youtube.parseUrl=function(url){var result={videoId:null},match=url.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);match&&11===match[2].length&&(result.videoId=match[2]);return(match=url.match(/[?&]list=([^#\&\?]+)/))&&match[1]&&(result.listId=match[1]),result},Youtube.apiReadyQueue=[],"undefined"!=typeof document&&(src="https://www.youtube.com/iframe_api",callback=function(){YT.ready((function(){Youtube.isApiReady=!0;for(var i=0;i1&&(this.featuresPlaybackRate=!0),this.playerReady_=!0,this.triggerReady(),this.playOnReady?this.play():this.cueOnReady&&(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)}onPlayerPlaybackQualityChange(){}onPlayerPlaybackRateChange(){this.trigger("ratechange")}onPlayerStateChange(e){var state=e.data;if(state!==this.lastState&&!this.errorNumber)switch(this.lastState=state,state){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"),this.isSeeking&&this.onSeeked();break;case YT.PlayerState.PAUSED:this.trigger("canplay"),this.isSeeking?this.onSeeked():this.trigger("pause");break;case YT.PlayerState.BUFFERING:this.player_.trigger("timeupdate"),this.player_.trigger("waiting")}}onPlayerVolumeChange(){this.trigger("volumechange")}onPlayerError(e){this.errorNumber=e.data,this.trigger("pause"),this.trigger("error")}error(){var code=1e3+this.errorNumber;switch(this.errorNumber){case 5:return{code:code,message:"Error while trying to play the video"};case 2:case 100:return{code:code,message:"Unable to find the video"};case 101:case 150:return{code:code,message:"Playback on other Websites has been disabled by the video owner."}}return{code:code,message:"YouTube unknown error ("+this.errorNumber+")"}}loadVideoById_(id){var options={videoId:id};this.options_.start&&(options.startSeconds=this.options_.start),this.options_.end&&(options.endSeconds=this.options_.end),this.ytPlayer.loadVideoById(options)}cueVideoById_(id){var options={videoId:id};this.options_.start&&(options.startSeconds=this.options_.start),this.options_.end&&(options.endSeconds=this.options_.end),this.ytPlayer.cueVideoById(options)}src(src){return src&&this.setSrc({src:src}),this.source}poster(){return _isOnMobile?null:this.poster_}setPoster(poster){this.poster_=poster}setSrc(source){source&&source.src&&(delete this.errorNumber,this.source=source,this.url=Youtube.parseUrl(source.src),this.options_.poster||this.url.videoId&&(this.poster_="https://img.youtube.com/vi/"+this.url.videoId+"/0.jpg",this.trigger("posterchange"),this.checkHighResPoster()),this.options_.autoplay&&!_isOnMobile?this.isReady_?this.play():this.playOnReady=!0:this.activeVideoId!==this.url.videoId&&(this.isReady_?(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId):this.cueOnReady=!0))}autoplay(){return this.options_.autoplay}setAutoplay(val){this.options_.autoplay=val}loop(){return this.options_.loop}setLoop(val){this.options_.loop=val}play(){this.url&&this.url.videoId&&(this.wasPausedBeforeSeek=!1,this.isReady_?(this.url.listId&&(this.activeList===this.url.listId?this.ytPlayer.playVideo():(this.ytPlayer.loadPlaylist(this.url.listId),this.activeList=this.url.listId)),this.activeVideoId===this.url.videoId?this.ytPlayer.playVideo():(this.loadVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)):(this.trigger("waiting"),this.playOnReady=!0))}pause(){this.ytPlayer&&this.ytPlayer.pauseVideo()}paused(){return!this.ytPlayer||this.lastState!==YT.PlayerState.PLAYING&&this.lastState!==YT.PlayerState.BUFFERING}currentTime(){return this.ytPlayer?this.ytPlayer.getCurrentTime():0}setCurrentTime(seconds){this.lastState===YT.PlayerState.PAUSED&&(this.timeBeforeSeek=this.currentTime()),this.isSeeking||(this.wasPausedBeforeSeek=this.paused()),this.ytPlayer.seekTo(seconds,!0),this.trigger("timeupdate"),this.trigger("seeking"),this.isSeeking=!0,this.lastState===YT.PlayerState.PAUSED&&this.timeBeforeSeek!==seconds&&(clearInterval(this.checkSeekedInPauseInterval),this.checkSeekedInPauseInterval=setInterval(function(){this.lastState===YT.PlayerState.PAUSED&&this.isSeeking?this.currentTime()!==this.timeBeforeSeek&&(this.trigger("timeupdate"),this.onSeeked()):clearInterval(this.checkSeekedInPauseInterval)}.bind(this),250))}seeking(){return this.isSeeking}seekable(){return this.ytPlayer?videojs.createTimeRange(0,this.ytPlayer.getDuration()):videojs.createTimeRange()}onSeeked(){clearInterval(this.checkSeekedInPauseInterval),this.isSeeking=!1,this.wasPausedBeforeSeek&&this.pause(),this.trigger("seeked")}playbackRate(){return this.ytPlayer?this.ytPlayer.getPlaybackRate():1}setPlaybackRate(suggestedRate){this.ytPlayer&&this.ytPlayer.setPlaybackRate(suggestedRate)}duration(){return this.ytPlayer?this.ytPlayer.getDuration():0}currentSrc(){return this.source&&this.source.src}ended(){return!!this.ytPlayer&&this.lastState===YT.PlayerState.ENDED}volume(){return this.ytPlayer?this.ytPlayer.getVolume()/100:1}setVolume(percentAsDecimal){this.ytPlayer&&this.ytPlayer.setVolume(100*percentAsDecimal)}muted(){return!!this.ytPlayer&&this.ytPlayer.isMuted()}setMuted(mute){this.ytPlayer&&(this.muted(!0),mute?this.ytPlayer.mute():this.ytPlayer.unMute(),this.setTimeout((function(){this.trigger("volumechange")}),50))}buffered(){if(!this.ytPlayer||!this.ytPlayer.getVideoLoadedFraction)return videojs.createTimeRange();var bufferedEnd=this.ytPlayer.getVideoLoadedFraction()*this.ytPlayer.getDuration();return videojs.createTimeRange(0,bufferedEnd)}preload(){}load(){}reset(){}networkState(){if(!this.ytPlayer)return 0;switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 3:return 2;default:return 1}}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(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled}checkHighResPoster(){var uri="https://img.youtube.com/vi/"+this.url.videoId+"/maxresdefault.jpg";try{var image=new Image;image.onload=function(){if("naturalHeight"in image){if(image.naturalHeight<=90||image.naturalWidth<=120)return}else if(image.height<=90||image.width<=120)return;this.poster_=uri,this.trigger("posterchange")}.bind(this),image.onerror=function(){},image.src=uri}catch(e){}}}Youtube.isSupported=function(){return!0},Youtube.canPlaySource=function(e){return Youtube.canPlayType(e.type)},Youtube.canPlayType=function(e){return"video/youtube"===e},Youtube.parseUrl=function(url){var result={videoId:null},match=url.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);match&&11===match[2].length&&(result.videoId=match[2]);return(match=url.match(/[?&]list=([^#\&\?]+)/))&&match[1]&&(result.listId=match[1]),result},Youtube.apiReadyQueue=[],"undefined"!=typeof document&&(src="https://www.youtube.com/iframe_api",callback=function(){YT.ready((function(){Youtube.isApiReady=!0;for(var i=0;i\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n/*global define, YT*/\n(function (root, factory) {\n if(typeof exports==='object' && typeof module!=='undefined') {\n var videojs = require('video.js');\n module.exports = factory(videojs.default || videojs);\n } else if(typeof define === 'function' && define.amd) {\n define(['media_videojs/video-lazy'], function(videojs){\n return (root.Youtube = factory(videojs));\n });\n } else {\n root.Youtube = factory(root.videojs);\n }\n}(this, function(videojs) {\n 'use strict';\n\n var _isOnMobile = videojs.browser.IS_IOS || videojs.browser.IS_NATIVE_ANDROID;\n var Tech = videojs.getTech('Tech');\n\n var Youtube = videojs.extend(Tech, {\n\n constructor: function(options, ready) {\n Tech.call(this, options, ready);\n\n this.setPoster(options.poster);\n this.setSrc(this.options_.source, true);\n\n // Set the vjs-youtube class to the player\n // Parent is not set yet so we have to wait a tick\n this.setTimeout(function() {\n if (this.el_) {\n this.el_.parentNode.className += ' vjs-youtube';\n\n if (_isOnMobile) {\n this.el_.parentNode.className += ' vjs-youtube-mobile';\n }\n\n if (Youtube.isApiReady) {\n this.initYTPlayer();\n } else {\n Youtube.apiReadyQueue.push(this);\n }\n }\n }.bind(this));\n },\n\n dispose: function() {\n if (this.ytPlayer) {\n //Dispose of the YouTube Player\n if (this.ytPlayer.stopVideo) {\n this.ytPlayer.stopVideo();\n }\n if (this.ytPlayer.destroy) {\n this.ytPlayer.destroy();\n }\n } else {\n //YouTube API hasn't finished loading or the player is already disposed\n var index = Youtube.apiReadyQueue.indexOf(this);\n if (index !== -1) {\n Youtube.apiReadyQueue.splice(index, 1);\n }\n }\n this.ytPlayer = null;\n\n this.el_.parentNode.className = this.el_.parentNode.className\n .replace(' vjs-youtube', '')\n .replace(' vjs-youtube-mobile', '');\n this.el_.parentNode.removeChild(this.el_);\n\n //Needs to be called after the YouTube player is destroyed, otherwise there will be a null reference exception\n Tech.prototype.dispose.call(this);\n },\n\n createEl: function() {\n var div = document.createElement('div');\n div.setAttribute('id', this.options_.techId);\n div.setAttribute('style', 'width:100%;height:100%;top:0;left:0;position:absolute');\n div.setAttribute('class', 'vjs-tech');\n\n var divWrapper = document.createElement('div');\n divWrapper.appendChild(div);\n\n if (!_isOnMobile && !this.options_.ytControls) {\n var divBlocker = document.createElement('div');\n divBlocker.setAttribute('class', 'vjs-iframe-blocker');\n divBlocker.setAttribute('style', 'position:absolute;top:0;left:0;width:100%;height:100%');\n\n // In case the blocker is still there and we want to pause\n divBlocker.onclick = function() {\n this.pause();\n }.bind(this);\n\n divWrapper.appendChild(divBlocker);\n }\n\n return divWrapper;\n },\n\n initYTPlayer: function() {\n var playerVars = {\n controls: 0,\n modestbranding: 1,\n rel: 0,\n showinfo: 0,\n loop: this.options_.loop ? 1 : 0\n };\n\n // Let the user set any YouTube parameter\n // https://developers.google.com/youtube/player_parameters?playerVersion=HTML5#Parameters\n // To use YouTube controls, you must use ytControls instead\n // To use the loop or autoplay, use the video.js settings\n\n if (typeof this.options_.autohide !== 'undefined') {\n playerVars.autohide = this.options_.autohide;\n }\n\n if (typeof this.options_['cc_load_policy'] !== 'undefined') {\n playerVars['cc_load_policy'] = this.options_['cc_load_policy'];\n }\n\n if (typeof this.options_.ytControls !== 'undefined') {\n playerVars.controls = this.options_.ytControls;\n }\n\n if (typeof this.options_.disablekb !== 'undefined') {\n playerVars.disablekb = this.options_.disablekb;\n }\n\n if (typeof this.options_.color !== 'undefined') {\n playerVars.color = this.options_.color;\n }\n\n if (!playerVars.controls) {\n // Let video.js handle the fullscreen unless it is the YouTube native controls\n playerVars.fs = 0;\n } else if (typeof this.options_.fs !== 'undefined') {\n playerVars.fs = this.options_.fs;\n }\n\n if (this.options_.source.src.indexOf('end=') !== -1) {\n var srcEndTime = this.options_.source.src.match(/end=([0-9]*)/);\n this.options_.end = parseInt(srcEndTime[1]);\n }\n\n if (typeof this.options_.end !== 'undefined') {\n playerVars.end = this.options_.end;\n }\n\n if (typeof this.options_.hl !== 'undefined') {\n playerVars.hl = this.options_.hl;\n } else if (typeof this.options_.language !== 'undefined') {\n // Set the YouTube player on the same language than video.js\n playerVars.hl = this.options_.language.substr(0, 2);\n }\n\n if (typeof this.options_['iv_load_policy'] !== 'undefined') {\n playerVars['iv_load_policy'] = this.options_['iv_load_policy'];\n }\n\n if (typeof this.options_.list !== 'undefined') {\n playerVars.list = this.options_.list;\n } else if (this.url && typeof this.url.listId !== 'undefined') {\n playerVars.list = this.url.listId;\n }\n\n if (typeof this.options_.listType !== 'undefined') {\n playerVars.listType = this.options_.listType;\n }\n\n if (typeof this.options_.modestbranding !== 'undefined') {\n playerVars.modestbranding = this.options_.modestbranding;\n }\n\n if (typeof this.options_.playlist !== 'undefined') {\n playerVars.playlist = this.options_.playlist;\n }\n\n if (typeof this.options_.playsinline !== 'undefined') {\n playerVars.playsinline = this.options_.playsinline;\n }\n\n if (typeof this.options_.rel !== 'undefined') {\n playerVars.rel = this.options_.rel;\n }\n\n if (typeof this.options_.showinfo !== 'undefined') {\n playerVars.showinfo = this.options_.showinfo;\n }\n\n if (this.options_.source.src.indexOf('start=') !== -1) {\n var srcStartTime = this.options_.source.src.match(/start=([0-9]*)/);\n this.options_.start = parseInt(srcStartTime[1]);\n }\n\n if (typeof this.options_.start !== 'undefined') {\n playerVars.start = this.options_.start;\n }\n\n if (typeof this.options_.theme !== 'undefined') {\n playerVars.theme = this.options_.theme;\n }\n\n // Allow undocumented options to be passed along via customVars\n if (typeof this.options_.customVars !== 'undefined') {\n var customVars = this.options_.customVars;\n Object.keys(customVars).forEach(function(key) {\n playerVars[key] = customVars[key];\n });\n }\n\n this.activeVideoId = this.url ? this.url.videoId : null;\n this.activeList = playerVars.list;\n\n var playerConfig = {\n videoId: this.activeVideoId,\n playerVars: playerVars,\n events: {\n onReady: this.onPlayerReady.bind(this),\n onPlaybackQualityChange: this.onPlayerPlaybackQualityChange.bind(this),\n onPlaybackRateChange: this.onPlayerPlaybackRateChange.bind(this),\n onStateChange: this.onPlayerStateChange.bind(this),\n onVolumeChange: this.onPlayerVolumeChange.bind(this),\n onError: this.onPlayerError.bind(this)\n }\n };\n\n if (typeof this.options_.enablePrivacyEnhancedMode !== 'undefined' && this.options_.enablePrivacyEnhancedMode) {\n playerConfig.host = 'https://www.youtube-nocookie.com';\n }\n\n this.ytPlayer = new YT.Player(this.options_.techId, playerConfig);\n },\n\n onPlayerReady: function() {\n if (this.options_.muted) {\n this.ytPlayer.mute();\n }\n\n var playbackRates = this.ytPlayer.getAvailablePlaybackRates();\n if (playbackRates.length > 1) {\n this.featuresPlaybackRate = true;\n }\n\n this.playerReady_ = true;\n this.triggerReady();\n\n if (this.playOnReady) {\n this.play();\n } else if (this.cueOnReady) {\n this.cueVideoById_(this.url.videoId);\n this.activeVideoId = this.url.videoId;\n }\n },\n\n onPlayerPlaybackQualityChange: function() {\n\n },\n\n onPlayerPlaybackRateChange: function() {\n this.trigger('ratechange');\n },\n\n onPlayerStateChange: function(e) {\n var state = e.data;\n\n if (state === this.lastState || this.errorNumber) {\n return;\n }\n\n this.lastState = state;\n\n switch (state) {\n case -1:\n this.trigger('loadstart');\n this.trigger('loadedmetadata');\n this.trigger('durationchange');\n this.trigger('ratechange');\n break;\n\n case YT.PlayerState.ENDED:\n this.trigger('ended');\n break;\n\n case YT.PlayerState.PLAYING:\n this.trigger('timeupdate');\n this.trigger('durationchange');\n this.trigger('playing');\n this.trigger('play');\n\n if (this.isSeeking) {\n this.onSeeked();\n }\n break;\n\n case YT.PlayerState.PAUSED:\n this.trigger('canplay');\n if (this.isSeeking) {\n this.onSeeked();\n } else {\n this.trigger('pause');\n }\n break;\n\n case YT.PlayerState.BUFFERING:\n this.player_.trigger('timeupdate');\n this.player_.trigger('waiting');\n break;\n }\n },\n\n onPlayerVolumeChange: function() {\n this.trigger('volumechange');\n },\n\n onPlayerError: function(e) {\n this.errorNumber = e.data;\n this.trigger('pause');\n this.trigger('error');\n },\n\n error: function() {\n var code = 1000 + this.errorNumber; // as smaller codes are reserved\n switch (this.errorNumber) {\n case 5:\n return { code: code, message: 'Error while trying to play the video' };\n\n case 2:\n case 100:\n return { code: code, message: 'Unable to find the video' };\n\n case 101:\n case 150:\n return {\n code: code,\n message: 'Playback on other Websites has been disabled by the video owner.'\n };\n }\n\n return { code: code, message: 'YouTube unknown error (' + this.errorNumber + ')' };\n },\n\n loadVideoById_: function(id) {\n var options = {\n videoId: id\n };\n if (this.options_.start) {\n options.startSeconds = this.options_.start;\n }\n if (this.options_.end) {\n options.endSeconds = this.options_.end;\n }\n this.ytPlayer.loadVideoById(options);\n },\n\n cueVideoById_: function(id) {\n var options = {\n videoId: id\n };\n if (this.options_.start) {\n options.startSeconds = this.options_.start;\n }\n if (this.options_.end) {\n options.endSeconds = this.options_.end;\n }\n this.ytPlayer.cueVideoById(options);\n },\n\n src: function(src) {\n if (src) {\n this.setSrc({ src: src });\n }\n\n return this.source;\n },\n\n poster: function() {\n // You can't start programmaticlly a video with a mobile\n // through the iframe so we hide the poster and the play button (with CSS)\n if (_isOnMobile) {\n return null;\n }\n\n return this.poster_;\n },\n\n setPoster: function(poster) {\n this.poster_ = poster;\n },\n\n setSrc: function(source) {\n if (!source || !source.src) {\n return;\n }\n\n delete this.errorNumber;\n this.source = source;\n this.url = Youtube.parseUrl(source.src);\n\n if (!this.options_.poster) {\n if (this.url.videoId) {\n // Set the low resolution first\n this.poster_ = 'https://img.youtube.com/vi/' + this.url.videoId + '/0.jpg';\n this.trigger('posterchange');\n\n // Check if their is a high res\n this.checkHighResPoster();\n }\n }\n\n if (this.options_.autoplay && !_isOnMobile) {\n if (this.isReady_) {\n this.play();\n } else {\n this.playOnReady = true;\n }\n } else if (this.activeVideoId !== this.url.videoId) {\n if (this.isReady_) {\n this.cueVideoById_(this.url.videoId);\n this.activeVideoId = this.url.videoId;\n } else {\n this.cueOnReady = true;\n }\n }\n },\n\n autoplay: function() {\n return this.options_.autoplay;\n },\n\n setAutoplay: function(val) {\n this.options_.autoplay = val;\n },\n\n loop: function() {\n return this.options_.loop;\n },\n\n setLoop: function(val) {\n this.options_.loop = val;\n },\n\n play: function() {\n if (!this.url || !this.url.videoId) {\n return;\n }\n\n this.wasPausedBeforeSeek = false;\n\n if (this.isReady_) {\n if (this.url.listId) {\n if (this.activeList === this.url.listId) {\n this.ytPlayer.playVideo();\n } else {\n this.ytPlayer.loadPlaylist(this.url.listId);\n this.activeList = this.url.listId;\n }\n }\n\n if (this.activeVideoId === this.url.videoId) {\n this.ytPlayer.playVideo();\n } else {\n this.loadVideoById_(this.url.videoId);\n this.activeVideoId = this.url.videoId;\n }\n } else {\n this.trigger('waiting');\n this.playOnReady = true;\n }\n },\n\n pause: function() {\n if (this.ytPlayer) {\n this.ytPlayer.pauseVideo();\n }\n },\n\n paused: function() {\n return (this.ytPlayer) ?\n (this.lastState !== YT.PlayerState.PLAYING && this.lastState !== YT.PlayerState.BUFFERING)\n : true;\n },\n\n currentTime: function() {\n return this.ytPlayer ? this.ytPlayer.getCurrentTime() : 0;\n },\n\n setCurrentTime: function(seconds) {\n if (this.lastState === YT.PlayerState.PAUSED) {\n this.timeBeforeSeek = this.currentTime();\n }\n\n if (!this.isSeeking) {\n this.wasPausedBeforeSeek = this.paused();\n }\n\n this.ytPlayer.seekTo(seconds, true);\n this.trigger('timeupdate');\n this.trigger('seeking');\n this.isSeeking = true;\n\n // A seek event during pause does not return an event to trigger a seeked event,\n // so run an interval timer to look for the currentTime to change\n if (this.lastState === YT.PlayerState.PAUSED && this.timeBeforeSeek !== seconds) {\n clearInterval(this.checkSeekedInPauseInterval);\n this.checkSeekedInPauseInterval = setInterval(function() {\n if (this.lastState !== YT.PlayerState.PAUSED || !this.isSeeking) {\n // If something changed while we were waiting for the currentTime to change,\n // clear the interval timer\n clearInterval(this.checkSeekedInPauseInterval);\n } else if (this.currentTime() !== this.timeBeforeSeek) {\n this.trigger('timeupdate');\n this.onSeeked();\n }\n }.bind(this), 250);\n }\n },\n\n seeking: function () {\n return this.isSeeking;\n },\n\n seekable: function () {\n if(!this.ytPlayer) {\n return videojs.createTimeRange();\n }\n\n return videojs.createTimeRange(0, this.ytPlayer.getDuration());\n },\n\n onSeeked: function() {\n clearInterval(this.checkSeekedInPauseInterval);\n this.isSeeking = false;\n\n if (this.wasPausedBeforeSeek) {\n this.pause();\n }\n\n this.trigger('seeked');\n },\n\n playbackRate: function() {\n return this.ytPlayer ? this.ytPlayer.getPlaybackRate() : 1;\n },\n\n setPlaybackRate: function(suggestedRate) {\n if (!this.ytPlayer) {\n return;\n }\n\n this.ytPlayer.setPlaybackRate(suggestedRate);\n },\n\n duration: function() {\n return this.ytPlayer ? this.ytPlayer.getDuration() : 0;\n },\n\n currentSrc: function() {\n return this.source && this.source.src;\n },\n\n ended: function() {\n return this.ytPlayer ? (this.lastState === YT.PlayerState.ENDED) : false;\n },\n\n volume: function() {\n return this.ytPlayer ? this.ytPlayer.getVolume() / 100.0 : 1;\n },\n\n setVolume: function(percentAsDecimal) {\n if (!this.ytPlayer) {\n return;\n }\n\n this.ytPlayer.setVolume(percentAsDecimal * 100.0);\n },\n\n muted: function() {\n return this.ytPlayer ? this.ytPlayer.isMuted() : false;\n },\n\n setMuted: function(mute) {\n if (!this.ytPlayer) {\n return;\n }\n else{\n this.muted(true);\n }\n\n if (mute) {\n this.ytPlayer.mute();\n } else {\n this.ytPlayer.unMute();\n }\n this.setTimeout( function(){\n this.trigger('volumechange');\n }, 50);\n },\n\n buffered: function() {\n if(!this.ytPlayer || !this.ytPlayer.getVideoLoadedFraction) {\n return videojs.createTimeRange();\n }\n\n var bufferedEnd = this.ytPlayer.getVideoLoadedFraction() * this.ytPlayer.getDuration();\n\n return videojs.createTimeRange(0, bufferedEnd);\n },\n\n // TODO: Can we really do something with this on YouTUbe?\n preload: function() {},\n load: function() {},\n reset: function() {},\n networkState: function () {\n if (!this.ytPlayer) {\n return 0; //NETWORK_EMPTY\n }\n switch (this.ytPlayer.getPlayerState()) {\n case -1: //unstarted\n return 0; //NETWORK_EMPTY\n case 3: //buffering\n return 2; //NETWORK_LOADING\n default:\n return 1; //NETWORK_IDLE\n }\n },\n readyState: function () {\n if (!this.ytPlayer) {\n return 0; //HAVE_NOTHING\n }\n switch (this.ytPlayer.getPlayerState()) {\n case -1: //unstarted\n return 0; //HAVE_NOTHING\n case 5: //video cued\n return 1; //HAVE_METADATA\n case 3: //buffering\n return 2; //HAVE_CURRENT_DATA\n default:\n return 4; //HAVE_ENOUGH_DATA\n }\n },\n\n supportsFullScreen: function() {\n return document.fullscreenEnabled ||\n document.webkitFullscreenEnabled ||\n document.mozFullScreenEnabled ||\n document.msFullscreenEnabled;\n },\n\n // Tries to get the highest resolution thumbnail available for the video\n checkHighResPoster: function(){\n var uri = 'https://img.youtube.com/vi/' + this.url.videoId + '/maxresdefault.jpg';\n\n try {\n var image = new Image();\n image.onload = function(){\n // Onload may still be called if YouTube returns the 120x90 error thumbnail\n if('naturalHeight' in image){\n if (image.naturalHeight <= 90 || image.naturalWidth <= 120) {\n return;\n }\n } else if(image.height <= 90 || image.width <= 120) {\n return;\n }\n\n this.poster_ = uri;\n this.trigger('posterchange');\n }.bind(this);\n image.onerror = function(){};\n image.src = uri;\n }\n catch(e){}\n }\n });\n\n Youtube.isSupported = function() {\n return true;\n };\n\n Youtube.canPlaySource = function(e) {\n return Youtube.canPlayType(e.type);\n };\n\n Youtube.canPlayType = function(e) {\n return (e === 'video/youtube');\n };\n\n Youtube.parseUrl = function(url) {\n var result = {\n videoId: null\n };\n\n var regex = /^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|\\&v=)([^#\\&\\?]*).*/;\n var match = url.match(regex);\n\n if (match && match[2].length === 11) {\n result.videoId = match[2];\n }\n\n var regPlaylist = /[?&]list=([^#\\&\\?]+)/;\n match = url.match(regPlaylist);\n\n if(match && match[1]) {\n result.listId = match[1];\n }\n\n return result;\n };\n\n function apiLoaded() {\n YT.ready(function() {\n Youtube.isApiReady = true;\n\n for (var i = 0; i < Youtube.apiReadyQueue.length; ++i) {\n Youtube.apiReadyQueue[i].initYTPlayer();\n }\n });\n }\n\n function loadScript(src, callback) {\n var loaded = false;\n var tag = document.createElement('script');\n var firstScriptTag = document.getElementsByTagName('script')[0];\n if (!firstScriptTag) {\n // when loaded in jest without jsdom setup it doesn't get any element.\n // In jest it doesn't really make sense to do anything, because no one is watching youtube in jest\n return;\n }\n firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n tag.onload = function () {\n if (!loaded) {\n loaded = true;\n callback();\n }\n };\n tag.onreadystatechange = function () {\n if (!loaded && (this.readyState === 'complete' || this.readyState === 'loaded')) {\n loaded = true;\n callback();\n }\n };\n tag.src = src;\n }\n\n function injectCss() {\n var css = // iframe blocker to catch mouse events\n '.vjs-youtube .vjs-iframe-blocker { display: none; }' +\n '.vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }' +\n '.vjs-youtube .vjs-poster { background-size: cover; }' +\n '.vjs-youtube-mobile .vjs-big-play-button { display: none; }';\n\n var head = document.head || document.getElementsByTagName('head')[0];\n\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (style.styleSheet){\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n\n head.appendChild(style);\n }\n\n Youtube.apiReadyQueue = [];\n\n if (typeof document !== 'undefined'){\n loadScript('https://www.youtube.com/iframe_api', apiLoaded);\n injectCss();\n }\n\n // Older versions of VJS5 doesn't have the registerTech function\n if (typeof videojs.registerTech !== 'undefined') {\n videojs.registerTech('Youtube', Youtube);\n } else {\n videojs.registerComponent('Youtube', Youtube);\n }\n}));\n"],"names":["root","factory","exports","module","videojs","require","default","define","amd","Youtube","this","css","head","style","src","callback","loaded","tag","firstScriptTag","_isOnMobile","browser","IS_IOS","IS_NATIVE_ANDROID","Tech","getTech","extend","constructor","options","ready","call","setPoster","poster","setSrc","options_","source","setTimeout","el_","parentNode","className","isApiReady","initYTPlayer","apiReadyQueue","push","bind","dispose","ytPlayer","stopVideo","destroy","index","indexOf","splice","replace","removeChild","prototype","createEl","div","document","createElement","setAttribute","techId","divWrapper","appendChild","ytControls","divBlocker","onclick","pause","playerVars","controls","modestbranding","rel","showinfo","loop","autohide","disablekb","color","fs","srcEndTime","match","end","parseInt","hl","language","substr","list","url","listId","listType","playlist","playsinline","srcStartTime","start","theme","customVars","Object","keys","forEach","key","activeVideoId","videoId","activeList","playerConfig","events","onReady","onPlayerReady","onPlaybackQualityChange","onPlayerPlaybackQualityChange","onPlaybackRateChange","onPlayerPlaybackRateChange","onStateChange","onPlayerStateChange","onVolumeChange","onPlayerVolumeChange","onError","onPlayerError","enablePrivacyEnhancedMode","host","YT","Player","muted","mute","getAvailablePlaybackRates","length","featuresPlaybackRate","playerReady_","triggerReady","playOnReady","play","cueOnReady","cueVideoById_","trigger","e","state","data","lastState","errorNumber","PlayerState","ENDED","PLAYING","isSeeking","onSeeked","PAUSED","BUFFERING","player_","error","code","message","loadVideoById_","id","startSeconds","endSeconds","loadVideoById","cueVideoById","poster_","parseUrl","checkHighResPoster","autoplay","isReady_","setAutoplay","val","setLoop","wasPausedBeforeSeek","playVideo","loadPlaylist","pauseVideo","paused","currentTime","getCurrentTime","setCurrentTime","seconds","timeBeforeSeek","seekTo","clearInterval","checkSeekedInPauseInterval","setInterval","seeking","seekable","createTimeRange","getDuration","playbackRate","getPlaybackRate","setPlaybackRate","suggestedRate","duration","currentSrc","ended","volume","getVolume","setVolume","percentAsDecimal","isMuted","setMuted","unMute","buffered","getVideoLoadedFraction","bufferedEnd","preload","load","reset","networkState","getPlayerState","readyState","supportsFullScreen","fullscreenEnabled","webkitFullscreenEnabled","mozFullScreenEnabled","msFullscreenEnabled","uri","image","Image","onload","naturalHeight","naturalWidth","height","width","onerror","isSupported","canPlaySource","canPlayType","type","result","i","getElementsByTagName","insertBefore","onreadystatechange","styleSheet","cssText","createTextNode","registerTech","registerComponent"],"mappings":"CAsBC,SAAUA,KAAMC,YACK,iBAAVC,SAAsC,oBAATC,OAAsB,KACvDC,QAAUC,QAAQ,YACtBF,OAAOD,QAAUD,QAAQG,QAAQE,SAAWF,aAClB,mBAAXG,QAAyBA,OAAOC,IAC/CD,oCAAO,CAAC,6BAA6B,SAASH,gBACpCJ,KAAKS,QAAUR,QAAQG,YAGjCJ,KAAKS,QAAUR,QAAQD,KAAKI,SAT/B,CAWCM,QAAM,SAASN,aA2tBTO,IAMAC,KAEAC,MAlCcC,IAAKC,SACnBC,OACAC,IACAC,eAjsBFC,YAAcf,QAAQgB,QAAQC,QAAUjB,QAAQgB,QAAQE,kBACxDC,KAAOnB,QAAQoB,QAAQ,QAEvBf,QAAUL,QAAQqB,OAAOF,KAAM,CAEjCG,YAAa,SAASC,QAASC,OAC7BL,KAAKM,KAAKnB,KAAMiB,QAASC,YAEpBE,UAAUH,QAAQI,aAClBC,OAAOtB,KAAKuB,SAASC,QAAQ,QAI7BC,WAAW,WACVzB,KAAK0B,WACFA,IAAIC,WAAWC,WAAa,eA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tube-lazy.min.js","sources":["../src/Youtube-lazy.js"],"sourcesContent":["/* The MIT License (MIT)\n\nCopyright (c) 2014-2015 Benoit Tremblay \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n/*global define, YT*/\n(function (root, factory) {\n if(typeof exports==='object' && typeof module!=='undefined') {\n var videojs = require('video.js');\n module.exports = factory(videojs.default || videojs);\n } else if(typeof define === 'function' && define.amd) {\n define(['media_videojs/video-lazy'], function(videojs){\n return (root.Youtube = factory(videojs));\n });\n } else {\n root.Youtube = factory(root.videojs);\n }\n}(this, function(videojs) {\n 'use strict';\n\n var _isOnMobile = videojs.browser.IS_IOS || videojs.browser.IS_NATIVE_ANDROID;\n var Tech = videojs.getTech('Tech');\n\n class Youtube extends Tech {\n\n constructor(options, ready) {\n super(options, ready);\n\n this.setPoster(options.poster);\n this.setSrc(this.options_.source, true);\n\n // Set the vjs-youtube class to the player\n // Parent is not set yet so we have to wait a tick\n this.setTimeout(function() {\n if (this.el_) {\n this.el_.parentNode.className += ' vjs-youtube';\n\n if (_isOnMobile) {\n this.el_.parentNode.className += ' vjs-youtube-mobile';\n }\n\n if (Youtube.isApiReady) {\n this.initYTPlayer();\n } else {\n Youtube.apiReadyQueue.push(this);\n }\n }\n }.bind(this));\n }\n\n dispose() {\n if (this.ytPlayer) {\n //Dispose of the YouTube Player\n if (this.ytPlayer.stopVideo) {\n this.ytPlayer.stopVideo();\n }\n if (this.ytPlayer.destroy) {\n this.ytPlayer.destroy();\n }\n } else {\n //YouTube API hasn't finished loading or the player is already disposed\n var index = Youtube.apiReadyQueue.indexOf(this);\n if (index !== -1) {\n Youtube.apiReadyQueue.splice(index, 1);\n }\n }\n this.ytPlayer = null;\n\n this.el_.parentNode.className = this.el_.parentNode.className\n .replace(' vjs-youtube', '')\n .replace(' vjs-youtube-mobile', '');\n this.el_.parentNode.removeChild(this.el_);\n\n //Needs to be called after the YouTube player is destroyed, otherwise there will be a null reference exception\n Tech.prototype.dispose.call(this);\n }\n\n createEl() {\n var div = document.createElement('div');\n div.setAttribute('id', this.options_.techId);\n div.setAttribute('style', 'width:100%;height:100%;top:0;left:0;position:absolute');\n div.setAttribute('class', 'vjs-tech');\n\n var divWrapper = document.createElement('div');\n divWrapper.appendChild(div);\n\n if (!_isOnMobile && !this.options_.ytControls) {\n var divBlocker = document.createElement('div');\n divBlocker.setAttribute('class', 'vjs-iframe-blocker');\n divBlocker.setAttribute('style', 'position:absolute;top:0;left:0;width:100%;height:100%');\n\n // In case the blocker is still there and we want to pause\n divBlocker.onclick = function() {\n this.pause();\n }.bind(this);\n\n divWrapper.appendChild(divBlocker);\n }\n\n return divWrapper;\n }\n\n initYTPlayer() {\n var playerVars = {\n controls: 0,\n modestbranding: 1,\n rel: 0,\n showinfo: 0,\n loop: this.options_.loop ? 1 : 0\n };\n\n // Let the user set any YouTube parameter\n // https://developers.google.com/youtube/player_parameters?playerVersion=HTML5#Parameters\n // To use YouTube controls, you must use ytControls instead\n // To use the loop or autoplay, use the video.js settings\n\n if (typeof this.options_.autohide !== 'undefined') {\n playerVars.autohide = this.options_.autohide;\n }\n\n if (typeof this.options_['cc_load_policy'] !== 'undefined') {\n playerVars['cc_load_policy'] = this.options_['cc_load_policy'];\n }\n\n if (typeof this.options_.ytControls !== 'undefined') {\n playerVars.controls = this.options_.ytControls;\n }\n\n if (typeof this.options_.disablekb !== 'undefined') {\n playerVars.disablekb = this.options_.disablekb;\n }\n\n if (typeof this.options_.color !== 'undefined') {\n playerVars.color = this.options_.color;\n }\n\n if (!playerVars.controls) {\n // Let video.js handle the fullscreen unless it is the YouTube native controls\n playerVars.fs = 0;\n } else if (typeof this.options_.fs !== 'undefined') {\n playerVars.fs = this.options_.fs;\n }\n\n if (this.options_.source.src.indexOf('end=') !== -1) {\n var srcEndTime = this.options_.source.src.match(/end=([0-9]*)/);\n this.options_.end = parseInt(srcEndTime[1]);\n }\n\n if (typeof this.options_.end !== 'undefined') {\n playerVars.end = this.options_.end;\n }\n\n if (typeof this.options_.hl !== 'undefined') {\n playerVars.hl = this.options_.hl;\n } else if (typeof this.options_.language !== 'undefined') {\n // Set the YouTube player on the same language than video.js\n playerVars.hl = this.options_.language.substr(0, 2);\n }\n\n if (typeof this.options_['iv_load_policy'] !== 'undefined') {\n playerVars['iv_load_policy'] = this.options_['iv_load_policy'];\n }\n\n if (typeof this.options_.list !== 'undefined') {\n playerVars.list = this.options_.list;\n } else if (this.url && typeof this.url.listId !== 'undefined') {\n playerVars.list = this.url.listId;\n }\n\n if (typeof this.options_.listType !== 'undefined') {\n playerVars.listType = this.options_.listType;\n }\n\n if (typeof this.options_.modestbranding !== 'undefined') {\n playerVars.modestbranding = this.options_.modestbranding;\n }\n\n if (typeof this.options_.playlist !== 'undefined') {\n playerVars.playlist = this.options_.playlist;\n }\n\n if (typeof this.options_.playsinline !== 'undefined') {\n playerVars.playsinline = this.options_.playsinline;\n }\n\n if (typeof this.options_.rel !== 'undefined') {\n playerVars.rel = this.options_.rel;\n }\n\n if (typeof this.options_.showinfo !== 'undefined') {\n playerVars.showinfo = this.options_.showinfo;\n }\n\n if (this.options_.source.src.indexOf('start=') !== -1) {\n var srcStartTime = this.options_.source.src.match(/start=([0-9]*)/);\n this.options_.start = parseInt(srcStartTime[1]);\n }\n\n if (typeof this.options_.start !== 'undefined') {\n playerVars.start = this.options_.start;\n }\n\n if (typeof this.options_.theme !== 'undefined') {\n playerVars.theme = this.options_.theme;\n }\n\n // Allow undocumented options to be passed along via customVars\n if (typeof this.options_.customVars !== 'undefined') {\n var customVars = this.options_.customVars;\n Object.keys(customVars).forEach(function(key) {\n playerVars[key] = customVars[key];\n });\n }\n\n this.activeVideoId = this.url ? this.url.videoId : null;\n this.activeList = playerVars.list;\n\n var playerConfig = {\n videoId: this.activeVideoId,\n playerVars: playerVars,\n events: {\n onReady: this.onPlayerReady.bind(this),\n onPlaybackQualityChange: this.onPlayerPlaybackQualityChange.bind(this),\n onPlaybackRateChange: this.onPlayerPlaybackRateChange.bind(this),\n onStateChange: this.onPlayerStateChange.bind(this),\n onVolumeChange: this.onPlayerVolumeChange.bind(this),\n onError: this.onPlayerError.bind(this)\n }\n };\n\n if (typeof this.options_.enablePrivacyEnhancedMode !== 'undefined' && this.options_.enablePrivacyEnhancedMode) {\n playerConfig.host = 'https://www.youtube-nocookie.com';\n }\n\n this.ytPlayer = new YT.Player(this.options_.techId, playerConfig);\n }\n\n onPlayerReady() {\n if (this.options_.muted) {\n this.ytPlayer.mute();\n }\n\n var playbackRates = this.ytPlayer.getAvailablePlaybackRates();\n if (playbackRates.length > 1) {\n this.featuresPlaybackRate = true;\n }\n\n this.playerReady_ = true;\n this.triggerReady();\n\n if (this.playOnReady) {\n this.play();\n } else if (this.cueOnReady) {\n this.cueVideoById_(this.url.videoId);\n this.activeVideoId = this.url.videoId;\n }\n }\n\n onPlayerPlaybackQualityChange() {\n\n }\n\n onPlayerPlaybackRateChange() {\n this.trigger('ratechange');\n }\n\n onPlayerStateChange(e) {\n var state = e.data;\n\n if (state === this.lastState || this.errorNumber) {\n return;\n }\n\n this.lastState = state;\n\n switch (state) {\n case -1:\n this.trigger('loadstart');\n this.trigger('loadedmetadata');\n this.trigger('durationchange');\n this.trigger('ratechange');\n break;\n\n case YT.PlayerState.ENDED:\n this.trigger('ended');\n break;\n\n case YT.PlayerState.PLAYING:\n this.trigger('timeupdate');\n this.trigger('durationchange');\n this.trigger('playing');\n this.trigger('play');\n\n if (this.isSeeking) {\n this.onSeeked();\n }\n break;\n\n case YT.PlayerState.PAUSED:\n this.trigger('canplay');\n if (this.isSeeking) {\n this.onSeeked();\n } else {\n this.trigger('pause');\n }\n break;\n\n case YT.PlayerState.BUFFERING:\n this.player_.trigger('timeupdate');\n this.player_.trigger('waiting');\n break;\n }\n }\n\n onPlayerVolumeChange() {\n this.trigger('volumechange');\n }\n\n onPlayerError(e) {\n this.errorNumber = e.data;\n this.trigger('pause');\n this.trigger('error');\n }\n\n error() {\n var code = 1000 + this.errorNumber; // as smaller codes are reserved\n switch (this.errorNumber) {\n case 5:\n return { code: code, message: 'Error while trying to play the video' };\n\n case 2:\n case 100:\n return { code: code, message: 'Unable to find the video' };\n\n case 101:\n case 150:\n return {\n code: code,\n message: 'Playback on other Websites has been disabled by the video owner.'\n };\n }\n\n return { code: code, message: 'YouTube unknown error (' + this.errorNumber + ')' };\n }\n\n loadVideoById_(id) {\n var options = {\n videoId: id\n };\n if (this.options_.start) {\n options.startSeconds = this.options_.start;\n }\n if (this.options_.end) {\n options.endSeconds = this.options_.end;\n }\n this.ytPlayer.loadVideoById(options);\n }\n\n cueVideoById_(id) {\n var options = {\n videoId: id\n };\n if (this.options_.start) {\n options.startSeconds = this.options_.start;\n }\n if (this.options_.end) {\n options.endSeconds = this.options_.end;\n }\n this.ytPlayer.cueVideoById(options);\n }\n\n src(src) {\n if (src) {\n this.setSrc({ src: src });\n }\n\n return this.source;\n }\n\n poster() {\n // You can't start programmaticlly a video with a mobile\n // through the iframe so we hide the poster and the play button (with CSS)\n if (_isOnMobile) {\n return null;\n }\n\n return this.poster_;\n }\n\n setPoster(poster) {\n this.poster_ = poster;\n }\n\n setSrc(source) {\n if (!source || !source.src) {\n return;\n }\n\n delete this.errorNumber;\n this.source = source;\n this.url = Youtube.parseUrl(source.src);\n\n if (!this.options_.poster) {\n if (this.url.videoId) {\n // Set the low resolution first\n this.poster_ = 'https://img.youtube.com/vi/' + this.url.videoId + '/0.jpg';\n this.trigger('posterchange');\n\n // Check if their is a high res\n this.checkHighResPoster();\n }\n }\n\n if (this.options_.autoplay && !_isOnMobile) {\n if (this.isReady_) {\n this.play();\n } else {\n this.playOnReady = true;\n }\n } else if (this.activeVideoId !== this.url.videoId) {\n if (this.isReady_) {\n this.cueVideoById_(this.url.videoId);\n this.activeVideoId = this.url.videoId;\n } else {\n this.cueOnReady = true;\n }\n }\n }\n\n autoplay() {\n return this.options_.autoplay;\n }\n\n setAutoplay(val) {\n this.options_.autoplay = val;\n }\n\n loop() {\n return this.options_.loop;\n }\n\n setLoop(val) {\n this.options_.loop = val;\n }\n\n play() {\n if (!this.url || !this.url.videoId) {\n return;\n }\n\n this.wasPausedBeforeSeek = false;\n\n if (this.isReady_) {\n if (this.url.listId) {\n if (this.activeList === this.url.listId) {\n this.ytPlayer.playVideo();\n } else {\n this.ytPlayer.loadPlaylist(this.url.listId);\n this.activeList = this.url.listId;\n }\n }\n\n if (this.activeVideoId === this.url.videoId) {\n this.ytPlayer.playVideo();\n } else {\n this.loadVideoById_(this.url.videoId);\n this.activeVideoId = this.url.videoId;\n }\n } else {\n this.trigger('waiting');\n this.playOnReady = true;\n }\n }\n\n pause() {\n if (this.ytPlayer) {\n this.ytPlayer.pauseVideo();\n }\n }\n\n paused() {\n return (this.ytPlayer) ?\n (this.lastState !== YT.PlayerState.PLAYING && this.lastState !== YT.PlayerState.BUFFERING)\n : true;\n }\n\n currentTime() {\n return this.ytPlayer ? this.ytPlayer.getCurrentTime() : 0;\n }\n\n setCurrentTime(seconds) {\n if (this.lastState === YT.PlayerState.PAUSED) {\n this.timeBeforeSeek = this.currentTime();\n }\n\n if (!this.isSeeking) {\n this.wasPausedBeforeSeek = this.paused();\n }\n\n this.ytPlayer.seekTo(seconds, true);\n this.trigger('timeupdate');\n this.trigger('seeking');\n this.isSeeking = true;\n\n // A seek event during pause does not return an event to trigger a seeked event,\n // so run an interval timer to look for the currentTime to change\n if (this.lastState === YT.PlayerState.PAUSED && this.timeBeforeSeek !== seconds) {\n clearInterval(this.checkSeekedInPauseInterval);\n this.checkSeekedInPauseInterval = setInterval(function() {\n if (this.lastState !== YT.PlayerState.PAUSED || !this.isSeeking) {\n // If something changed while we were waiting for the currentTime to change,\n // clear the interval timer\n clearInterval(this.checkSeekedInPauseInterval);\n } else if (this.currentTime() !== this.timeBeforeSeek) {\n this.trigger('timeupdate');\n this.onSeeked();\n }\n }.bind(this), 250);\n }\n }\n\n seeking() {\n return this.isSeeking;\n }\n\n seekable() {\n if(!this.ytPlayer) {\n return videojs.createTimeRange();\n }\n\n return videojs.createTimeRange(0, this.ytPlayer.getDuration());\n }\n\n onSeeked() {\n clearInterval(this.checkSeekedInPauseInterval);\n this.isSeeking = false;\n\n if (this.wasPausedBeforeSeek) {\n this.pause();\n }\n\n this.trigger('seeked');\n }\n\n playbackRate() {\n return this.ytPlayer ? this.ytPlayer.getPlaybackRate() : 1;\n }\n\n setPlaybackRate(suggestedRate) {\n if (!this.ytPlayer) {\n return;\n }\n\n this.ytPlayer.setPlaybackRate(suggestedRate);\n }\n\n duration() {\n return this.ytPlayer ? this.ytPlayer.getDuration() : 0;\n }\n\n currentSrc() {\n return this.source && this.source.src;\n }\n\n ended() {\n return this.ytPlayer ? (this.lastState === YT.PlayerState.ENDED) : false;\n }\n\n volume() {\n return this.ytPlayer ? this.ytPlayer.getVolume() / 100.0 : 1;\n }\n\n setVolume(percentAsDecimal) {\n if (!this.ytPlayer) {\n return;\n }\n\n this.ytPlayer.setVolume(percentAsDecimal * 100.0);\n }\n\n muted() {\n return this.ytPlayer ? this.ytPlayer.isMuted() : false;\n }\n\n setMuted(mute) {\n if (!this.ytPlayer) {\n return;\n }\n else{\n this.muted(true);\n }\n\n if (mute) {\n this.ytPlayer.mute();\n } else {\n this.ytPlayer.unMute();\n }\n this.setTimeout( function(){\n this.trigger('volumechange');\n }, 50);\n }\n\n buffered() {\n if(!this.ytPlayer || !this.ytPlayer.getVideoLoadedFraction) {\n return videojs.createTimeRange();\n }\n\n var bufferedEnd = this.ytPlayer.getVideoLoadedFraction() * this.ytPlayer.getDuration();\n\n return videojs.createTimeRange(0, bufferedEnd);\n }\n\n // TODO: Can we really do something with this on YouTUbe?\n preload() {}\n load() {}\n reset() {}\n networkState() {\n if (!this.ytPlayer) {\n return 0; //NETWORK_EMPTY\n }\n switch (this.ytPlayer.getPlayerState()) {\n case -1: //unstarted\n return 0; //NETWORK_EMPTY\n case 3: //buffering\n return 2; //NETWORK_LOADING\n default:\n return 1; //NETWORK_IDLE\n }\n }\n readyState() {\n if (!this.ytPlayer) {\n return 0; //HAVE_NOTHING\n }\n switch (this.ytPlayer.getPlayerState()) {\n case -1: //unstarted\n return 0; //HAVE_NOTHING\n case 5: //video cued\n return 1; //HAVE_METADATA\n case 3: //buffering\n return 2; //HAVE_CURRENT_DATA\n default:\n return 4; //HAVE_ENOUGH_DATA\n }\n }\n\n supportsFullScreen() {\n return document.fullscreenEnabled ||\n document.webkitFullscreenEnabled ||\n document.mozFullScreenEnabled ||\n document.msFullscreenEnabled;\n }\n\n // Tries to get the highest resolution thumbnail available for the video\n checkHighResPoster(){\n var uri = 'https://img.youtube.com/vi/' + this.url.videoId + '/maxresdefault.jpg';\n\n try {\n var image = new Image();\n image.onload = function(){\n // Onload may still be called if YouTube returns the 120x90 error thumbnail\n if('naturalHeight' in image){\n if (image.naturalHeight <= 90 || image.naturalWidth <= 120) {\n return;\n }\n } else if(image.height <= 90 || image.width <= 120) {\n return;\n }\n\n this.poster_ = uri;\n this.trigger('posterchange');\n }.bind(this);\n image.onerror = function(){};\n image.src = uri;\n }\n catch(e){}\n }\n }\n\n Youtube.isSupported = function() {\n return true;\n };\n\n Youtube.canPlaySource = function(e) {\n return Youtube.canPlayType(e.type);\n };\n\n Youtube.canPlayType = function(e) {\n return (e === 'video/youtube');\n };\n\n Youtube.parseUrl = function(url) {\n var result = {\n videoId: null\n };\n\n var regex = /^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|\\&v=)([^#\\&\\?]*).*/;\n var match = url.match(regex);\n\n if (match && match[2].length === 11) {\n result.videoId = match[2];\n }\n\n var regPlaylist = /[?&]list=([^#\\&\\?]+)/;\n match = url.match(regPlaylist);\n\n if(match && match[1]) {\n result.listId = match[1];\n }\n\n return result;\n };\n\n function apiLoaded() {\n YT.ready(function() {\n Youtube.isApiReady = true;\n\n for (var i = 0; i < Youtube.apiReadyQueue.length; ++i) {\n Youtube.apiReadyQueue[i].initYTPlayer();\n }\n });\n }\n\n function loadScript(src, callback) {\n var loaded = false;\n var tag = document.createElement('script');\n var firstScriptTag = document.getElementsByTagName('script')[0];\n if (!firstScriptTag) {\n // when loaded in jest without jsdom setup it doesn't get any element.\n // In jest it doesn't really make sense to do anything, because no one is watching youtube in jest\n return;\n }\n firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n tag.onload = function () {\n if (!loaded) {\n loaded = true;\n callback();\n }\n };\n tag.onreadystatechange = function () {\n if (!loaded && (this.readyState === 'complete' || this.readyState === 'loaded')) {\n loaded = true;\n callback();\n }\n };\n tag.src = src;\n }\n\n function injectCss() {\n var css = // iframe blocker to catch mouse events\n '.vjs-youtube .vjs-iframe-blocker { display: none; }' +\n '.vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }' +\n '.vjs-youtube .vjs-poster { background-size: cover; }' +\n '.vjs-youtube-mobile .vjs-big-play-button { display: none; }';\n\n var head = document.head || document.getElementsByTagName('head')[0];\n\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (style.styleSheet){\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n\n head.appendChild(style);\n }\n\n Youtube.apiReadyQueue = [];\n\n if (typeof document !== 'undefined'){\n loadScript('https://www.youtube.com/iframe_api', apiLoaded);\n injectCss();\n }\n\n // Older versions of VJS5 doesn't have the registerTech function\n if (typeof videojs.registerTech !== 'undefined') {\n videojs.registerTech('Youtube', Youtube);\n } else {\n videojs.registerComponent('Youtube', Youtube);\n }\n}));\n"],"names":["root","factory","exports","module","videojs","require","default","define","amd","Youtube","this","css","head","style","src","callback","loaded","tag","firstScriptTag","_isOnMobile","browser","IS_IOS","IS_NATIVE_ANDROID","Tech","getTech","constructor","options","ready","setPoster","poster","setSrc","options_","source","setTimeout","el_","parentNode","className","isApiReady","initYTPlayer","apiReadyQueue","push","bind","dispose","ytPlayer","stopVideo","destroy","index","indexOf","splice","replace","removeChild","prototype","call","createEl","div","document","createElement","setAttribute","techId","divWrapper","appendChild","ytControls","divBlocker","onclick","pause","playerVars","controls","modestbranding","rel","showinfo","loop","autohide","disablekb","color","fs","srcEndTime","match","end","parseInt","hl","language","substr","list","url","listId","listType","playlist","playsinline","srcStartTime","start","theme","customVars","Object","keys","forEach","key","activeVideoId","videoId","activeList","playerConfig","events","onReady","onPlayerReady","onPlaybackQualityChange","onPlayerPlaybackQualityChange","onPlaybackRateChange","onPlayerPlaybackRateChange","onStateChange","onPlayerStateChange","onVolumeChange","onPlayerVolumeChange","onError","onPlayerError","enablePrivacyEnhancedMode","host","YT","Player","muted","mute","getAvailablePlaybackRates","length","featuresPlaybackRate","playerReady_","triggerReady","playOnReady","play","cueOnReady","cueVideoById_","trigger","e","state","data","lastState","errorNumber","PlayerState","ENDED","PLAYING","isSeeking","onSeeked","PAUSED","BUFFERING","player_","error","code","message","loadVideoById_","id","startSeconds","endSeconds","loadVideoById","cueVideoById","poster_","parseUrl","checkHighResPoster","autoplay","isReady_","setAutoplay","val","setLoop","wasPausedBeforeSeek","playVideo","loadPlaylist","pauseVideo","paused","currentTime","getCurrentTime","setCurrentTime","seconds","timeBeforeSeek","seekTo","clearInterval","checkSeekedInPauseInterval","setInterval","seeking","seekable","createTimeRange","getDuration","playbackRate","getPlaybackRate","setPlaybackRate","suggestedRate","duration","currentSrc","ended","volume","getVolume","setVolume","percentAsDecimal","isMuted","setMuted","unMute","buffered","getVideoLoadedFraction","bufferedEnd","preload","load","reset","networkState","getPlayerState","readyState","supportsFullScreen","fullscreenEnabled","webkitFullscreenEnabled","mozFullScreenEnabled","msFullscreenEnabled","uri","image","Image","onload","naturalHeight","naturalWidth","height","width","onerror","isSupported","canPlaySource","canPlayType","type","result","i","getElementsByTagName","insertBefore","onreadystatechange","styleSheet","cssText","createTextNode","registerTech","registerComponent"],"mappings":"CAsBC,SAAUA,KAAMC,YACK,iBAAVC,SAAsC,oBAATC,OAAsB,KACvDC,QAAUC,QAAQ,YACtBF,OAAOD,QAAUD,QAAQG,QAAQE,SAAWF,aAClB,mBAAXG,QAAyBA,OAAOC,IAC/CD,oCAAO,CAAC,6BAA6B,SAASH,gBACpCJ,KAAKS,QAAUR,QAAQG,YAGjCJ,KAAKS,QAAUR,QAAQD,KAAKI,SAT/B,CAWCM,QAAM,SAASN,aA2tBTO,IAMAC,KAEAC,MAlCcC,IAAKC,SACnBC,OACAC,IACAC,eAjsBFC,YAAcf,QAAQgB,QAAQC,QAAUjB,QAAQgB,QAAQE,kBACxDC,KAAOnB,QAAQoB,QAAQ,cAErBf,gBAAgBc,KAEpBE,YAAYC,QAASC,aACbD,QAASC,YAEVC,UAAUF,QAAQG,aAClBC,OAAOpB,KAAKqB,SAASC,QAAQ,QAI7BC,WAAW,WACVvB,KAAKwB,WACFA,IAAIC,WAAWC,WAAa,eAE7BjB,mBACGe,IAAIC,WAAWC,WAAa,uBAG/B3B,QAAQ4B,gBACLC,eAEL7B,QAAQ8B,cAAcC,KAAK9B,QAG/B+B,KAAK/B,OAGTgC,aACMhC,KAAKiC,SAEHjC,KAAKiC,SAASC,gBACXD,SAASC,YAEZlC,KAAKiC,SAASE,cACXF,SAASE,cAEX,KAEDC,MAA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,YAAa,MAEhB,IAAIsL,EAAI,EAAGA,EAAIlN,QAAQ8B,cAAciF,SAAUmG,EAClDlN,QAAQ8B,cAAcoL,GAAGrL,mBAMzBtB,QAAS,EACTC,IAAMsC,SAASC,cAAc,WAC7BtC,eAAiBqC,SAASqK,qBAAqB,UAAU,MAM7D1M,eAAeiB,WAAW0L,aAAa5M,IAAKC,gBAC5CD,IAAI+L,OAAS,WACNhM,SACHA,QAAS,EACTD,aAGJE,IAAI6M,mBAAqB,WAClB9M,QAA+B,aAApBN,KAAK6L,YAAiD,WAApB7L,KAAK6L,aACrDvL,QAAS,EACTD,aAGJE,IAAIH,IAAMA,KAINH,IACA,2OAKAC,KAAO2C,SAAS3C,MAAQ2C,SAASqK,qBAAqB,QAAQ,IAE9D/M,MAAQ0C,SAASC,cAAc,UAC7BiK,KAAO,WAET5M,MAAMkN,WACRlN,MAAMkN,WAAWC,QAAUrN,IAE3BE,MAAM+C,YAAYL,SAAS0K,eAAetN,MAG5CC,KAAKgD,YAAY/C,aAWiB,IAAzBT,QAAQ8N,aACjB9N,QAAQ8N,aAAa,UAAWzN,SAEhCL,QAAQ+N,kBAAkB,UAAW1N"} \ No newline at end of file diff --git a/media/player/videojs/amd/src/Youtube-lazy.js b/media/player/videojs/amd/src/Youtube-lazy.js index de221fec86e..3cdd61e9c10 100644 --- a/media/player/videojs/amd/src/Youtube-lazy.js +++ b/media/player/videojs/amd/src/Youtube-lazy.js @@ -37,10 +37,10 @@ THE SOFTWARE. */ var _isOnMobile = videojs.browser.IS_IOS || videojs.browser.IS_NATIVE_ANDROID; var Tech = videojs.getTech('Tech'); - var Youtube = videojs.extend(Tech, { + class Youtube extends Tech { - constructor: function(options, ready) { - Tech.call(this, options, ready); + constructor(options, ready) { + super(options, ready); this.setPoster(options.poster); this.setSrc(this.options_.source, true); @@ -62,9 +62,9 @@ THE SOFTWARE. */ } } }.bind(this)); - }, + } - dispose: function() { + dispose() { if (this.ytPlayer) { //Dispose of the YouTube Player if (this.ytPlayer.stopVideo) { @@ -83,15 +83,15 @@ THE SOFTWARE. */ this.ytPlayer = null; this.el_.parentNode.className = this.el_.parentNode.className - .replace(' vjs-youtube', '') - .replace(' vjs-youtube-mobile', ''); + .replace(' vjs-youtube', '') + .replace(' vjs-youtube-mobile', ''); this.el_.parentNode.removeChild(this.el_); //Needs to be called after the YouTube player is destroyed, otherwise there will be a null reference exception Tech.prototype.dispose.call(this); - }, + } - createEl: function() { + createEl() { var div = document.createElement('div'); div.setAttribute('id', this.options_.techId); div.setAttribute('style', 'width:100%;height:100%;top:0;left:0;position:absolute'); @@ -114,9 +114,9 @@ THE SOFTWARE. */ } return divWrapper; - }, + } - initYTPlayer: function() { + initYTPlayer() { var playerVars = { controls: 0, modestbranding: 1, @@ -249,9 +249,9 @@ THE SOFTWARE. */ } this.ytPlayer = new YT.Player(this.options_.techId, playerConfig); - }, + } - onPlayerReady: function() { + onPlayerReady() { if (this.options_.muted) { this.ytPlayer.mute(); } @@ -270,17 +270,17 @@ THE SOFTWARE. */ this.cueVideoById_(this.url.videoId); this.activeVideoId = this.url.videoId; } - }, + } - onPlayerPlaybackQualityChange: function() { + onPlayerPlaybackQualityChange() { - }, + } - onPlayerPlaybackRateChange: function() { + onPlayerPlaybackRateChange() { this.trigger('ratechange'); - }, + } - onPlayerStateChange: function(e) { + onPlayerStateChange(e) { var state = e.data; if (state === this.lastState || this.errorNumber) { @@ -326,19 +326,19 @@ THE SOFTWARE. */ this.player_.trigger('waiting'); break; } - }, + } - onPlayerVolumeChange: function() { + onPlayerVolumeChange() { this.trigger('volumechange'); - }, + } - onPlayerError: function(e) { + onPlayerError(e) { this.errorNumber = e.data; this.trigger('pause'); this.trigger('error'); - }, + } - error: function() { + error() { var code = 1000 + this.errorNumber; // as smaller codes are reserved switch (this.errorNumber) { case 5: @@ -357,9 +357,9 @@ THE SOFTWARE. */ } return { code: code, message: 'YouTube unknown error (' + this.errorNumber + ')' }; - }, + } - loadVideoById_: function(id) { + loadVideoById_(id) { var options = { videoId: id }; @@ -370,9 +370,9 @@ THE SOFTWARE. */ options.endSeconds = this.options_.end; } this.ytPlayer.loadVideoById(options); - }, + } - cueVideoById_: function(id) { + cueVideoById_(id) { var options = { videoId: id }; @@ -383,17 +383,17 @@ THE SOFTWARE. */ options.endSeconds = this.options_.end; } this.ytPlayer.cueVideoById(options); - }, + } - src: function(src) { + src(src) { if (src) { this.setSrc({ src: src }); } return this.source; - }, + } - poster: function() { + poster() { // You can't start programmaticlly a video with a mobile // through the iframe so we hide the poster and the play button (with CSS) if (_isOnMobile) { @@ -401,13 +401,13 @@ THE SOFTWARE. */ } return this.poster_; - }, + } - setPoster: function(poster) { + setPoster(poster) { this.poster_ = poster; - }, + } - setSrc: function(source) { + setSrc(source) { if (!source || !source.src) { return; } @@ -441,25 +441,25 @@ THE SOFTWARE. */ this.cueOnReady = true; } } - }, + } - autoplay: function() { + autoplay() { return this.options_.autoplay; - }, + } - setAutoplay: function(val) { + setAutoplay(val) { this.options_.autoplay = val; - }, + } - loop: function() { + loop() { return this.options_.loop; - }, + } - setLoop: function(val) { + setLoop(val) { this.options_.loop = val; - }, + } - play: function() { + play() { if (!this.url || !this.url.videoId) { return; } @@ -486,25 +486,25 @@ THE SOFTWARE. */ this.trigger('waiting'); this.playOnReady = true; } - }, + } - 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) - : true; - }, + (this.lastState !== YT.PlayerState.PLAYING && this.lastState !== YT.PlayerState.BUFFERING) + : true; + } - currentTime: function() { + currentTime() { return this.ytPlayer ? this.ytPlayer.getCurrentTime() : 0; - }, + } - setCurrentTime: function(seconds) { + setCurrentTime(seconds) { if (this.lastState === YT.PlayerState.PAUSED) { this.timeBeforeSeek = this.currentTime(); } @@ -533,21 +533,21 @@ THE SOFTWARE. */ } }.bind(this), 250); } - }, + } - seeking: function () { + seeking() { return this.isSeeking; - }, + } - seekable: function () { + seekable() { if(!this.ytPlayer) { return videojs.createTimeRange(); } return videojs.createTimeRange(0, this.ytPlayer.getDuration()); - }, + } - onSeeked: function() { + onSeeked() { clearInterval(this.checkSeekedInPauseInterval); this.isSeeking = false; @@ -556,49 +556,49 @@ THE SOFTWARE. */ } this.trigger('seeked'); - }, + } - playbackRate: function() { + playbackRate() { return this.ytPlayer ? this.ytPlayer.getPlaybackRate() : 1; - }, + } - setPlaybackRate: function(suggestedRate) { + setPlaybackRate(suggestedRate) { if (!this.ytPlayer) { return; } this.ytPlayer.setPlaybackRate(suggestedRate); - }, + } - 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) : false; - }, + } - volume: function() { + volume() { return this.ytPlayer ? this.ytPlayer.getVolume() / 100.0 : 1; - }, + } - setVolume: function(percentAsDecimal) { + setVolume(percentAsDecimal) { if (!this.ytPlayer) { return; } this.ytPlayer.setVolume(percentAsDecimal * 100.0); - }, + } - muted: function() { + muted() { return this.ytPlayer ? this.ytPlayer.isMuted() : false; - }, + } - setMuted: function(mute) { + setMuted(mute) { if (!this.ytPlayer) { return; } @@ -614,9 +614,9 @@ THE SOFTWARE. */ this.setTimeout( function(){ this.trigger('volumechange'); }, 50); - }, + } - buffered: function() { + buffered() { if(!this.ytPlayer || !this.ytPlayer.getVideoLoadedFraction) { return videojs.createTimeRange(); } @@ -624,13 +624,13 @@ THE SOFTWARE. */ var bufferedEnd = this.ytPlayer.getVideoLoadedFraction() * this.ytPlayer.getDuration(); return videojs.createTimeRange(0, bufferedEnd); - }, + } // TODO: Can we really do something with this on YouTUbe? - preload: function() {}, - load: function() {}, - reset: function() {}, - networkState: function () { + preload() {} + load() {} + reset() {} + networkState() { if (!this.ytPlayer) { return 0; //NETWORK_EMPTY } @@ -642,8 +642,8 @@ THE SOFTWARE. */ default: return 1; //NETWORK_IDLE } - }, - readyState: function () { + } + readyState() { if (!this.ytPlayer) { return 0; //HAVE_NOTHING } @@ -657,17 +657,17 @@ THE SOFTWARE. */ default: return 4; //HAVE_ENOUGH_DATA } - }, + } - supportsFullScreen: function() { + supportsFullScreen() { return document.fullscreenEnabled || - document.webkitFullscreenEnabled || - document.mozFullScreenEnabled || - document.msFullscreenEnabled; - }, + document.webkitFullscreenEnabled || + document.mozFullScreenEnabled || + document.msFullscreenEnabled; + } // Tries to get the highest resolution thumbnail available for the video - checkHighResPoster: function(){ + checkHighResPoster(){ var uri = 'https://img.youtube.com/vi/' + this.url.videoId + '/maxresdefault.jpg'; try { @@ -690,7 +690,7 @@ THE SOFTWARE. */ } catch(e){} } - }); + } Youtube.isSupported = function() { return true; @@ -763,10 +763,10 @@ THE SOFTWARE. */ function injectCss() { var css = // iframe blocker to catch mouse events - '.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; }'; + '.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; }'; var head = document.head || document.getElementsByTagName('head')[0]; diff --git a/media/player/videojs/readme_moodle.txt b/media/player/videojs/readme_moodle.txt index 481ea2ea26a..63f6d8f3345 100644 --- a/media/player/videojs/readme_moodle.txt +++ b/media/player/videojs/readme_moodle.txt @@ -16,17 +16,26 @@ Instructions to import VideoJS player into Moodle: 6. copy 'lang/' into 'videojs/' subfolder (so the result will be media/player/videojs/videojs/lang). Import plugins: +YouTube Playback Technology for VideoJS 3.0.0 +--------------------------------------------- +https://github.com/videojs/videojs-youtube +Instructions to import YouTube Playback Technology into Moodle: 1. Copy https://github.com/videojs/videojs-youtube/blob/master/dist/Youtube.js into 'amd/src/Youtube-lazy.js' In the beginning of the js file replace define(['videojs'] with define(['media_videojs/video-lazy'] -2. Download the latest release from https://github.com/HuongNV13/videojs-ogvjs/releases +Ogv.js Playback Technology for VideoJS 0.2.1 +--------------------------------------------- +https://github.com/HuongNV13/videojs-ogvjs + +Instructions to import Ogv.js Playback Technology into Moodle: +1. Download the latest release from https://github.com/HuongNV13/videojs-ogvjs/releases (do not choose "Source code") -3. Copy videojs-ogvjs.js into 'amd/src/videojs-ogvjs-lazy.js' +2. Copy videojs-ogvjs.js into 'amd/src/videojs-ogvjs-lazy.js' In the beginning of the js file: Replace diff --git a/media/player/videojs/thirdpartylibs.xml b/media/player/videojs/thirdpartylibs.xml index cae387795ff..6670501d85a 100644 --- a/media/player/videojs/thirdpartylibs.xml +++ b/media/player/videojs/thirdpartylibs.xml @@ -17,7 +17,7 @@ amd/src/Youtube-lazy.js videojs-youtube YouTube Playback Technology for Video.js. - 2.6.1 + 3.0.0 MIT https://github.com/videojs/videojs-youtube