diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..2d4daa405 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea* diff --git a/classes/Conf/class.xoctConf.php b/classes/Conf/class.xoctConf.php index 2ff4b4cbc..aceffa8d5 100644 --- a/classes/Conf/class.xoctConf.php +++ b/classes/Conf/class.xoctConf.php @@ -60,6 +60,10 @@ class xoctConf extends ActiveRecord { const NO_METADATA = 0; const ALL_METADATA = 1; const METADATA_EXCEPT_DATE_PLACE = 2; + + const USE_STREAMING = 'use_streaming'; + const STREAMING_URL = 'streaming_url'; + /** * @var array */ diff --git a/classes/Conf/class.xoctConfFormGUI.php b/classes/Conf/class.xoctConfFormGUI.php index c371e3d5b..b582cc796 100644 --- a/classes/Conf/class.xoctConfFormGUI.php +++ b/classes/Conf/class.xoctConfFormGUI.php @@ -196,6 +196,20 @@ protected function initAPISection() { $te->setInfo($this->parent_gui->txt(xoctConf::F_CURL_PASSWORD . '_info')); $te->setRequired(true); $this->addItem($te); + + $h = new ilFormSectionHeaderGUI(); + $h->setTitle($this->parent_gui->txt('streaming')); + $this->addItem($h); + + $te = new ilTextInputGUI($this->parent_gui->txt(xoctConf::STREAMING_URL), xoctConf::STREAMING_URL); + $te->setInfo($this->parent_gui->txt(xoctConf::STREAMING_URL . '_info')); + $te->setRequired(false); + $this->addItem($te); + + $te = new ilCheckboxInputGUI($this->parent_gui->txt(xoctConf::USE_STREAMING), xoctConf::USE_STREAMING); + $te->setInfo($this->parent_gui->txt(xoctConf::USE_STREAMING . '_info')); + $te->setRequired(false); + $this->addItem($te); } diff --git a/classes/Event/class.xoctEventGUI.php b/classes/Event/class.xoctEventGUI.php index 4c284e3ab..48a967060 100755 --- a/classes/Event/class.xoctEventGUI.php +++ b/classes/Event/class.xoctEventGUI.php @@ -482,7 +482,10 @@ public function streamVideo() { }, []); $duration = 0; - $streams = array_map(function (xoctMedia $media) use (&$duration, &$previews) { + + $id = filter_input(INPUT_GET, self::IDENTIFIER); + + $streams = array_map(function (xoctMedia $media) use (&$duration, &$previews, &$id) { $url = $media->getUrl(); if (xoctConf::getConfig(xoctConf::F_SIGN_PLAYER_LINKS)) { $url = xoctSecureLink::sign($url); @@ -504,23 +507,54 @@ public function streamVideo() { $preview_url = ""; } - return [ - "type" => xoctMedia::MEDIA_TYPE_VIDEO, - "role" => ($role !== xoctMedia::ROLE_PRESENTATION ? self::ROLE_MASTER : self::ROLE_SLAVE), - "sources" => [ - "mp4" => [ - [ - "src" => $url, - "mimetype" => $media->getMediatype(), - "res" => [ - "w" => $media->getWidth(), - "h" => $media->getHeight() - ] - ] - ] - ], - "preview" => $preview_url - ]; + + + if( xoctConf::getConfig(xoctConf::USE_STREAMING)) { + + $smilURLIdentifier = ($role !== xoctMedia::ROLE_PRESENTATION ? "_presenter" : "_presentation"); + + $streamingServerURL = xoctConf::getConfig(xoctConf::STREAMING_URL); + + return [ + "type" => xoctMedia::MEDIA_TYPE_VIDEO, + "role" => ($role !== xoctMedia::ROLE_PRESENTATION ? self::ROLE_MASTER : self::ROLE_SLAVE), + "sources" => [ + "hls" => [ + [ + "src" => $streamingServerURL ."/smil:engage-player_". $id . $smilURLIdentifier . ".smil/playlist.m3u8", + "mimetype" => "application/x-mpegURL" + ], + ], + "dash" => [ + [ + "src" => $streamingServerURL ."/smil:engage-player_". $id . $smilURLIdentifier . ".smil/manifest_mpm4sav_mvlist.mpd", + "mimetype" => "application/dash+xml" + ] + ] + ], + "preview" => $preview_url + ]; + } + else{ + return [ + "type" => xoctMedia::MEDIA_TYPE_VIDEO, + "role" => ($role !== xoctMedia::ROLE_PRESENTATION ? self::ROLE_MASTER : self::ROLE_SLAVE), + "sources" => [ + "mp4" => [ + [ + "src" => $url, + "mimetype" => $media->getMediatype(), + "res" => [ + "w" => $media->getWidth(), + "h" => $media->getHeight() + ] + ] + ] + + ], + "preview" => $preview_url + ]; + } }, $medias); $segments = array_filter($publication->getAttachments(), function (xoctAttachment $attachment) { diff --git a/classes/Request/class.xoctRequest.php b/classes/Request/class.xoctRequest.php index 5dabe3cad..777cba92c 100644 --- a/classes/Request/class.xoctRequest.php +++ b/classes/Request/class.xoctRequest.php @@ -438,7 +438,13 @@ public function agents() { */ public function scheduling() { $this->checkBranch(array( self::BRANCH_EVENTS )); - $this->addPart('scheduling'); + + if (xoct::isApiVersionGreaterThan('v1.1.0')){ + $this->addPart('scheduling'); + } + else{ + $this->addPart('scheduling.json'); + } return $this; } diff --git a/js/paella_player/config/config.json b/js/paella_player/config/config.json index ddb4fb620..7bb3702a5 100644 --- a/js/paella_player/config/config.json +++ b/js/paella_player/config/config.json @@ -21,8 +21,8 @@ { "factory":"ChromaVideoFactory", "enabled": false }, { "factory":"WebmVideoFactory", "enabled": true }, { "factory":"Html5VideoFactory", "enabled": true }, - { "factory":"MpegDashVideoFactory", "enabled": false }, - { "factory":"HLSVideoFactory", "enabled": false }, + { "factory":"MpegDashVideoFactory", "enabled": true }, + { "factory":"HLSVideoFactory", "enabled": true }, { "factory":"RTMPVideoFactory", "enabled": true }, { "factory":"ImageVideoFactory", "enabled": true }, { "factory":"YoutubeVideoFactory", "enabled": false }, diff --git a/js/paella_player/javascript/paella_player.js b/js/paella_player/javascript/paella_player.js index 7a924f481..503b0dd1b 100644 --- a/js/paella_player/javascript/paella_player.js +++ b/js/paella_player/javascript/paella_player.js @@ -1 +1 @@ -"use strict";var GlobalParams={video:{zIndex:1},background:{zIndex:0}};window.paella=window.paella||{},paella.player=null,paella.version="5.3.4 - build: 92cc4ff",function(){if(window.paella_debug_baseUrl)paella.baseUrl=window.paella_debug_baseUrl;else{var e=document.getElementsByTagName("script"),t=e[e.length-1].src.split("/");t.pop(),t.pop(),paella.baseUrl=t.join("/")+"/"}}(),paella.events={play:"paella:play",pause:"paella:pause",next:"paella:next",previous:"paella:previous",seeking:"paella:seeking",seeked:"paella:seeked",timeupdate:"paella:timeupdate",timeUpdate:"paella:timeupdate",seekTo:"paella:setseek",endVideo:"paella:endvideo",seekToTime:"paella:seektotime",setTrim:"paella:settrim",setPlaybackRate:"paella:setplaybackrate",setVolume:"paella:setVolume",setComposition:"paella:setComposition",loadStarted:"paella:loadStarted",loadComplete:"paella:loadComplete",loadPlugins:"paella:loadPlugins",error:"paella:error",setProfile:"paella:setprofile",documentChanged:"paella:documentChanged",didSaveChanges:"paella:didsavechanges",controlBarWillHide:"paella:controlbarwillhide",controlBarDidHide:"paella:controlbardidhide",controlBarDidShow:"paella:controlbardidshow",hidePopUp:"paella:hidePopUp",showPopUp:"paella:showPopUp",enterFullscreen:"paella:enterFullscreen",exitFullscreen:"paella:exitFullscreen",resize:"paella:resize",videoZoomChanged:"paella:videoZoomChanged",audioLanguageChanged:"paella:audiolanguagechanged",zoomAvailabilityChanged:"paella:zoomavailabilitychanged",qualityChanged:"paella:qualityChanged",singleVideoReady:"paella:singleVideoReady",singleVideoUnloaded:"paella:singleVideoUnloaded",videoReady:"paella:videoReady",videoUnloaded:"paella:videoUnloaded",controlBarLoaded:"paella:controlBarLoaded",flashVideoEvent:"paella:flashVideoEvent",captionAdded:"paella:caption:add",captionsEnabled:"paella:caption:enabled",captionsDisabled:"paella:caption:disabled",trigger:function(e,t){$(document).trigger(e,t)},bind:function(e,t){$(document).bind(e,function(e,n){t(e,n)})},setupExternalListener:function(){window.addEventListener("message",function(e){e.data&&e.data.event&&paella.events.trigger(e.data.event,e.data.params)},!1)}},paella.events.setupExternalListener(),Class("paella.MouseManager",{targetObject:null,initialize:function(){var e=this;paella.events.bind("mouseup",function(t){e.up(t)}),paella.events.bind("mousemove",function(t){e.move(t)}),paella.events.bind("mouseover",function(t){e.over(t)})},down:function(e,t){return this.targetObject=e,this.targetObject&&this.targetObject.down&&(this.targetObject.down(t,t.pageX,t.pageY),t.cancelBubble=!0),!1},up:function(e){return this.targetObject&&this.targetObject.up&&(this.targetObject.up(e,e.pageX,e.pageY),e.cancelBubble=!0),this.targetObject=null,!1},out:function(e){return this.targetObject&&this.targetObject.out&&(this.targetObject.out(e,e.pageX,e.pageY),e.cancelBubble=!0),!1},move:function(e){return this.targetObject&&this.targetObject.move&&(this.targetObject.move(e,e.pageX,e.pageY),e.cancelBubble=!0),!1},over:function(e){return this.targetObject&&this.targetObject.over&&(this.targetObject.over(e,e.pageX,e.pageY),e.cancelBubble=!0),!1}}),function(){var e=document.createElement("link");e.rel="stylesheet",e.href=paella.baseUrl+"resources/bootstrap/css/bootstrap.min.css",e.type="text/css",e.media="screen",e.charset="utf-8",document.head.appendChild(e)}(),paella.utils={mouseManager:new paella.MouseManager,folders:{get:function(e){if(paella.player&&paella.player.config&&paella.player.config.folders&&paella.player.config.folders[e])return paella.player.config.folders[e]},profiles:function(){return paella.baseUrl+(paella.utils.folders.get("profiles")||"config/profiles")},resources:function(){return paella.baseUrl+(paella.utils.folders.get("resources")||"resources")},skins:function(){return paella.baseUrl+(paella.utils.folders.get("skins")||paella.utils.folders.get("resources")+"/style")}},styleSheet:{removeById:function(e){var t=$(document.head).find("#"+e)[0];t&&document.head.removeChild(t)},remove:function(e){for(var t=document.head.getElementsByTagName("link"),n=0;n/g,">")},htmlUnescape:function(e){return String(e).replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}},Class("paella.Node",{identifier:"",nodeList:null,parent:null,initialize:function(e){this.nodeList={},this.identifier=e},addTo:function(e){e.addNode(this)},addNode:function(e){return e.parent=this,this.nodeList[e.identifier]=e,e},getNode:function(e){return this.nodeList[e]},removeNode:function(e){return!!this.nodeList[e.identifier]&&(delete this.nodeList[e.identifier],!0)}}),Class("paella.DomNode",paella.Node,{domElement:null,initialize:function(e,t,n){this.parent(t),this.domElement=document.createElement(e),this.domElement.id=t,n&&$(this.domElement).css(n)},addNode:function(e){var t=this.parent(e);return this.domElement.appendChild(e.domElement),t},onresize:function(){},removeNode:function(e){this.parent(e)&&this.domElement.removeChild(e.domElement)}}),Class("paella.Button",paella.DomNode,{isToggle:!1,initialize:function(e,t,n,a){this.isToggle=a;if(this.parent("div",e,{}),this.domElement.className=t,a){var i=this;$(this.domElement).click(function(e){i.toggleIcon()})}$(this.domElement).click("click",n)},isToggled:function(){if(this.isToggle){var e=this.domElement;return/([a-zA-Z0-9_]+)_active/.test(e.className)}return!1},toggle:function(){this.toggleIcon()},toggleIcon:function(){var e=this.domElement;/([a-zA-Z0-9_]+)_active/.test(e.className)?e.className=RegExp.$1:e.className=e.className+"_active"},show:function(){$(this.domElement).show()},hide:function(){$(this.domElement).hide()},visible:function(){return this.domElement.visible()}}),Class("paella.VideoQualityStrategy",{getParams:function(){return paella.player.config.player.videoQualityStrategyParams||{}},getQualityIndex:function(e){return e.length>0?e[e.length-1]:e}}),Class("paella.BestFitVideoQualityStrategy",paella.VideoQualityStrategy,{getQualityIndex:function(e){var t=e.length-1;if(e.length>0){var n=e[0],a=$(window).width()*$(window).height();if(n.res&&n.res.w&&n.res.h)for(var i=parseInt(n.res.w)*parseInt(n.res.h),r=Math.abs(a-i),o=0;o0){var a=$(window).height(),i=n.maxAutoQualityRes||720,r=Number.MAX_VALUE;e.forEach(function(e,n){e.res&&e.res.h<=i&&(Math.abs(a-e.res.h)=t.audio.HAVE_CURRENT_DATA?(t._ready=!0,n("function"!=typeof e||e())):setTimeout(i,50)};i()}})}var t=function(t){return $traceurRuntime.createClass(function e(t,n){$traceurRuntime.superConstructor(e).call(this,t,n),this._streamName="audio",this._audio=document.createElement("audio"),this.domElement.appendChild(this._audio)},{get audio(){return this._audio},setAutoplay:function(e){this.audio.autoplay=e},load:function(){var t=this._stream.sources[this._streamName],n=t.length>0?t[0]:null;if(this.audio.innerHTML="",n){var a=this.audio.querySelector("source");return a||(a=document.createElement("source"),this.audio.appendChild(a)),a.src=n.src,n.type&&(a.type=n.type),this.audio.load(),e.apply(this,[function(){return n}])}return Promise.reject(new Error("Could not load video: invalid quality stream index"))},play:function(){var t=this;return e.apply(this,[function(){t.audio.play()}])},pause:function(){var t=this;return e.apply(this,[function(){t.audio.pause()}])},isPaused:function(){var t=this;return e.apply(this,[function(){return t.audio.paused}])},duration:function(){var t=this;return e.apply(this,[function(){return t.audio.duration}])},setCurrentTime:function(t){var n=this;return e.apply(this,[function(){n.audio.currentTime=t}])},currentTime:function(){var t=this;return e.apply(this,[function(){return t.audio.currentTime}])},setVolume:function(t){var n=this;return e.apply(this,[function(){return n.audio.volume=t}])},volume:function(){var t=this;return e.apply(this,[function(){return t.audio.volume}])},setPlaybackRate:function(t){var n=this;return e.apply(this,[function(){n.audio.playbackRate=t}])},playbackRate:function(){var t=this;return e.apply(this,[function(){return t.audio.playbackRate}])},unload:function(){return Promise.resolve()}},{},t)}(paella.AudioElementBase);paella.MultiformatAudioElement=t;var n=function(){return $traceurRuntime.createClass(function(){},{isStreamCompatible:function(e){return!0},getAudioObject:function(e,t){return new paella.MultiformatAudioElement(e,t)}},{})}();paella.audioFactories.MultiformatAudioFactory=n}(),paella.Profiles={profileList:null,getDefaultProfile:function(){return paella.player.videoContainer.masterVideo()&&paella.player.videoContainer.masterVideo().defaultProfile()?paella.player.videoContainer.masterVideo().defaultProfile():paella.player&&paella.player.config&&paella.player.config.defaultProfile?paella.player.config.defaultProfile:void 0},loadProfile:function(e,t){var n=this.getDefaultProfile();this.loadProfileList(function(a){var i;if(a[e])i=a[e];else{if(!a[n])return base.log.debug("Error loading the default profile. Check your Paella Player configuration"),!1;i=a[n]}t(i)})},loadProfileList:function(e){var t=this;if(null==this.profileList){var n={url:paella.utils.folders.profiles()+"/profiles.json"};base.ajax.get(n,function(n,a,i){"string"==typeof n&&(n=JSON.parse(n)),t.profileList=n,e(t.profileList)},function(e,t,n){base.log.debug("Error loading video profiles. Check your Paella Player configuration")})}else e(t.profileList)}},Class("paella.RelativeVideoSize",{w:1280,h:720,proportionalHeight:function(e){return Math.floor(this.h*e/this.w)},proportionalWidth:function(e){return Math.floor(this.w*e/this.h)},percentVSize:function(e){return 100*e/this.h},percentWSize:function(e){return 100*e/this.w},aspectRatio:function(){return this.w/this.h}}),Class("paella.VideoRect",paella.DomNode,{_rect:null,initialize:function(e,t,n,a,i,r){var o=this,s=paella.player.config.player.videoZoom||{},l=(void 0===s.enabled||s.enabled)&&this.allowZoom();this.parent(t,e,l?{width:this._zoom+"%",height:"100%",position:"absolute"}:{width:"100%",height:"100%"});var u=document.createElement("div");if(setTimeout(function(){return o.domElement.parentElement.appendChild(u)},10),u.style.position="absolute",u.style.top="0px",u.style.left="0px",u.style.right="0px",u.style.bottom="0px",this.eventCapture=u,l){var c=function(){var e=paella.player.config.player&&paella.player.config.player.videoZoom&&paella.player.config.player.videoZoom.minWindowSize||500,t=$(window).width()>=e;this._zoomAvailable!=t&&(this._zoomAvailable=t,paella.events.trigger(paella.events.zoomAvailabilityChanged,{available:t}))},d=function(e){return{x:e.originalEvent.offsetX,y:e.originalEvent.offsetY}},p=function(e,t){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))},h=function(e){var t={x:this._mouseCenter.x-1.1*e.x,y:this._mouseCenter.y-1.1*e.y},n=$(this.domElement).width(),a=$(this.domElement).height(),i=this._zoom-100,r={x:t.x*i/n,y:t.y*i/a};r.x>i?r.x=i:r.x<0?r.x=0:this._mouseCenter.x=t.x,r.y>i?r.y=i:r.y<0?r.y=0:this._mouseCenter.y=t.y,$(this.domElement).css({left:"-"+r.x+"%",top:"-"+r.y+"%"}),this._zoomOffset={x:r.x,y:r.y},paella.events.trigger(paella.events.videoZoomChanged,{video:this})};this._zoomAvailable=!0,c.apply(this),$(window).resize(function(){c.apply(o)}),this._zoom=100,this._mouseCenter={x:0,y:0},this._mouseDown={x:0,y:0},this._zoomOffset={x:0,y:0},this._maxZoom=s.max||400,$(this.domElement).css({width:"100%",height:"100%",left:"0%",top:"0%"}),Object.defineProperty(this,"zoom",{get:function(){return this._zoom}}),Object.defineProperty(this,"zoomOffset",{get:function(){return this._zoomOffset}});var m=[];$(u).on("touchstart",function(e){if(o.allowZoom()&&o._zoomAvailable){m=[];for(var t=$(o.domElement).offset(),n=0;n1&&e.preventDefault()}}),$(u).on("touchmove",function(e){if(o.allowZoom()&&o._zoomAvailable){for(var t,n,a=[],i=$(o.domElement).offset(),r=0;r1&&m.length>1){var l=p(m[0],m[1]),u=p(a[0],a[1])-l,c=(t=m[0],{x:((n=m[1]).x-t.x)/2+t.x,y:(n.y-t.y)/2+t.y});o._mouseCenter=c,o._zoom+=u,o._zoom=o._zoom<100?100:o._zoom,o._zoom=o._zoom>o._maxZoom?o._maxZoom:o._zoom;var d={w:$(o.domElement).width(),h:$(o.domElement).height()},f=o._mouseCenter;$(o.domElement).css({width:o._zoom+"%",height:o._zoom+"%"});var g=o._zoom-100,v={x:f.x*g/d.w,y:f.y*g/d.h};v.x=v.x0){var y={x:a[0].x-m[0].x,y:a[0].y-m[0].y};h.apply(o,[y]),m=a,e.preventDefault()}}}),$(u).on("touchend",function(e){o.allowZoom()&&o._zoomAvailable&&m.length>1&&e.preventDefault()}),this.zoomIn=function(){if(!(o._zoom>=o._maxZoom)&&o._zoomAvailable){o._mouseCenter||(o._mouseCenter={x:$(o.domElement).width()/2,y:$(o.domElement).height()/2}),o._zoom+=25,o._zoom=o._zoom<100?100:o._zoom,o._zoom=o._zoom>o._maxZoom?o._maxZoom:o._zoom;var e=$(o.domElement).width(),t=$(o.domElement).height(),n=o._mouseCenter;$(o.domElement).css({width:o._zoom+"%",height:o._zoom+"%"});var a=o._zoom-100,i={x:n.x*a/e,y:n.y*a/t};i.x=i.xo._maxZoom?o._maxZoom:o._zoom;var e=$(o.domElement).width(),t=$(o.domElement).height(),n=o._mouseCenter;$(o.domElement).css({width:o._zoom+"%",height:o._zoom+"%"});var a=o._zoom-100,i={x:n.x*a/e,y:n.y*a/t};i.x=i.x=o._maxZoom&&n>0)){o._zoom+=n,o._zoom=o._zoom<100?100:o._zoom,o._zoom=o._zoom>o._maxZoom?o._maxZoom:o._zoom;var a=$(o.domElement).width(),i=$(o.domElement).height();$(o.domElement).css({width:o._zoom+"%",height:o._zoom+"%"});var r=o._zoom-100,s={x:t.x*r/a,y:t.y*r/i};return s.x=s.x=12&&paella.utils.userAgent.browser.Safari,t=paella.utils.userAgent.system.iOS,n=paella.utils.userAgent.browser.Chrome&&paella.utils.userAgent.browser.Version.major>=64;return!(e||t||n)},goFullScreen:function(){var e=this;return this._deferredAction(function(){var t=e.video;t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitEnterFullscreen&&t.webkitEnterFullscreen()})},unFreeze:function(){var e=this;return this._deferredAction(function(){var t=document.getElementById(e.video.id+"canvas");t&&$(t).remove()})},freeze:function(){var e=this;return this._deferredAction(function(){var t=document.createElement("canvas");t.id=e.video.id+"canvas",t.className="freezeFrame",t.width=e.video.videoWidth,t.height=e.video.videoHeight,t.style.cssText=e.video.style.cssText,t.style.zIndex=2,t.getContext("2d").drawImage(e.video,0,0,16*Math.ceil(t.width/16),16*Math.ceil(t.height/16)),e.video.parentElement.appendChild(t)})},unload:function(){return this._callUnloadEvent(),paella_DeferredNotImplemented()},getDimensions:function(){return paella_DeferredNotImplemented()}}),Class("paella.videoFactories.Html5VideoFactory",{isStreamCompatible:function(e){try{if(paella.videoFactories.Html5VideoFactory.s_instances>0&&base.userAgent.system.iOS&&paella.utils.userAgent.system.Version.major<=10&&paella.utils.userAgent.system.Version.minor<3)return!1;for(var t in e.sources)if("mp4"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return++paella.videoFactories.Html5VideoFactory.s_instances,new paella.Html5Video(e,t,n.x,n.y,n.w,n.h)}}),paella.videoFactories.Html5VideoFactory.s_instances=0,Class("paella.ImageVideo",paella.VideoElementBase,{_posterFrame:null,_currentQuality:null,_currentTime:0,_duration:0,_ended:!1,_playTimer:null,_playbackRate:1,_frameArray:null,initialize:function(e,t,n,a,i,r){this.parent(e,t,"img",n,a,i,r);var o=this;this._stream.sources.image.sort(function(e,t){return e.res.h-t.res.h}),Object.defineProperty(this,"img",{get:function(){return o.domElement}}),Object.defineProperty(this,"imgStream",{get:function(){return this._stream.sources.image[this._currentQuality]}}),Object.defineProperty(this,"_paused",{get:function(){return null==this._playTimer}})},_deferredAction:function(e){var t=this;return new Promise(function(n){if(t.ready)n(e());else{n=function(){t._ready=!0,n(e())};$(t.video).bind("paella:imagevideoready",n)}})},_getQualityObject:function(e,t){return{index:e,res:t.res,src:t.src,toString:function(){return this.res.w+"x"+this.res.h},shortLabel:function(){return this.res.h+"p"},compare:function(e){return this.res.w*this.res.h-e.res.w*e.res.h}}},_loadCurrentFrame:function(){var e=this;if(this._frameArray){var t=this._frameArray[0];this._frameArray.some(function(n){if(e._currentTimen._trimming.end&&n.setCurrentTime(n._trimming.end),n._trimming.enabled){var o=paella.captions.getActiveCaptions();void 0!==o&&paella.plugins.captionsPlugin.buildBodyContent(o._captions,"list")}paella.events.trigger(paella.events.setTrim,{trimEnabled:n._trimming.enabled,trimStart:n._trimming.start,trimEnd:n._trimming.end}),a()})})},setTrimmingStart:function(e){return this.setTrimming(e,this._trimming.end)},setTrimmingEnd:function(e){return this.setTrimming(this._trimming.start,e)},setCurrentPercent:function(e){var t=this,n=this,a=0;return new Promise(function(i){t.duration().then(function(e){return a=e,n.trimming()}).then(function(t){var i=0;if(t.enabled){var r=t.start,o=t.end;a=o-r,i=parseFloat(e*a/100)}else i=e*a/100;return n.setCurrentTime(i)}).then(function(e){i(e)})})},setCurrentTime:function(e){base.log.debug("VideoContainerBase.setCurrentTime("+e+")")},currentTime:function(){return base.log.debug("VideoContainerBase.currentTime()"),0},duration:function(){return base.log.debug("VideoContainerBase.duration()"),0},paused:function(){return base.log.debug("VideoContainerBase.paused()"),!0},setupVideo:function(e){base.log.debug("VideoContainerBase.setupVide()")},isReady:function(){return base.log.debug("VideoContainerBase.isReady()"),!0},onresize:function(){this.parent(onresize)}}),Class("paella.ProfileFrameStrategy",{valid:function(){return!0},adaptFrame:function(e,t){return t}}),Class("paella.LimitedSizeProfileFrameStrategy",paella.ProfileFrameStrategy,{adaptFrame:function(e,t){if(e.width0?this._slaveVideos[0]:null},get audioStreams(){return this._audioStreams},get isLiveStreaming(){return paella.player.isLiveStream()}},{})}();function t(e,t){var n=new paella.VideoWrapper(e);return n.addNode(t),this.videoWrappers.push(n),this.container.addNode(n),n}paella.StreamProvider=e;var n=function(e){function n(e){$traceurRuntime.superConstructor(n).call(this,e),this.containerId="",this.video1Id="",this.videoSlaveId="",this.backgroundId="",this.container=null,this.profileFrameStrategy=null,this.videoWrappers=[],this._players=[],this._videoPlayers=[],this._audioPlayers=[],this._audioPlayer=null,this._audioLanguage=paella.dictionary.currentLanguage(),this._volume=1,this.videoClasses={master:"video masterVideo",slave:"video slaveVideo"},this.isHidden=!1,this.logos=null,this.overlayContainer=null,this.videoSyncTimeMillis=5e3,this.currentMasterVideoRect={},this.currentSlaveVideoRect={},this._maxSyncDelay=.5,this._isMonostream=!1,this._videoQualityStrategy=null,this._sourceData=null,this._isMasterReady=!1,this._isSlaveReady=!1,this._firstLoad=!1,this._playOnLoad=!1,this._seekToOnLoad=0,this._showPosterFrame=!0,this._currentProfile=null;var t=this;this._sourceData=[],this.containerId=e+"_container",this.video1Id=e+"_master",this.videoSlaveId=e+"_slave_",this.audioId=e+"_audio_",this.backgroundId=e+"_bkg",this.logos=[],this._videoQualityStrategy=this._getQualityStrategyObject(),this.container=new paella.DomNode("div",this.containerId,{position:"relative",display:"block",marginLeft:"auto",marginRight:"auto",width:"1024px",height:"567px"}),this.container.domElement.setAttribute("role","main"),this.addNode(this.container),this.overlayContainer=new paella.VideoOverlay(this.domElement),this.container.addNode(this.overlayContainer),this.container.addNode(new paella.BackgroundContainer(this.backgroundId,paella.utils.folders.profiles()+"/resources/default_background_paella.jpg")),Object.defineProperty(this,"sourceData",{get:function(){return this._sourceData}}),new base.Timer(function(e){t.syncVideos()},t.videoSyncTimeMillis).repeat=!0;var a=paella.player.config;try{var i=a.player.profileFrameStrategy,r=new(Class.fromString(i));dynamic_cast("paella.ProfileFrameStrategy",r)&&this.setProfileFrameStrategy(r)}catch(e){}this._streamProvider=new paella.StreamProvider,Object.defineProperty(this,"ready",{get:function(){return this._isMasterReady&&this._isSlaveReady}}),Object.defineProperty(this,"isMonostream",{get:function(){return this._isMonostream}})}return $traceurRuntime.createClass(n,{_getQualityStrategyObject:function(){var e=null;return paella.player.config.player.videoQualityStrategy.split(".").forEach(function(t,n,a){e=0==n&&a.length>1?window[t]:e[t]}),new(e=e||paella.VideoQualityStrategy())},getVideoData:function(){var e=this;return new Promise(function(t){var n={master:null,slaves:[]},a=[];e.masterVideo()&&a.push(e.masterVideo().getVideoData().then(function(e){return n.master=e,Promise.resolve(e)})),e.slaveVideo()&&a.push(e.slaveVideo().getVideoData().then(function(e){return n.slaves.push(e),Promise.resolve(e)})),Promise.all(a).then(function(){t(n)})})},setVideoQualityStrategy:function(e){this._videoQualityStrategy=e,this.masterVideo()&&this.masterVideo().setVideoQualityStrategy(this._videoQualityStrategy),this.slaveVideo()&&slaveVideo.setVideoQualityStrategy(this._videoQualityStrategy)},setProfileFrameStrategy:function(e){this.profileFrameStrategy=e},getMasterVideoRect:function(){return this.currentMasterVideoRect},getSlaveVideoRect:function(){return this.currentSlaveVideoRect},setHidden:function(e){this.isHidden=e},hideVideo:function(){this.setHidden(!0)},publishVideo:function(){this.setHidden(!1)},syncVideos:function(){var e=this,t=this.masterVideo(),n=this.slaveVideo(),a=0,i=0;!this._isMonostream&&t&&t.currentTime().then(function(e){return a=e,n?n.currentTime():Promise.resolve(-1)}).then(function(t){if(t>=-1){i=t;var r=Math.abs(a-i);r>e._maxSyncDelay&&(base.log.debug("Sync videos performed, diff="+r),n.setCurrentTime(a))}var o=[];return e._audioPlayers.forEach(function(e){o.push(e.currentTime())}),Promise.all(o)}).then(function(t){t.forEach(function(t,n){var i=e._audioPlayers[n],r=Math.abs(a-t);r>e._maxSyncDelay&&(base.log.debug("Sync audio performed, diff="+r),i.setCurrentTime(t))})})},checkVideoBounds:function(e,t,n,a){var i=this,r=e.start,o=e.end,s=e.enabled;paella.events.bind(paella.events.endVideo,function(){i.setCurrentTime(0)}),s?t>=Math.floor(o)&&!n?(paella.events.trigger(paella.events.endVideo,{videoContainer:this}),this.pause()):t=a&&(paella.events.trigger(paella.events.endVideo,{videoContainer:this}),this.pause())},play:function(){var e=this;return new Promise(function(t){e._firstLoad?e._playOnLoad=!0:e._firstLoad=!0;var a=e.masterVideo(),i=e.slaveVideo();a?a.play().then(function(){i&&i.play(),e._audioPlayers.forEach(function(e){e.play()}),$traceurRuntime.superGet(e,n.prototype,"play").call(e),t()}):reject(new Error("Invalid master video"))})},pause:function(){var e=this;return new Promise(function(t,a){var i=e.masterVideo(),r=e.slaveVideo();i?i.pause().then(function(){r&&r.pause(),e._audioPlayers.forEach(function(e){e.pause()}),$traceurRuntime.superGet(e,n.prototype,"pause").call(e),t()}):a(new Error("invalid master video"))})},next:function(){0!==this._trimming.end?this.setCurrentTime(this._trimming.end):this.duration(!0).then(function(e){this.setCurrentTime(e)}),$traceurRuntime.superGet(this,n.prototype,"next").call(this)},previous:function(){this.setCurrentTime(this._trimming.start),$traceurRuntime.superGet(this,n.prototype,"previous").call(this)},setCurrentTime:function(e){var t=this;return new Promise(function(n){var a=[];t._trimming.enabled&&((e+=t._trimming.start)t._trimming.end&&(e=t._trimming.end)),a.push(t.masterVideo().setCurrentTime(e)),t.slaveVideo()&&a.push(t.slaveVideo().setCurrentTime(e)),t._audioPlayers.forEach(function(t){a.push(t.setCurrentTime(e))}),Promise.all(a).then(function(){return t.duration(!1)}).then(function(t){n({time:e,duration:t})})})},currentTime:function(){var e=void 0!==arguments[0]&&arguments[0],t=this;if(this._trimming.enabled&&!e){var n=this._trimming.start;return new Promise(function(e){t.masterVideo().currentTime().then(function(t){e(t-n)})})}return this.masterVideo().currentTime()},setPlaybackRate:function(e){var t=this.masterVideo(),a=this.slaveVideo();t&&t.setPlaybackRate(e),a&&a.setPlaybackRate(e),$traceurRuntime.superGet(this,n.prototype,"setPlaybackRate").call(this,e)},setVolume:function(e){var t=this;return new Promise(function(n){"object"==$traceurRuntime.typeof(e)&&(e=void 0!==e.master?e.master:1),t.mainAudioPlayer().setVolume(e).then(function(){paella.events.trigger(paella.events.setVolume,{master:e}),t._volume=e,n(e)})})},volume:function(){var e=this;return new Promise(function(t){e.mainAudioPlayer().volume().then(function(e){t(e)})})},masterVideo:function(){return this.videoWrappers.length>0?this.videoWrappers[0].getNode(this.video1Id):null},slaveVideo:function(){return this.videoWrappers.length>1?this.videoWrappers[1].getNode(this.videoSlaveId+1):null},mainAudioPlayer:function(){return this._audioPlayer},players:function(){var e=this;return new Promise(function(t){!function n(){e.masterVideo()?t(e._players):setTimeout(function(){return n()},10)}()})},videoPlayers:function(){var e=this;return new Promise(function(t){!function n(){e.masterVideo()?t(e._videoPlayers):setTimeout(function(){return n()},10)}()})},audioPlayers:function(){var e=this;return new Promise(function(t){!function n(){e.masterVideo()?t(e._audioPlayers):setTimeout(function(){return n()},10)}()})},duration:function(e){var t=this;return this.masterVideo().duration().then(function(n){return t._trimming.enabled&&!e&&(n=t._trimming.end-t._trimming.start),n})},paused:function(){return this.masterVideo().isPaused()},trimEnabled:function(){return this._trimming.enabled},trimStart:function(){return this._trimming.enabled?this._trimming.start:0},trimEnd:function(){return this._trimming.enabled?this._trimming.end:this.duration()},getQualities:function(){var e=this;return new Promise(function(t){e.masterVideo().getQualities().then(function(e){t(e)})})},setQuality:function(e){var t=this,n=[],a=[],i=this;return new Promise(function(r){t.masterVideo().getQualities().then(function(e){return n=e,t.slaveVideo()?t.slaveVideo().getQualities():paella_DeferredResolved()}).then(function(t){var o,s;a=t||[],o=e0?{x:850,y:140,w:360,h:550}:{x:0,y:0,w:1280,h:720};this._isMonostream=0==this._streamProvider.slaveVideos.length;var o=this._streamProvider.masterVideo,s=this._streamProvider.audioStreams;this._players=[],this._videoPlayers=[],this._audioPlayers=[];var l=this._streamProvider.mainSlaveVideo,u=paella.videoFactory.getVideoObject(this.video1Id,o,r);this._audioPlayer=u,this._players.push(u),this._videoPlayers.push(u);var c=l?paella.videoFactory.getVideoObject(this.videoSlaveId+1,l,{x:10,y:40,w:800,h:600}):null;c&&(c.setVolume(0),this._players.push(c),this._videoPlayers.push(c)),s.forEach(function(e,t){var a=paella.audioFactory.getAudioObject(n.audioId+t,e);a&&(n._audioPlayers.push(a),n._players.push(a),n.container.addNode(a))}),u.setVideoQualityStrategy(this._videoQualityStrategy),c&&c.setVideoQualityStrategy(this._videoQualityStrategy),t.apply(this,["masterVideoWrapper",u]),this._streamProvider.slaveVideos.length>0&&t.apply(this,["slaveVideoWrapper",c]);var d=this.autoplay();return u.setAutoplay(d),c&&c.setAutoplay(d),u.load().then(function(){return n._streamProvider.slaveVideos.length>0?c.load():paella_DeferredResolved(!0)}).then(function(){if(a._audioPlayers.length>0){var e=[];return a._audioPlayers.forEach(function(t){e.push(t.load())}),Promise.all(e)}return paella_DeferredResolved(!0)}).then(function(){$(u.video).bind("timeupdate",function(e){var t=a._trimming,n=e.currentTarget.currentTime,i=e.currentTarget.duration;t.enabled&&(n-=t.start,i=t.end-t.start),paella.events.trigger(paella.events.timeupdate,{videoContainer:a,currentTime:n,duration:i}),a.checkVideoBounds(t,e.currentTarget.currentTime,e.currentTarget.paused,i)}),a.overlayContainer.removeElement(i),a._isMasterReady=!0,a._isSlaveReady=!0;var e=paella.player.config,t=e.player.audio&&void 0!=e.player.audio.master?e.player.audio.master:1;return u.setVolume(t),a.setAudioLanguage(a._audioLanguage)}).then(function(){paella.events.trigger(paella.events.videoReady);var e=base.parameters.get("profile"),t=base.cookies.get("lastProfile");return e?a.setProfile(e,!1):t?a.setProfile(t,!1):a.setProfile(paella.Profiles.getDefaultProfile(),!1)})},setAutoplay:function(){var e=void 0===arguments[0]||arguments[0];return!!this.supportAutoplay()&&(this._autoplay=e,this.masterVideo()&&this.masterVideo().setAutoplay(e),this.slaveVideo()&&this.slaveVideo().setAutoplay(e),this._audioPlayers.length>0&&this._audioPlayers.forEach(function(t){t.setAutoplay(e)}),!0)},autoplay:function(){return this.supportAutoplay()&&("true"==base.parameters.get("autoplay")||this._streamProvider.isLiveStreaming)&&!base.userAgent.browser.IsMobileVersion},supportAutoplay:function(){var e=!1;return this.masterVideo()&&(e=this.masterVideo().supportAutoplay()),this.slaveVideo()&&e&&(e=e&&this.slaveVideo().supportAutoplay()),this._audioPlayers.length>0&&e&&this._audioPlayers.forEach(function(t){e=e&&t.supportAutoplay()}),e},numberOfStreams:function(){return this._sourceData.length},getMonostreamMasterProfile:function(){this.masterVideo();return{content:"presenter",visible:!0,layer:1,rect:[{aspectRatio:"1/1",left:280,top:0,width:720,height:720},{aspectRatio:"6/5",left:208,top:0,width:864,height:720},{aspectRatio:"5/4",left:190,top:0,width:900,height:720},{aspectRatio:"4/3",left:160,top:0,width:960,height:720},{aspectRatio:"11/8",left:145,top:0,width:990,height:720},{aspectRatio:"1.41/1",left:132,top:0,width:1015,height:720},{aspectRatio:"1.43/1",left:125,top:0,width:1029,height:720},{aspectRatio:"3/2",left:100,top:0,width:1080,height:720},{aspectRatio:"16/10",left:64,top:0,width:1152,height:720},{aspectRatio:"5/3",left:40,top:0,width:1200,height:720},{aspectRatio:"16/9",left:0,top:0,width:1280,height:720},{aspectRatio:"1.85/1",left:0,top:14,width:1280,height:692},{aspectRatio:"2.35/1",left:0,top:87,width:1280,height:544},{aspectRatio:"2.41/1",left:0,top:94,width:1280,height:531},{aspectRatio:"2.76/1",left:0,top:128,width:1280,height:463}]}},getMonostreamSlaveProfile:function(){return{content:"slides",visible:!1,layer:0,rect:[{aspectRatio:"16/9",left:0,top:0,width:0,height:0},{aspectRatio:"4/3",left:0,top:0,width:0,height:0}]}},getCurrentProfileName:function(){return this._currentProfile},setProfile:function(e,t){var n=this;return new Promise(function(a){t=!base.userAgent.browser.Explorer&&t,n.masterVideo()?paella.Profiles.loadProfile(e,function(i){n._currentProfile=e,0==n._streamProvider.slaveVideos.length&&(i.masterVideo=n.getMonostreamMasterProfile(),i.slaveVideo=n.getMonostreamSlaveProfile()),n.applyProfileWithJson(i,t),a(e)}):a()})},getProfile:function(e){return new Promise(function(t,n){paella.Profiles.loadProfile(e,function(e){t(e)})})},hideAllLogos:function(){for(var e=0;et&&(n=t,i=e)}),i},applyProfileWithJson:function(e,t){var n=function(n,a){void 0==t&&(t=!0);var i=this.videoWrappers[0],r=this.videoWrappers.length>1?this.videoWrappers[1]:null,o=(this.masterVideo(),this.slaveVideo(),this.container.getNode(this.backgroundId)),s=n.res,l=a&&a.res,u=this.getClosestRect(e.masterVideo,n.res),c=a&&this.getClosestRect(e.slaveVideo,a.res);if(this.hideAllLogos(),this.showLogos(e.logos),dynamic_cast("paella.ProfileFrameStrategy",this.profileFrameStrategy)){var d={width:$(this.domElement).width(),height:$(this.domElement).height()},p=u.width/d.width,h={width:s.w*p,height:s.h*p};if(u.left=Number(u.left),u.top=Number(u.top),u.width=Number(u.width),u.height=Number(u.height),u=this.profileFrameStrategy.adaptFrame(h,u),r){var m={width:l.w*p,height:l.h*p};c.left=Number(c.left),c.top=Number(c.top),c.width=Number(c.width),c.height=Number(c.height),c=this.profileFrameStrategy.adaptFrame(m,c)}}i.setRect(u,t),this.currentMasterVideoRect=u,i.setVisible(e.masterVideo.visible,t),this.currentMasterVideoRect.visible=!!/true/i.test(e.masterVideo.visible),this.currentMasterVideoRect.layer=parseInt(e.masterVideo.layer),r&&(r.setRect(c,t),this.currentSlaveVideoRect=c,this.currentSlaveVideoRect.visible=!!/true/i.test(e.slaveVideo.visible),this.currentSlaveVideoRect.layer=parseInt(e.slaveVideo.layer),r.setVisible(e.slaveVideo.visible,t),r.setLayer(e.slaveVideo.layer)),i.setLayer(e.masterVideo.layer),o.setImage(paella.utils.folders.profiles()+"/resources/"+e.background.content)},a=this;if(this.masterVideo())if(this.slaveVideo()){var i={};this.masterVideo().getVideoData().then(function(e){return i=e,a.slaveVideo().getVideoData()}).then(function(e){n.apply(a,[i,e])})}else this.masterVideo().getVideoData().then(function(e){n.apply(a,[e])})},resizePortrail:function(){var e=1==paella.player.isFullScreen()?$(window).width():$(this.domElement).width(),t=(new paella.RelativeVideoSize).proportionalHeight(e);this.container.domElement.style.width=e+"px",this.container.domElement.style.height=t+"px";var n=(1==paella.player.isFullScreen()?$(window).height():$(this.domElement).height())/2-t/2;this.container.domElement.style.top=n+"px"},resizeLandscape:function(){var e=1==paella.player.isFullScreen()?$(window).height():$(this.domElement).height(),t=(new paella.RelativeVideoSize).proportionalWidth(e);this.container.domElement.style.width=t+"px",this.container.domElement.style.height=e+"px",this.container.domElement.style.top="0px"},onresize:function(){$traceurRuntime.superGet(this,n.prototype,"onresize").call(this);var e=(new paella.RelativeVideoSize).aspectRatio();(1==paella.player.isFullScreen()?$(window).width():$(this.domElement).width())/(1==paella.player.isFullScreen()?$(window).height():$(this.domElement).height())>e?this.resizeLandscape():this.resizePortrail()}},{},e)}(paella.VideoContainerBase);paella.VideoContainer=n}(),function(){Class("paella.PluginManager",{targets:null,pluginList:[],eventDrivenPlugins:[],enabledPlugins:[],doResize:!0,setupPlugin:function(e){e.setup(),this.enabledPlugins.push(e),dynamic_cast("paella.UIPlugin",e)&&e.checkVisibility()},checkPluginsVisibility:function(){this.enabledPlugins.forEach(function(e){dynamic_cast("paella.UIPlugin",e)&&e.checkVisibility()})},initialize:function(){this.targets={};var e=this;paella.events.bind(paella.events.loadPlugins,function(t){e.loadPlugins("paella.DeferredLoadPlugin")}),new base.Timer(function(){paella.player&&paella.player.controls&&e.doResize&&paella.player.controls.onresize()},1e3).repeat=!0},setTarget:function(e,t){t.addPlugin&&(this.targets[e]=t)},getTarget:function(e){return"eventDriven"==e?this:this.targets[e]},registerPlugin:function(e){this.importLibraries(e),this.pluginList.push(e),this.pluginList.sort(function(e,t){return e.getIndex()-t.getIndex()})},importLibraries:function(e){e.getDependencies().forEach(function(e){var t=document.createElement("script");t.type="text/javascript",t.src="javascript/"+e+".js",document.head.appendChild(t)})},loadPlugins:function(e){if(void 0!=e){var t=this;this.foreach(function(n,a){n.isLoaded()||null!=dynamic_cast(e,n)&&a.enabled&&(base.log.debug("Load plugin ("+e+"): "+n.getName()),n.config=a,n.load(t))})}},foreach:function(e){var t=!1,n={};try{t=paella.player.config.plugins.enablePluginsByDefault}catch(e){}try{n=paella.player.config.plugins.list}catch(e){}this.pluginList.forEach(function(a){var i=a.getName(),r=n[i];r||(r={enabled:t}),e(a,r)})},addPlugin:function(e){var t=this;e.__added__||(e.__added__=!0,e.checkEnabled(function(n){if("eventDriven"==e.type&&n){paella.pluginManager.setupPlugin(e),t.eventDrivenPlugins.push(e);for(var a=e.getEvents(),i=function(t,n){e.onEvent(t.type,n)},r=0;r",this._i&&this.container.appendChild(this._i)},hideButton:function(){this.hideUI()},showButton:function(){this.showUI()},changeSubclass:function(e){this.subclass=e,this.container.className=this.getClassName()},changeIconClass:function(e){this._i.className="button-icon "+e},getClassName:function(){return paella.ButtonPlugin.kClassName+" "+this.getAlignment()+" "+this.subclass},getContainerClassName:function(){return this.getButtonType()==paella.ButtonPlugin.type.timeLineButton?paella.ButtonPlugin.kTimeLineClassName+" "+this.getSubclass():this.getButtonType()==paella.ButtonPlugin.type.popUpButton?paella.ButtonPlugin.kPopUpClassName+" "+this.getSubclass():void 0},setToolTip:function(e){this.button.setAttribute("title",e),this.button.setAttribute("aria-label",e)},getDefaultToolTip:function(){return""},isPopUpOpen:function(){return this.button.popUpIdentifier==this.containerManager.currentContainerId}}),paella.ButtonPlugin.alignment={left:"left",right:"right"},paella.ButtonPlugin.kClassName="buttonPlugin",paella.ButtonPlugin.kPopUpClassName="buttonPluginPopUp",paella.ButtonPlugin.kTimeLineClassName="buttonTimeLine",paella.ButtonPlugin.type={actionButton:1,popUpButton:2,timeLineButton:3},paella.ButtonPlugin.buildPluginButton=function(e,t){e.subclass=e.getSubclass();var n=document.createElement("div");n.className=e.getClassName(),n.id=t,n.innerHTML=''+e.getText()+"",n.setAttribute("tabindex",1e3+e.getIndex()),n.setAttribute("alt",""),n.setAttribute("role","button"),n.plugin=e,e.button=n,e.container=n,e.ui=n,e.setToolTip(e.getDefaultToolTip());var a=document.createElement("i");function i(e){paella.userTracking.log("paella:button:action",e.plugin.getName()),e.plugin.action(e)}return a.className="button-icon "+e.getIconClass(),n.appendChild(a),e._i=a,$(n).click(function(e){i(this)}),$(n).keyup(function(e){13==e.keyCode&&i(this)}),n},paella.ButtonPlugin.buildPluginPopUp=function(e,t,n){t.subclass=t.getSubclass();var a=document.createElement("div");return e.appendChild(a),a.className=t.getContainerClassName(),a.id=n,a.plugin=t,t.buildContent(a),a},Class("paella.VideoOverlayButtonPlugin",paella.ButtonPlugin,{type:"videoOverlayButton",getSubclass:function(){return"myVideoOverlayButtonPlugin "+this.getAlignment()},action:function(e){},getName:function(){return"VideoOverlayButtonPlugin"}}),Class("paella.EventDrivenPlugin",paella.EarlyLoadPlugin,{type:"eventDriven",initialize:function(){this.parent();for(var e=this.getEvents(),t=0;t=e)return n}},getCaptionById:function(e){if(void 0!=this._captions)for(var t=0;tr.end)||i.push({time:t.begin,content:t.content,score:e.score})}),t&&t(!1,i)})}}}),Class("paella.CaptionParserPlugIn",paella.FastLoadPlugin,{type:"captionParser",getIndex:function(){return-1},ext:[],parse:function(e,t,n){throw new Error("paella.CaptionParserPlugIn#parse must be overridden by subclass")}})}(),function(){var e=new(Class({_plugins:[],addPlugin:function(e){this._plugins.push(e)},initialize:function(){paella.pluginManager.setTarget("SearchServicePlugIn",this)}})),t=Class(base.AsyncLoaderCallback,{initialize:function(e,t){this.name="searchCallback",this.plugin=e,this.text=t},load:function(e,t){var n=this;this.plugin.search(this.text,function(a,i){a?t():(n.result=i,e())})}});paella.searchService={search:function(n,a){var i=new base.AsyncLoader;paella.userTracking.log("paella:searchService:search",n),e._plugins.forEach(function(e){i.addCallback(new t(e,n))}),i.load(function(){var e=[];Object.keys(i.callbackArray).forEach(function(t){e=e.concat(i.getCallback(t).result)}),a&&a(!1,e)},function(){a&&a(!0)})}},Class("paella.SearchServicePlugIn",paella.FastLoadPlugin,{type:"SearchServicePlugIn",getIndex:function(){return-1},search:function(e,t){throw new Error("paella.SearchServicePlugIn#search must be overridden by subclass")}})}(),function(){var e=new(Class({_plugins:[],addPlugin:function(e){var t=this;e.checkEnabled(function(n){n&&(e.setup(),t._plugins.push(e))})},initialize:function(){paella.pluginManager.setTarget("userTrackingSaverPlugIn",this)}}));paella.userTracking={},Class("paella.userTracking.SaverPlugIn",paella.FastLoadPlugin,{type:"userTrackingSaverPlugIn",getIndex:function(){return-1},checkEnabled:function(e){e(!0)},log:function(e,t){throw new Error("paella.userTracking.SaverPlugIn#log must be overridden by subclass")}});var t={};paella.userTracking.log=function(n,a){void 0!=t[n]&&t[n].cancel(),t[n]=new base.Timer(function(i){e._plugins.forEach(function(e){e.log(n,a)}),delete t[n]},500)},[paella.events.play,paella.events.pause,paella.events.endVideo,paella.events.showEditor,paella.events.hideEditor,paella.events.enterFullscreen,paella.events.exitFullscreen,paella.events.loadComplete].forEach(function(e){paella.events.bind(e,function(t,n){paella.userTracking.log(e)})}),[paella.events.showPopUp,paella.events.hidePopUp].forEach(function(e){paella.events.bind(e,function(t,n){paella.userTracking.log(e,n.identifier)})}),[paella.events.captionsEnabled,paella.events.captionsDisabled].forEach(function(e){paella.events.bind(e,function(t,n){var a;if(void 0!=n){var i=paella.captions.getCaptions(n);a={id:n,lang:i._lang,url:i._url}}paella.userTracking.log(e,a)})}),[paella.events.setProfile].forEach(function(e){paella.events.bind(e,function(t,n){paella.userTracking.log(e,n.profileName)})}),[paella.events.seekTo,paella.events.seekToTime].forEach(function(e){paella.events.bind(e,function(t,n){var a;try{JSON.stringify(n),a=n}catch(e){}paella.userTracking.log(e,a)})}),[paella.events.setVolume,paella.events.resize,paella.events.setPlaybackRate,paella.events.qualityChanged].forEach(function(e){paella.events.bind(e,function(t,n){var a;try{JSON.stringify(n),a=n}catch(e){}paella.userTracking.log(e,a)})})}(),Class("paella.TimeControl",paella.DomNode,{initialize:function(e){this.parent("div",e,{left:"0%"}),this.domElement.className="timeControlOld",this.domElement.className="timeControl";var t=this;paella.events.bind(paella.events.timeupdate,function(e,n){t.onTimeUpdate(n)})},onTimeUpdate:function(e){e.videoContainer,e.currentTime,e.duration;this.domElement.innerHTML=this.secondsToHours(parseInt(e.currentTime))},secondsToHours:function(e){var t=Math.floor(e/3600),n=Math.floor((e-3600*t)/60),a=e-3600*t-60*n;return t<10&&(t="0"+t),n<10&&(n="0"+n),a<10&&(a="0"+a),t+":"+n+":"+a}}),Class("paella.PlaybackBar",paella.DomNode,{playbackFullId:"",updatePlayBar:!0,timeControlId:"",_images:null,_keys:null,_prev:null,_next:null,_videoLength:null,_lastSrc:null,_aspectRatio:1.777777778,_hasSlides:null,_imgNode:null,_canvas:null,initialize:function(e){this.parent("div",e,{}),this.domElement.className="playbackBar",this.domElement.setAttribute("alt",""),this.domElement.setAttribute("aria-label","Timeline Slider"),this.domElement.setAttribute("role","slider"),this.domElement.setAttribute("aria-valuemin","0"),this.domElement.setAttribute("aria-valuemax","100"),this.domElement.setAttribute("aria-valuenow","0"),this.domElement.setAttribute("tabindex","1100"),$(this.domElement).keyup(function(e){var t=0,n=0;paella.player.videoContainer.currentTime().then(function(e){return t=e,paella.player.videoContainer.duration()}).then(function(a){var i;switch(n=a,e.keyCode){case 37:i=100*t/n-5,paella.player.videoContainer.seekTo(i);break;case 39:i=100*t/n+5,paella.player.videoContainer.seekTo(i)}})}),this.playbackFullId=e+"_full",this.timeControlId=e+"_timeControl";var t=new paella.DomNode("div",this.playbackFullId,{width:"0%"});t.domElement.className="playbackBarFull",this.addNode(t),this.addNode(new paella.TimeControl(this.timeControlId));var n=this;paella.events.bind(paella.events.timeupdate,function(e,t){n.onTimeUpdate(t)}),$(this.domElement).bind("mousedown",function(e){paella.utils.mouseManager.down(n,e),e.stopPropagation()}),$(t.domElement).bind("mousedown",function(e){paella.utils.mouseManager.down(n,e),e.stopPropagation()}),base.userAgent.browser.IsMobileVersion||($(this.domElement).bind("mousemove",function(e){n.movePassive(e),paella.utils.mouseManager.move(e)}),$(t.domElement).bind("mousemove",function(e){paella.utils.mouseManager.move(e)}),$(this.domElement).bind("mouseout",function(e){n.mouseOut(e)})),$(this.domElement).bind("mouseup",function(e){paella.utils.mouseManager.up(e)}),$(t.domElement).bind("mouseup",function(e){paella.utils.mouseManager.up(e)}),paella.player.isLiveStream()&&$(this.domElement).hide()},mouseOut:function(e){this._hasSlides?$("#divTimeImageOverlay").remove():$("#divTimeOverlay").remove()},drawTimeMarks:function(){var e=this,t={};paella.player.videoContainer.trimming().then(function(n){return t=n,e.imageSetup()}).then(function(){var n=e,a=(t.enabled?(t.end,t.start):e._videoLength,$("#playerContainer_controls_playback_playbackBar"));e.clearCanvas(),e._keys&&paella.player.config.player.slidesMarks.enabled&&e._keys.forEach(function(e){var i=parseInt(e)-t.start;if(i>0){var r=i*a.width()/n._videoLength;n.drawTimeMark(r)}})})},drawTimeMark:function(e){var t=this.getCanvasContext();t.fillStyle=paella.player.config.player.slidesMarks.color,t.fillRect(e,0,1,12)},clearCanvas:function(){this._canvas&&this.getCanvasContext().clearRect(0,0,this._canvas.width,this._canvas.height)},getCanvas:function(){if(!this._canvas){var e=$("#playerContainer_controls_playback_playbackBar"),t=document.createElement("canvas");t.className="playerContainer_controls_playback_playbackBar_canvas",t.id="playerContainer_controls_playback_playbackBar_canvas",t.width=e.width();t.height=e.height();e.prepend(t),this._canvas=document.getElementById("playerContainer_controls_playback_playbackBar_canvas")}return this._canvas},getCanvasContext:function(){return this.getCanvas().getContext("2d")},movePassive:function(e){var t=this;paella.player.videoContainer.duration();var n=0;paella.player.videoContainer.duration().then(function(e){return n=e,paella.player.videoContainer.trimming()}).then(function(a){!function(n,a){var i=$(t.domElement),r=i.offset(),o=i.width(),s=e.clientX-r.left,l=100*(s=s<0?0:s)/o*n/100;a.enabled&&(l+=a.start);var u=Math.floor((l-a.start)/3600)%24;u=("00"+u).slice(u.toString().length);var c=Math.floor((l-a.start)/60)%60;c=("00"+c).slice(c.toString().length);var d=Math.floor((l-a.start)%60),p=u+":"+c+":"+(d=("00"+d).slice(d.toString().length));if(t._hasSlides?(0==$("#divTimeImageOverlay").length?t.setupTimeImageOverlay(p,r.top,o):$("#divTimeOverlay")[0].innerHTML=p,t.imageUpdate(l)):0==$("#divTimeOverlay").length?t.setupTimeOnly(p,r.top,o):$("#divTimeOverlay")[0].innerHTML=p,t._hasSlides){var h=$("#divTimeImageOverlay").width(),m=e.clientX-h/2;e.clientX>h/2+r.left&&e.clientXf/2+r.left&&e.clientXthis._next||e0?n:0],i=t[n+2],r=t[n];return i=void 0==i?t.length-1:parseInt(i),this._next=i,r=void 0==r?0:parseInt(r),this._prev=r,a=parseInt(a),!!this._images[a]&&(this._images[a].url||this._images[a].url)},setupTimeImageOverlay:function(e,t,n){var a=document.createElement("div");a.className="divTimeImageOverlay",a.id="divTimeImageOverlay";var i=Math.round(n/10);if(a.style.width=Math.round(i*this._aspectRatio)+"px",this._hasSlides){var r=document.createElement("img");r.className="imgOverlay",r.id="imgOverlay",this._imgNode=r,a.appendChild(r)}var o=document.createElement("div");o.className="divTimeOverlay",o.style.top=t-20+"px",o.id="divTimeOverlay",o.innerHTML=e,a.appendChild(o),$(this.domElement).parent().append(a)},setupTimeOnly:function(e,t,n){var a=document.createElement("div");a.className="divTimeOverlay",a.style.top=t-20+"px",a.id="divTimeOverlay",a.innerHTML=e,$(this.domElement).parent().append(a)},playbackFull:function(){return this.getNode(this.playbackFullId)},timeControl:function(){return this.getNode(this.timeControlId)},setPlaybackPosition:function(e){this.playbackFull().domElement.style.width=e+"%"},isSeeking:function(){return!this.updatePlayBar},onTimeUpdate:function(e){if(this.updatePlayBar){var t=e.currentTime,n=e.duration;this.setPlaybackPosition(100*t/n)}},down:function(e,t,n){this.updatePlayBar=!1,this.move(e,t,n)},move:function(e,t,n){var a=$(this.domElement).width(),i=t-$(this.domElement).offset().left;i=i<0?0:i>a?100:100*i/a,this.setPlaybackPosition(i)},up:function(e,t,n){var a=$(this.domElement).width(),i=t-$(this.domElement).offset().left;i=i<0?0:i>a?100:100*i/a,paella.player.videoContainer.seekTo(i),this.updatePlayBar=!0},onresize:function(){this.drawTimeMarks()}}),Class("paella.PlaybackControl",paella.DomNode,{playbackBarId:"",pluginsContainer:null,_popUpPluginContainer:null,_timeLinePluginContainer:null,playbackPluginsWidth:0,popupPluginsWidth:0,minPlaybackBarSize:120,playbackBarInstance:null,buttonPlugins:[],addPlugin:function(e){var t=this,n="buttonPlugin"+this.buttonPlugins.length;this.buttonPlugins.push(e);var a=paella.ButtonPlugin.buildPluginButton(e,n);e.button=a,this.pluginsContainer.domElement.appendChild(a),$(a).hide(),e.checkEnabled(function(n){var i;if(n){$(e.button).show(),paella.pluginManager.setupPlugin(e);var r="buttonPlugin"+t.buttonPlugins.length;if(e.getButtonType()==paella.ButtonPlugin.type.popUpButton){i=t.popUpPluginContainer.domElement;var o=paella.ButtonPlugin.buildPluginPopUp(i,e,r+"_container");t.popUpPluginContainer.registerContainer(e.getName(),o,a,e)}else if(e.getButtonType()==paella.ButtonPlugin.type.timeLineButton){i=t.timeLinePluginContainer.domElement;var s=paella.ButtonPlugin.buildPluginPopUp(i,e,r+"_timeline");t.timeLinePluginContainer.registerContainer(e.getName(),s,a,e)}}else t.pluginsContainer.domElement.removeChild(e.button)})},initialize:function(e){this.parent("div",e,{}),this.domElement.className="playbackControls",this.playbackBarId=e+"_playbackBar";this.pluginsContainer=new paella.DomNode("div",e+"_playbackBarPlugins"),this.pluginsContainer.domElement.className="playbackBarPlugins",this.pluginsContainer.domElement.setAttribute("role","toolbar"),this.addNode(this.pluginsContainer),this.addNode(new paella.PlaybackBar(this.playbackBarId)),paella.pluginManager.setTarget("button",this),Object.defineProperty(this,"popUpPluginContainer",{get:function(){return this._popUpPluginContainer||(this._popUpPluginContainer=new paella.PopUpContainer(e+"_popUpPluginContainer","popUpPluginContainer"),this.addNode(this._popUpPluginContainer)),this._popUpPluginContainer}}),Object.defineProperty(this,"timeLinePluginContainer",{get:function(){return this._timeLinePluginContainer||(this._timeLinePluginContainer=new paella.TimelineContainer(e+"_timelinePluginContainer","timelinePluginContainer"),this.addNode(this._timeLinePluginContainer)),this._timeLinePluginContainer}})},showPopUp:function(e,t){this.popUpPluginContainer.showContainer(e,t),this.timeLinePluginContainer.showContainer(e,t)},hidePopUp:function(e,t){this.popUpPluginContainer.hideContainer(e,t),this.timeLinePluginContainer.hideContainer(e,t)},playbackBar:function(){return null==this.playbackBarInstance&&(this.playbackBarInstance=this.getNode(this.playbackBarId)),this.playbackBarInstance},onresize:function(){var e=$(this.domElement).width();base.log.debug("resize playback bar (width="+e+")");for(var t=0;t0&&e1?1:e,paella.player.videoContainer.setVolume({master:e,slave:0})})},volumeDown:function(){paella.player.videoContainer.volume().then(function(e){e=(e-=.1)<0?0:e,paella.player.videoContainer.setVolume({master:e,slave:0})})}}),paella.keyManager=new paella.KeyManager,Class("paella.VideoLoader",{metadata:{title:"",duration:0},streams:[],frameList:[],loadStatus:!1,codecStatus:!1,getMetadata:function(){return this.metadata},getVideoId:function(){return paella.initDelegate.getId()},getVideoUrl:function(){return""},getDataUrl:function(){},loadVideo:function(e){e()}}),Class("paella.AccessControl",{canRead:function(){return paella_DeferredResolved(!0)},canWrite:function(){return paella_DeferredResolved(!1)},userData:function(){return paella_DeferredResolved({username:"anonymous",name:"Anonymous",avatar:paella.utils.folders.resources()+"/images/default_avatar.png",isAnonymous:!0})},getAuthenticationUrl:function(e){var t=this._authParams.authCallbackName&&window[this._authParams.authCallbackName];return!t&&paella.player.config.auth&&(t=paella.player.config.auth.authCallbackName&&window[paella.player.config.auth.authCallbackName]),"function"==typeof t?t(e):""}}),Class("paella.PlayerBase",{config:null,playerId:"",mainContainer:null,videoContainer:null,controls:null,accessControl:null,checkCompatibility:function(){var e="";if(base.parameters.get("ignoreBrowserCheck"))return!0;if(base.userAgent.browser.IsMobileVersion)return!0;if(base.userAgent.browser.Chrome||base.userAgent.browser.Safari||base.userAgent.browser.Firefox||base.userAgent.browser.Opera||base.userAgent.browser.Edge||base.userAgent.browser.Explorer&&base.userAgent.browser.Version.major>=9)return!0;var t=base.dictionary.translate("It seems that your browser is not HTML 5 compatible");return paella.events.trigger(paella.events.error,{error:t}),e=t+'',e+='",paella.messageBox.showError(e,{height:"40%"}),!1},initialize:function(e){if(Object.defineProperty(this,"repoUrl",{get:function(){return paella.player.videoLoader._url||""}}),Object.defineProperty(this,"videoUrl",{get:function(){return paella.player.videoLoader.getVideoUrl()}}),Object.defineProperty(this,"dataUrl",{get:function(){return paella.player.videoLoader.getDataUrl()}}),Object.defineProperty(this,"videoId",{get:function(){return paella.initDelegate.getId()}}),void 0!=base.parameters.get("log")){var t=0;switch(base.parameters.get("log")){case"error":t=base.Log.kLevelError;break;case"warn":t=base.Log.kLevelWarning;break;case"debug":t=base.Log.kLevelDebug;break;case"log":case"true":t=base.Log.kLevelLog}base.log.setLevel(t)}if(this.checkCompatibility()){paella.player=this,this.playerId=e,this.mainContainer=$("#"+this.playerId)[0];var n=this;paella.events.bind(paella.events.loadComplete,function(e,t){n.loadComplete(e,t)})}else base.log.debug("It seems that your browser is not HTML 5 compatible")},loadComplete:function(e,t){},auth:{login:function(e){e=e||window.location.href;var t=paella.initDelegate.initParams.accessControl.getAuthenticationUrl(e);t&&(window.location.href=t)},canRead:function(){return paella.initDelegate.initParams.accessControl.canRead()},canWrite:function(){return paella.initDelegate.initParams.accessControl.canWrite()},userData:function(){return paella.initDelegate.initParams.accessControl.userData()}}}),Class("paella.InitDelegate",{initParams:{configUrl:paella.baseUrl+"config/config.json",dictionaryUrl:paella.baseUrl+"localization/paella",accessControl:null,videoLoader:null},initialize:function(e){if(2==arguments.length&&(this._config=arguments[0]),e)for(var t in e)this.initParams[t]=e[t]},getId:function(){return base.parameters.get("id")||"noid"},loadDictionary:function(){var e=this;return new Promise(function(t){base.ajax.get({url:e.initParams.dictionaryUrl+"_"+base.dictionary.currentLanguage()+".json"},function(e,n,a){base.dictionary.addDictionary(e),t(e)},function(e,n,a){t()})})},loadConfig:function(){var e=this,t=function(t){var n=Class.fromString(t.player.accessControlClass||"paella.AccessControl");e.initParams.accessControl=new n};return this.initParams.config?new Promise(function(n){t(e.initParams.config),n(e.initParams.config)}):this.initParams.loadConfig?new Promise(function(n,a){e.initParams.loadConfig(e.initParams.configUrl).then(function(e){t(e),n(e)}).catch(function(e){a(e)})}):new Promise(function(n,a){var i=e.initParams.configUrl,r={};r.url=i,base.ajax.get(r,function(e,a,i){try{e=JSON.parse(e)}catch(e){}t(e),n(e)},function(e,t,n){paella.messageBox.showError(base.dictionary.translate("Error! Config file not found. Please configure paella!"))})})}});var paellaPlayer=null;paella.plugins={},paella.plugins.events={},paella.initDelegate=null,Class("paella.PaellaPlayer",paella.PlayerBase,{player:null,videoIdentifier:"",loader:null,videoData:null,getPlayerMode:function(){return paella.player.isFullScreen()?paella.PaellaPlayer.mode.fullscreen:window.self!==window.top?paella.PaellaPlayer.mode.embed:paella.PaellaPlayer.mode.standard},checkFullScreenCapability:function(){var e=document.getElementById(paella.player.mainContainer.id);return!!(e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.requestFullScreen)||!(!base.userAgent.browser.IsMobileVersion||!paella.player.videoContainer.isMonostream)},addFullScreenListeners:function(){var e=this,t=function(){setTimeout(function(){paella.pluginManager.checkPluginsVisibility()},1e3);var t=document.getElementById(paella.player.mainContainer.id);paella.player.isFullScreen()?(t.style.width="100%",t.style.height="100%"):(t.style.width="",t.style.height=""),e.isFullScreen()?paella.events.trigger(paella.events.enterFullscreen):paella.events.trigger(paella.events.exitFullscreen)};this.eventFullScreenListenerAdded||(this.eventFullScreenListenerAdded=!0,document.addEventListener("fullscreenchange",t,!1),document.addEventListener("webkitfullscreenchange",t,!1),document.addEventListener("mozfullscreenchange",t,!1),document.addEventListener("MSFullscreenChange",t,!1),document.addEventListener("webkitendfullscreen",t,!1))},isFullScreen:function(){var e=!0===document.webkitIsFullScreen,t=void 0!==document.msFullscreenElement&&null!==document.msFullscreenElement,n=!0===document.mozFullScreen,a=void 0!==document.fullScreenElement&&null!==document.fullScreenElement;return e||t||n||a},goFullScreen:function(){if(!this.isFullScreen())if(base.userAgent.system.iOS)paella.player.videoContainer.masterVideo().goFullScreen();else{var e=document.getElementById(paella.player.mainContainer.id);e.webkitRequestFullScreen?e.webkitRequestFullScreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.requestFullScreen&&e.requestFullScreen()}},exitFullScreen:function(){this.isFullScreen()&&(document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen()?document.msExitFullscreen():document.cancelFullScreen&&document.cancelFullScreen())},setProfile:function(e,t){this.videoContainer.setProfile(e,t).then(function(e){return paella.player.getProfile(e)}).then(function(t){paella.player.videoContainer.isMonostream||base.cookies.set("lastProfile",e),paella.events.trigger(paella.events.setProfile,{profileName:e})})},getProfile:function(e){return this.videoContainer.getProfile(e)},initialize:function(e){if(this.parent(e),this.playerId==e){this.loadPaellaPlayer()}Object.defineProperty(this,"selectedProfile",{get:function(){return this.videoContainer.getCurrentProfileName()}})},loadPaellaPlayer:function(){var e=this;this.loader=new paella.LoaderContainer("paellaPlayer_loader"),$("body")[0].appendChild(this.loader.domElement),paella.events.trigger(paella.events.loadStarted),paella.initDelegate.loadDictionary().then(function(){return paella.initDelegate.loadConfig()}).then(function(t){if(e.accessControl=paella.initDelegate.initParams.accessControl,e.videoLoader=paella.initDelegate.initParams.videoLoader,e.onLoadConfig(t),t.skin){var n=t.skin.default||"dark";paella.utils.skin.restore(n)}})},onLoadConfig:function(e){if(paella.data=new paella.Data(e),paella.pluginManager.registerPlugins(),this.config=e,this.videoIdentifier=paella.initDelegate.getId(),this.videoIdentifier){if(this.mainContainer){this.videoContainer=new paella.VideoContainer(this.playerId+"_videoContainer");var t=new paella.BestFitVideoQualityStrategy;try{var n=this.config.player.videoQualityStrategy;t=new(Class.fromString(n))}catch(e){base.log.warning("Error selecting video quality strategy: strategy not found")}this.videoContainer.setVideoQualityStrategy(t),this.mainContainer.appendChild(this.videoContainer.domElement)}$(window).resize(function(e){paella.player.onresize()}),this.onload()}paella.pluginManager.loadPlugins("paella.FastLoadPlugin")},onload:function(){var e=this,t=(this.accessControl,!1),n={};this.accessControl.canRead().then(function(n){return t=n,e.accessControl.userData()}).then(function(a){if(n=a,t)e.loadVideo(),e.videoContainer.publishVideo();else if(n.isAnonymous){var i=paella.initDelegate.initParams.accessControl.getAuthenticationUrl("player/?id="+paella.player.videoIdentifier),r="
"+base.dictionary.translate("You are not authorized to view this resource")+"
";i&&(r+='"),e.unloadAll(r)}else{var o=base.dictionary.translate("You are not authorized to view this resource");e.unloadAll(o),paella.events.trigger(paella.events.error,{error:o})}}).catch(function(t){var n=base.dictionary.translate(t);e.unloadAll(n),paella.events.trigger(paella.events.error,{error:n})})},onresize:function(){this.videoContainer.onresize(),this.controls&&this.controls.onresize();var e=paella.utils.cookies.get("lastProfile");e?this.setProfile(e,!1):this.setProfile(paella.Profiles.getDefaultProfile(),!1),paella.events.trigger(paella.events.resize,{width:$(this.videoContainer.domElement).width(),height:$(this.videoContainer.domElement).height()})},unloadAll:function(e){$("#paellaPlayer_loader")[0];this.mainContainer.innerHTML="",paella.messageBox.showError(e)},reloadVideos:function(e,t){this.videoContainer&&(this.videoContainer.reloadVideos(e,t),this.onresize())},loadVideo:function(){if(this.videoIdentifier){var e=this,t=paella.player.videoLoader;this.onresize(),t.loadVideo(function(){e.videoContainer.setStreamData(t.streams).then(function(){paella.events.trigger(paella.events.loadComplete),e.addFullScreenListeners(),e.onresize(),e.videoContainer.autoplay()&&e.play()}).catch(function(e){console.log(e)})})}},showPlaybackBar:function(){this.controls||(this.controls=new paella.ControlsContainer(this.playerId+"_controls"),this.mainContainer.appendChild(this.controls.domElement),this.controls.onresize(),paella.events.trigger(paella.events.loadPlugins,{pluginManager:paella.pluginManager}))},isLiveStream:function(){if(void 0===this._isLiveStream){var e=paella.initDelegate.initParams.videoLoader,t=function(e,t){if(e.length>t){var n=e[t];for(var a in n.sources)if("object"==$traceurRuntime.typeof(n.sources[a]))for(var i=0;i=2&&(t=e[1].preview),n){var a=paella.player.videoContainer.overlayContainer.getMasterRect();this.masterPreviewElem=document.createElement("img"),this.masterPreviewElem.src=n,paella.player.videoContainer.overlayContainer.addElement(this.masterPreviewElem,a)}if(t){var i=paella.player.videoContainer.overlayContainer.getSlaveRect();this.slavePreviewElem=document.createElement("img"),this.slavePreviewElem.src=t,paella.player.videoContainer.overlayContainer.addElement(this.slavePreviewElem,i)}paella.events.bind(paella.events.timeUpdate,function(e){paella.player.unloadPreviews()})},unloadPreviews:function(){this.masterPreviewElem&&(paella.player.videoContainer.overlayContainer.removeElement(this.masterPreviewElem),this.masterPreviewElem=null),this.slavePreviewElem&&(paella.player.videoContainer.overlayContainer.removeElement(this.slavePreviewElem),this.slavePreviewElem=null)},loadComplete:function(e,t){paella.pluginManager.loadPlugins("paella.EarlyLoadPlugin"),paella.player.videoContainer._autoplay&&this.play()},play:function(){if(!this.controls){this.showPlaybackBar();var e=base.parameters.get("time"),t=base.hashParams.get("time"),n=t||(e||"0s"),a=paella.utils.timeParse.timeToSeconds(n);a&&paella.player.videoContainer.setStartTime(a),paella.events.trigger(paella.events.controlBarLoaded),this.controls.onresize()}return this.videoContainer.play()},pause:function(){return this.videoContainer.pause()},playing:function(){var e=this;return new Promise(function(t){e.paused().then(function(e){t(!e)})})},paused:function(){return this.videoContainer.paused()}});var PaellaPlayer=paella.PaellaPlayer;function initPaellaEngage(e,t){t||(t=new paella.InitDelegate),paella.initDelegate=t;navigator.language||window.navigator.userLanguage;paellaPlayer=new PaellaPlayer(e,paella.initDelegate)}function DeprecatedClass(e,t,n){Class(e,n,{initialize:function(){base.log.warning(e+" is deprecated, use "+t+" instead."),this.parent.apply(this,arguments)}})}function DeprecatedFunc(e,t,n){return function(){base.log.warning(e+" is deprecated, use "+t+" instead."),n.apply(this,arguments)}}function buildChromaVideoCanvas(e,t){var n=new(function(e){return $traceurRuntime.createClass(function e(t){$traceurRuntime.superConstructor(e).call(this),this.stream=t,this._chroma=bg.Color.White(),this._crop=new bg.Vector4(.3,.01,.3,.01),this._transform=bg.Matrix4.Identity().translate(.6,-.04,0),this._bias=.01},{get chroma(){return this._chroma},get bias(){return this._bias},get crop(){return this._crop},get transform(){return this._transform},set chroma(e){this._chroma=e},set bias(e){this._bias=e},set crop(e){this._crop=e},set transform(e){this._transform=e},get video(){return this.texture?this.texture.video:null},loaded:function(){var e=this;return new Promise(function(t){var n=function(){e.video?t(e):setTimeout(n,100)};n()})},buildShape:function(){this.plist=new bg.base.PolyList(this.gl),this.plist.vertex=[-1,-1,0,1,-1,0,1,1,0,-1,1,0],this.plist.texCoord0=[0,0,1,0,1,1,0,1],this.plist.index=[0,1,2,2,3,0],this.plist.build()},buildShader:function(){this.shader=new bg.base.Shader(this.gl),this.shader.addShaderSource(bg.base.ShaderType.VERTEX,"\n\t\t\t\t\tattribute vec4 position;\n\t\t\t\t\tattribute vec2 texCoord;\n\t\t\t\t\tuniform mat4 inTransform;\n\t\t\t\t\tvarying vec2 vTexCoord;\n\t\t\t\t\tvoid main() {\n\t\t\t\t\t\tgl_Position = inTransform * position;\n\t\t\t\t\t\tvTexCoord = texCoord;\n\t\t\t\t\t}\n\t\t\t\t"),this.shader.addShaderSource(bg.base.ShaderType.FRAGMENT,"\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t\tvarying vec2 vTexCoord;\n\t\t\t\t\tuniform sampler2D inTexture;\n\t\t\t\t\tuniform vec4 inChroma;\n\t\t\t\t\tuniform float inBias;\n\t\t\t\t\tuniform vec4 inCrop;\n\t\t\t\t\tvoid main() {\n\t\t\t\t\t\tvec4 result = texture2D(inTexture,vTexCoord);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((result.r>=inChroma.r-inBias && result.r<=inChroma.r+inBias &&\n\t\t\t\t\t\t\tresult.g>=inChroma.g-inBias && result.g<=inChroma.g+inBias &&\n\t\t\t\t\t\t\tresult.b>=inChroma.b-inBias && result.b<=inChroma.b+inBias) ||\n\t\t\t\t\t\t\t(vTexCoord.xinCrop.z || vTexCoord.yinCrop.y)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdiscard;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tgl_FragColor = result;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t"),status=this.shader.link(),this.shader.status||(console.log(this.shader.compileError),console.log(this.shader.linkError)),this.shader.initVars(["position","texCoord"],["inTransform","inTexture","inChroma","inBias","inCrop"])},init:function(){var e=this;bg.Engine.Set(new bg.webgl1.Engine(this.gl)),bg.base.Loader.RegisterPlugin(new bg.base.VideoTextureLoaderPlugin),this.buildShape(),this.buildShader(),this.pipeline=new bg.base.Pipeline(this.gl),bg.base.Pipeline.SetCurrent(this.pipeline),this.pipeline.clearColor=bg.Color.Transparent(),bg.base.Loader.Load(this.gl,this.stream.src).then(function(t){e.texture=t})},frame:function(e){this.texture&&this.texture.update()},display:function(){this.pipeline.clearBuffers(bg.base.ClearBuffers.COLOR|bg.base.ClearBuffers.DEPTH),this.texture&&(this.shader.setActive(),this.shader.setInputBuffer("position",this.plist.vertexBuffer,3),this.shader.setInputBuffer("texCoord",this.plist.texCoord0Buffer,2),this.shader.setMatrix4("inTransform",this.transform),this.shader.setTexture("inTexture",this.texture||bg.base.TextureCache.WhiteTexture(this.gl),bg.base.TextureUnit.TEXTURE_0),this.shader.setVector4("inChroma",this.chroma),this.shader.setValueFloat("inBias",this.bias),this.shader.setVector4("inCrop",new bg.Vector4(this.crop.x,1-this.crop.y,1-this.crop.z,this.crop.w)),this.plist.draw(),this.shader.disableInputBuffer("position"),this.shader.disableInputBuffer("texCoord"),this.shader.clearActive())},reshape:function(e,t){var n=this.canvas.domElement;n.width=e,n.height=t,this.pipeline.viewport=new bg.Viewport(0,0,e,t)},mouseMove:function(e){this.postRedisplay()}},{},e)}(bg.app.WindowController))(e),a=bg.app.MainLoop.singleton;return a.updateMode=bg.app.FrameUpdate.AUTO,a.canvas=t,a.run(n),n.loaded()}paella.PaellaPlayer.mode={standard:"standard",fullscreen:"fullscreen",embed:"embed"},Class("paella.DefaultVideoLoader",paella.VideoLoader,{_url:null,initialize:function(e){if("object"==$traceurRuntime.typeof(e))this._data=e;else try{this._data=JSON.parse(e)}catch(t){this._url=e}},getVideoUrl:function(){return paella.initDelegate.initParams.videoUrl?"function"==typeof paella.initDelegate.initParams.videoUrl?paella.initDelegate.initParams.videoUrl():paella.initDelegate.initParams.videoUrl:(/\/$/.test(this._url)?this._url:this._url+"/")+paella.initDelegate.getId()+"/"},getDataUrl:function(){return paella.initDelegate.initParams.dataUrl?"function"==typeof paella.initDelegate.initParams.dataUrl?paella.initDelegate.initParams.dataUrl():paella.initDelegate.initParams.dataUrl:this.getVideoUrl()+"data.json"},loadVideo:function(e){var t=this,n=paella.initDelegate.initParams.loadVideo;if(this._data)this.loadVideoData(this._data,e);else if(n)n().then(function(n){t._data=n,t.loadVideoData(t._data,e)});else if(this._url){var a=this;base.ajax.get({url:this.getDataUrl()},function(t,n,i){if("string"==typeof t)try{t=JSON.parse(t)}catch(e){}a._data=t,a.loadVideoData(a._data,e)},function(e,t,n){switch(n){case 401:paella.messageBox.showError(base.dictionary.translate("You are not logged in"));break;case 403:paella.messageBox.showError(base.dictionary.translate("You are not authorized to view this resource"));break;case 404:paella.messageBox.showError(base.dictionary.translate("The specified video identifier does not exist"));break;default:paella.messageBox.showError(base.dictionary.translate("Could not load the video"))}})}},loadVideoData:function(e,t){var n=this;e.metadata&&(this.metadata=e.metadata),e.streams&&e.streams.forEach(function(e){n.loadStream(e)}),e.frameList&&this.loadFrameData(e),e.captions&&this.loadCaptions(e.captions),e.blackboard&&this.loadBlackboard(e.streams[0],e.blackboard),this.streams=e.streams,this.frameList=e.frameList,this.loadStatus=this.streams.length>0,t()},loadFrameData:function(e){var t=this;if(e.frameList&&e.frameList.forEach){var n={};e.frameList.forEach(function(e){/^[a-zA-Z]+:\/\//.test(e.url)||/^data:/.test(e.url)||(e.url=t.getVideoUrl()+e.url),!e.thumb||/^[a-zA-Z]+:\/\//.test(e.thumb)||/^data:/.test(e.thumb)||(e.thumb=t.getVideoUrl()+e.thumb);var a=e.time;n[a]=e}),e.frameList=n}},loadStream:function(e){var t=this;for(var n in!e.preview||/^[a-zA-Z]+:\/\//.test(e.preview)||/^data:/.test(e.preview)||(e.preview=t.getVideoUrl()+e.preview),e.sources.image&&e.sources.image.forEach(function(e){if(e.frames.forEach){var n={};e.frames.forEach(function(e){!e.src||/^[a-zA-Z]+:\/\//.test(e.src)||/^data:/.test(e.src)||(e.src=t.getVideoUrl()+e.src),!e.thumb||/^[a-zA-Z]+:\/\//.test(e.thumb)||/^data:/.test(e.thumb)||(e.thumb=t.getVideoUrl()+e.thumb);var a="frame_"+e.time;n[a]=e.src}),e.frames=n}}),e.sources){if(e.sources[n]){if("image"!=n)e.sources[n].forEach(function(e){"string"==typeof e.src&&null==e.src.match(/^[a-zA-Z\:]+\:\/\//gi)&&(e.src=t.getVideoUrl()+e.src),e.type=e.mimetype})}else delete e.sources[n]}},loadCaptions:function(e){if(e)for(var t=0;t ([0-9]{2}:)?[0-9]{2}:[0-9]{2}.[0-9]{3})/.test(u)?(s=!1,void 0!=a&&(i.push(a),o++),a={id:o,begin:this.parseTimeTextToSeg(u.split("--\x3e")[0]),end:this.parseTimeTextToSeg(u.split("--\x3e")[1])}):void 0===a||s||(u=(u=u.replace(/^- /,"")).replace(/<[^>]*>/g,""),void 0===a.content?a.content=u:a.content+="
"+u)))}i.push(a),i.length>0?n(!1,i):n(!0)},parseTimeTextToSeg:function(e){for(var t=0,n=1,a=(e=/(([0-9]{2}:)?[0-9]{2}:[0-9]{2}.[0-9]{3})/.exec(e))[0].split(":"),i=a.length-1;i>=0;i--)n=Math.pow(60,a.length-1-i),t+=a[i]*n;return t}},{},e)}(paella.CaptionParserPlugIn)}),Class("paella.plugins.xAPISaverPlugin",paella.userTracking.SaverPlugIn,{getName:function(){return"es.teltek.paella.usertracking.xAPISaverPlugin"},setup:function(){this.endpoint=this.config.endpoint,this.auth=this.config.auth,this.user_info={},this.paused=!0,this.played_segments="",this.played_segments_segment_start=null,this.played_segments_segment_end=null,this.progress=0,this.duration=0,this.current_time=[],this.completed=!1,this.volume=null,this.speed=null,this.language="us-US",this.quality=null,this.fullscreen=!1,this.title="No title available",this.description="",this.user_agent="",this.total_time=0,this.total_time_start=0,this.total_time_end=0,this.session_id="";var e=this;this._loadDeps().then(function(){var t={endpoint:e.endpoint,auth:"Basic "+toBase64(e.auth)};ADL.XAPIWrapper.changeConfig(t)}),paella.events.bind(paella.events.timeUpdate,function(t,n){e.current_time.push(n.currentTime),e.current_time.length>=10&&(e.current_time=e.current_time.slice(-10));var a=Math.round(e.current_time[0]),i=Math.round(e.current_time[9]);0!==n.currentTime&&a+1>=i&&i-1>=a&&(e.progress=e.get_progress(n.currentTime,n.duration),e.progress>=.95&&!1===e.completed&&(e.completed=!0,e.end_played_segment(n.currentTime),e.start_played_segment(n.currentTime),e.send_completed(n.currentTime,e.progress)))})},get_session_data:function(){var e=ADL.XAPIWrapper.searchParams(),t=JSON.stringify({mbox:this.user_info.email}),n=new Date;n.setDate(n.getDate()-1),n=n.toISOString(),e.activity=window.location.href,e.verb="http://adlnet.gov/expapi/verbs/terminated",e.since=n,e.limit=1,e.agent=t;var a=ADL.XAPIWrapper.getStatements(e);1===a.statements.length?(this.played_segments=a.statements[0].result.extensions["https://w3id.org/xapi/video/extensions/played-segments"],this.progress=a.statements[0].result.extensions["https://w3id.org/xapi/video/extensions/progress"],ADL.XAPIWrapper.lrs.registration=a.statements[0].context.registration):ADL.XAPIWrapper.lrs.registration=ADL.ruuid()},getCookie:function(e){for(var t=e+"=",n=decodeURIComponent(document.cookie).split(";"),a=0;a=n+1}));var i=a.filter(Number).pop();this.current_time=[],this.current_time.push(n),e.progress=e.get_progress(i,e.duration),this.paused||(this.end_played_segment(i),this.start_played_segment(n));var r={verb:{id:"https://w3id.org/xapi/video/verbs/seeked",description:"seeked"},result:{extensions:{"https://w3id.org/xapi/video/extensions/time-from":i,"https://w3id.org/xapi/video/extensions/time-to":n,"https://w3id.org/xapi/video/extensions/progress":e.progress,"https://w3id.org/xapi/video/extensions/played-segments":e.played_segments}}};e.send(r)},send_completed:function(e,t){var n={verb:{id:"http://adlnet.gov/xapi/verbs/completed",description:"completed"},result:{completion:!0,success:!0,duration:"PT"+this.total_time+"S",extensions:{"https://w3id.org/xapi/video/extensions/time":e,"https://w3id.org/xapi/video/extensions/progress":t,"https://w3id.org/xapi/video/extensions/played-segments":this.played_segments}}};this.send(n)},send_interacted:function(e,t){var n={verb:{id:"http://adlnet.gov/expapi/verbs/interacted",description:"interacted"},result:{extensions:{"https://w3id.org/xapi/video/extensions/time":e}},interacted:t};this.send(n)},start_played_segment:function(e){this.played_segments_segment_start=e},end_played_segment:function(e){var t;(t=""===this.played_segments?[]:this.played_segments.split("[,]")).push(this.played_segments_segment_start+"[.]"+e),this.played_segments=t.join("[,]"),this.played_segments_segment_end=e},format_float:function(e){return e=parseFloat(e),parseFloat(e.toFixed(3))},get_title:function(){paella.player.videoLoader.getMetadata().i18nTitle?this.title=paella.player.videoLoader.getMetadata().i18nTitle:paella.player.videoLoader.getMetadata().title&&(this.title=paella.player.videoLoader.getMetadata().title)},get_description:function(){paella.player.videoLoader.getMetadata().i18nTitle?this.description=paella.player.videoLoader.getMetadata().i18nDescription:this.description=paella.player.videoLoader.getMetadata().description},get_progress:function(e,t){var n,a;n=""===this.played_segments?[]:this.played_segments.split("[,]"),null!=this.played_segments_segment_start&&n.push(this.played_segments_segment_start+"[.]"+e),a=[],n.forEach(function(e,t){a[t]=e.split("[.]"),a[t][0]*=1,a[t][1]*=1}),a.sort(function(e,t){return e[0]-t[0]}),a.forEach(function(e,t){t>0&&a[t][0]a[t][1]&&(a[t][1]=a[t][0]))});var i=0;return a.forEach(function(e,t){e[1]>e[0]&&(i+=e[1]-e[0])}),1*(i/t).toFixed(2)}}),paella.plugins.xAPISaverPlugin=new paella.plugins.xAPISaverPlugin,paella.plugins.TrimmingTrackPlugin=Class.create(paella.editor.MainTrackPlugin,{trimmingTrack:null,trimmingData:{s:0,e:0},getTrackItems:function(){null==this.trimmingTrack&&(this.trimmingTrack={id:1,s:0,e:0},this.trimmingTrack.s=paella.player.videoContainer.trimStart(),this.trimmingTrack.e=paella.player.videoContainer.trimEnd(),this.trimmingData.s=this.trimmingTrack.s,this.trimmingData.e=this.trimmingTrack.e);var e=[];return e.push(this.trimmingTrack),e},getName:function(){return"es.upv.paella.editor.trimmingTrackPlugin"},getTools:function(){if(this.config.enableResetButton)return[{name:"reset",label:base.dictionary.translate("Reset"),hint:base.dictionary.translate("Resets the trimming bar to the default length of the video.")}]},onToolSelected:function(e){if(this.config.enableResetButton&&"reset"==e)return this.trimmingTrack={id:1,s:0,e:0},this.trimmingTrack.s=0,this.trimmingTrack.e=paella.player.videoContainer.duration(!0),!0},getTrackName:function(){return base.dictionary.translate("Trimming")},getColor:function(){return"rgb(0, 51, 107)"},onSave:function(e){paella.player.videoContainer.enableTrimming(),paella.player.videoContainer.setTrimmingStart(this.trimmingTrack.s),paella.player.videoContainer.setTrimmingEnd(this.trimmingTrack.e),this.trimmingData.s=this.trimmingTrack.s,this.trimmingData.e=this.trimmingTrack.e,paella.data.write("trimming",{id:paella.initDelegate.getId()},{start:this.trimmingTrack.s,end:this.trimmingTrack.e},function(t,n){e(n)})},onDiscard:function(e){this.trimmingTrack.s=this.trimmingData.s,this.trimmingTrack.e=this.trimmingData.e,e(!0)},allowDrag:function(){return!1},onTrackChanged:function(e,t,n){playerEnd=paella.player.videoContainer.duration(!0),t=t<0?0:t,n=n>playerEnd?playerEnd:n,this.trimmingTrack.s=t,this.trimmingTrack.e=n,this.parent(e,t,n)},contextHelpString:function(){return"es"==base.dictionary.currentLanguage()?'Utiliza la herramienta de recorte para definir el instante inicial y el instante final de la clase. Para cambiar la duración solo hay que arrastrar el inicio o el final de la pista "Recorte", en la linea de tiempo.':"Use this tool to define the start and finish time."}}),paella.plugins.trimmingTrackPlugin=new paella.plugins.TrimmingTrackPlugin,paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.trimmingPlayerPlugin"},getEvents:function(){return[paella.events.controlBarLoaded,paella.events.showEditor,paella.events.hideEditor]},onEvent:function(e,t){switch(e){case paella.events.controlBarLoaded:this.loadTrimming();break;case paella.events.showEditor:paella.player.videoContainer.disableTrimming();break;case paella.events.hideEditor:paella.player.config.trimming&&paella.player.config.trimming.enabled&&paella.player.videoContainer.enableTrimming()}},loadTrimming:function(){var e=paella.initDelegate.getId();paella.data.read("trimming",{id:e},function(e,t){if(e&&t&&e.end>0)paella.player.videoContainer.setTrimming(e.start,e.end).then(function(){return paella.player.videoContainer.enableTrimming()});else{var n=base.parameters.get("start"),a=base.parameters.get("end");n&&a&&paella.player.videoContainer.setTrimming(n,a).then(function(){return paella.player.videoContainer.enableTrimming()})}})}},{},e)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getIndex:function(){return 552},getAlignment:function(){return"right"},getSubclass:function(){return"AirPlayButton"},getIconClass:function(){return"icon-airplay"},getName:function(){return"es.upv.paella.airPlayPlugin"},checkEnabled:function(e){this._visible=!1,e(window.WebKitPlaybackTargetAvailabilityEvent)},getDefaultToolTip:function(){return base.dictionary.translate("Emit to AirPlay.")},setup:function(){var e=this,t=paella.player.videoContainer.masterVideo().video;window.WebKitPlaybackTargetAvailabilityEvent&&t.addEventListener("webkitplaybacktargetavailabilitychanged",function(t){switch(t.availability){case"available":e._visible=!0;break;case"not-available":e._visible=!1}e.updateClassName()})},action:function(e){paella.player.videoContainer.masterVideo().video.webkitShowPlaybackTargetPicker()},updateClassName:function(){this.button.className=this.getButtonItemClass(!0)},getButtonItemClass:function(e){return"buttonPlugin "+this.getSubclass()+" "+this.getAlignment()+" "+(this._visible?"available":"not-available")}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.arrowSlidesNavigatorPlugin"},checkEnabled:function(e){!paella.initDelegate.initParams.videoLoader.frameList||0==Object.keys(paella.initDelegate.initParams.videoLoader.frameList).length&&paella.player.videoContainer.isMonostream?e(!1):e(!0)},setup:function(){var e=this;this._showArrowsIn=this.config.showArrowsIn||"slave",this.createOverlay(),e._frames=[];var t=paella.initDelegate.initParams.videoLoader.frameList;if(t){var n=Object.keys(t);n.length,n.map(function(e){return Number(e,10)}).sort(function(e,t){return e-t}).forEach(function(n){e._frames.push(t[n])})}},createOverlay:function(){var e=this,t=paella.player.videoContainer.overlayContainer;if(!this.arrows){this.arrows=document.createElement("div"),this.arrows.id="arrows",this.arrows.style.marginTop="25%";var n=document.createElement("div");n.className="buttonPlugin arrowSlideNavidator nextButton right icon-arrow-right",this.arrows.appendChild(n);var a=document.createElement("div");a.className="buttonPlugin arrowSlideNavidator prevButton left icon-arrow-left",this.arrows.appendChild(a),$(n).click(function(t){e.goNextSlide(),t.stopPropagation()}),$(a).click(function(t){e.goPrevSlide(),t.stopPropagation()})}switch(this.container&&t.removeElement(this.container),e._showArrowsIn){case"full":this.container=t.addLayer(),this.container.style.marginRight="0",this.container.style.marginLeft="0",this.arrows.style.marginTop="25%";break;case"master":var i=document.createElement("div");this.container=t.addElement(i,t.getMasterRect()),this.arrows.style.marginTop="23%";break;case"slave":i=document.createElement("div");this.container=t.addElement(i,t.getSlaveRect()),this.arrows.style.marginTop="35%"}this.container.appendChild(this.arrows),this.hideArrows()},getCurrentRange:function(){var e=this;return new Promise(function(t){if(e._frames.length<1)t(null);else{var n=null;paella.player.videoContainer.duration().then(function(e){return e,paella.player.videoContainer.trimming()}).then(function(e){return n=e,paella.player.videoContainer.currentTime()}).then(function(a){if(!e._frames.some(function(i,r,o){if(r+1!=o.length){var s=0==r?i:e._frames[r-1],l=e._frames[r+1],u=n.enabled?s.time-n.start:s.time,c=n.enabled?i.time-n.start:i.time,d=n.enabled?l.time-n.start:l.time;if(ca){var p={prev:u,next:d};return u<0&&(p.prev=c>0?c:0),t(p),!0}}})){var i=e._frames[e._frames.length-2].time,r=e._frames[e._frames.length-1].time;t({prev:n.enabled?i-n.start:i,next:n.enabled?r-n.start:r})}})}})},goNextSlide:function(){this.getCurrentRange().then(function(e){paella.player.videoContainer.seekToTime(e.next)})},goPrevSlide:function(){this.getCurrentRange().then(function(e){paella.player.videoContainer.seekToTime(e.prev)})},showArrows:function(){$(this.arrows).show()},hideArrows:function(){$(this.arrows).hide()},getEvents:function(){return[paella.events.controlBarDidShow,paella.events.controlBarDidHide,paella.events.setComposition]},onEvent:function(e,t){switch(e){case paella.events.controlBarDidShow:this.showArrows();break;case paella.events.controlBarDidHide:this.hideArrows();break;case paella.events.setComposition:this.createOverlay()}}},{},e)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"audioLanguages"},getIconClass:function(){return"icon-headphone"},getIndex:function(){return 2040},getMinWindowSize:function(){return 400},getName:function(){return"es.upv.paella.audioLanguage"},getDefaultToolTip:function(){return base.dictionary.translate("Set audio language")},closeOnMouseOut:function(){return!0},checkEnabled:function(e){var t=this;paella.player.videoContainer.getAudioLanguages().then(function(n){t._languages=n,e(n.length>1)})},setup:function(){var e=this;this.setLanguageLabel(),paella.events.bind(paella.events.audioLanguageChanged,function(){e.setLanguageLabel()})},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},buildContent:function(e){var t=this;this._languages.forEach(function(n){e.appendChild(t.getItemButton(n))})},getItemButton:function(e){var t=document.createElement("div"),n=paella.player.videoContainer.mainAudioPlayer().stream.language,a=paella.dictionary.translate(e);return t.className=this.getButtonItemClass(a,e==n),t.id="laguageSelectorItem_"+e,t.innerHTML=a,t.data=e,$(t).click(function(e){$(".videoAudioTrackItem").removeClass("selected"),$(".videoAudioTrackItem."+this.data).addClass("selected"),paella.player.videoContainer.setAudioLanguage(this.data)}),t},setQualityLabel:function(){var e=this;paella.player.videoContainer.getCurrentQuality().then(function(t){e.setText(t.shortLabel())})},getButtonItemClass:function(e,t){return"videoAudioTrackItem "+e+(t?" selected":"")},setLanguageLabel:function(){this.setText(paella.player.videoContainer.audioLanguage)}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.blackBoardPlugin"},getIndex:function(){return 10},getAlignment:function(){return"right"},getSubclass:function(){return"blackBoardButton2"},getDefaultToolTip:function(){return base.dictionary.translate("BlackBoard")},checkEnabled:function(e){this._blackBoardProfile="s_p_blackboard2",this._blackBoardDIV=null,this._hasImages=null,this._active=!1,this._creationTimer=500,this._zImages=null,this._videoLength=null,this._keys=null,this._currentImage=null,this._next=null,this._prev=null,this._lensDIV=null,this._lensContainer=null,this._lensWidth=null,this._lensHeight=null,this._conImg=null,this._zoom=250,this._currentZoom=null,this._maxZoom=500,this._mousePos=null,this._containerRect=null,e(!0)},getEvents:function(){return[paella.events.setProfile,paella.events.timeUpdate]},onEvent:function(e,t){switch(e){case paella.events.setProfile:if(t.profileName!=this._blackBoardProfile){this._active&&(this.destroyOverlay(),this._active=!1);break}this._hasImages||paella.player.setProfile("slide_professor"),this._hasImages&&!this._active&&(this.createOverlay(),this._active=!0);break;case paella.events.timeUpdate:this._active&&this._hasImages&&this.imageUpdate(e,t)}},setup:function(){var e=this;if(paella.player.videoContainer.sourceData[0].sources.hasOwnProperty("image"))e._hasImages=!0,e._zImages={},e._zImages=paella.player.videoContainer.sourceData[0].sources.image[0].frames,e._videoLength=paella.player.videoContainer.sourceData[0].sources.image[0].duration,e._keys=Object.keys(e._zImages),e._keys=e._keys.sort(function(e,t){return e=e.slice(6),t=t.slice(6),parseInt(e)-parseInt(t)});else if(e._hasImages=!1,paella.player.selectedProfile==e._blackBoardProfile){var t=paella.player.config.defaultProfile;paella.player.setProfile(t)}this._next=0,this._prev=0,paella.player.selectedProfile==e._blackBoardProfile&&(e.createOverlay(),e._active=!0),e._mousePos={},paella.Profiles.loadProfile(e._blackBoardProfile,function(t){e._containerRect=t.blackBoardImages})},createLens:function(){var e=this;null==e._currentZoom&&(e._currentZoom=e._zoom);var t=document.createElement("div");t.className="lensClass",e._lensDIV=t;var n=$(".conImg").offset(),a=$(".conImg").width(),i=$(".conImg").height();t.style.width=a/(e._currentZoom/100)+"px",t.style.height=i/(e._currentZoom/100)+"px",e._lensWidth=parseInt(t.style.width),e._lensHeight=parseInt(t.style.height),$(e._lensContainer).append(t),$(e._lensContainer).mousemove(function(t){var r=t.pageX-n.left,o=t.pageY-n.top;e._mousePos.x=r,e._mousePos.y=o;var s=o-e._lensHeight/2;s=(s=s<0?0:s)>i-e._lensHeight?i-e._lensHeight:s;var l=r-e._lensWidth/2;if(l=(l=l<0?0:l)>a-e._lensWidth?a-e._lensWidth:l,e._lensDIV.style.left=l+"px",e._lensDIV.style.top=s+"px",100!=e._currentZoom){var u=100*l/(a-e._lensWidth),c=100*s/(i-e._lensHeight);e._blackBoardDIV.style.backgroundPosition=u.toString()+"% "+c.toString()+"%"}else if(100==e._currentZoom){var d=100*r/a,p=100*o/i;e._blackBoardDIV.style.backgroundPosition=d.toString()+"% "+p.toString()+"%"}e._blackBoardDIV.style.backgroundSize=e._currentZoom+"%"}),$(e._lensContainer).bind("wheel mousewheel",function(t){(void 0!==t.originalEvent.wheelDelta?t.originalEvent.wheelDelta:-1*t.originalEvent.deltaY)>0&&e._currentZoom100?e.reBuildLens(-10):100==e._currentZoom&&(e._lensDIV.style.left="0px",e._lensDIV.style.top="0px"),e._blackBoardDIV.style.backgroundSize=e._currentZoom+"%"})},reBuildLens:function(e){this._currentZoom+=e;$(".conImg").offset();var t=$(".conImg").width(),n=$(".conImg").height();if(this._lensDIV.style.width=t/(this._currentZoom/100)+"px",this._lensDIV.style.height=n/(this._currentZoom/100)+"px",this._lensWidth=parseInt(this._lensDIV.style.width),this._lensHeight=parseInt(this._lensDIV.style.height),100!=this._currentZoom){var a=this._mousePos.x,i=this._mousePos.y-this._lensHeight/2;i=(i=i<0?0:i)>n-this._lensHeight?n-this._lensHeight:i;var r=a-this._lensWidth/2;r=(r=r<0?0:r)>t-this._lensWidth?t-this._lensWidth:r,this._lensDIV.style.left=r+"px",this._lensDIV.style.top=i+"px";var o=100*r/(t-this._lensWidth),s=100*i/(n-this._lensHeight);this._blackBoardDIV.style.backgroundPosition=o.toString()+"% "+s.toString()+"%"}},destroyLens:function(){this._lensDIV&&($(this._lensDIV).remove(),this._blackBoardDIV.style.backgroundSize="100%",this._blackBoardDIV.style.opacity=0)},createOverlay:function(){var e=this,t=document.createElement("div");t.className="blackBoardDiv",e._blackBoardDIV=t,e._blackBoardDIV.style.opacity=0;var n=document.createElement("div");n.className="lensContainer",e._lensContainer=n;var a=document.createElement("img");a.className="conImg",e._conImg=a,e._currentImage&&(e._conImg.src=e._currentImage,$(e._blackBoardDIV).css("background-image","url("+e._currentImage+")")),$(n).append(a),$(e._lensContainer).mouseenter(function(){e.createLens(),e._blackBoardDIV.style.opacity=1}),$(e._lensContainer).mouseleave(function(){e.destroyLens()}),setTimeout(function(){var a=paella.player.videoContainer.overlayContainer;a.addElement(t,a.getMasterRect()),a.addElement(n,e._containerRect)},e._creationTimer)},destroyOverlay:function(){this._blackBoardDIV&&$(this._blackBoardDIV).remove(),this._lensContainer&&$(this._lensContainer).remove()},imageUpdate:function(e,t){var n=this,a=Math.round(t.currentTime),i=$(n._blackBoardDIV).css("background-image");if($(n._blackBoardDIV).length>0){if(n._zImages.hasOwnProperty("frame_"+a)){if(i==n._zImages["frame_"+a])return;i=n._zImages["frame_"+a]}else{if(!(a>n._next||ai&&e0&&(t.breaks=n.breaks),e(!0)})},getEvents:function(){return[paella.events.timeUpdate]},onEvent:function(e,t){var n=this;t.videoContainer.currentTime(!0).then(function(e){n.checkBreaks(e)})},checkBreaks:function(e){for(var t,n=0;ne?this.areBreaksClickable()?this.avoidBreak(t):this.showBreaks(t):t.s.toFixed(0)==e.toFixed(0)&&this.avoidBreak(t);if(!this.areBreaksClickable())for(var a in this.visibleBreaks)"object"==$traceurRuntime.typeof(t)&&(t=this.visibleBreaks[a])&&(t.s>=e||t.e<=e)&&this.removeBreak(t)},areBreaksClickable:function(){return this.config.neverShow&&!(paella.editor.instance&&paella.editor.instance.isLoaded)},showBreaks:function(e){if(!this.visibleBreaks[e.s]){var t=e.name||paella.dictionary.translate("Break");e.elem=paella.player.videoContainer.overlayContainer.addText(t,{left:100,top:350,width:1080,height:40}),e.elem.className="textBreak",this.visibleBreaks[e.s]=e}},removeBreak:function(e){if(this.visibleBreaks[e.s]){var t=this.visibleBreaks[e.s].elem;paella.player.videoContainer.overlayContainer.removeElement(t),this.visibleBreaks[e.s]=null}},avoidBreak:function(e){var t,n=this;paella.player.videoContainer.trimEnabled()?paella.player.videoContainer.trimming().then(function(a){e.e>=a.end?(t=0,paella.player.videoContainer.pause()):t=e.e+(n.config.neverShow?.01:0)-a.start,paella.player.videoContainer.seekToTime(t)}):paella.player.videoContainer.duration(!0).then(function(a){e.e>=a?(t=0,paella.player.videoContainer.pause()):t=e.e+(n.config.neverShow?.01:0),paella.player.videoContainer.seekToTime(t)})}},{},e)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{get ext(){return["dfxp"]},getName:function(){return"es.upv.paella.captions.DFXPParserPlugin"},parse:function(e,t,n){for(var a=[],i=this,r=$(e),o=r.attr("xml:lang"),s=r.find("div"),l=0;l0?n(!1,a):n(!0)},parseTimeTextToSeg:function(e){var t=0;if(/^([0-9]*([.,][0-9]*)?)s/.test(e))t=parseFloat(RegExp.$1);else{var n=e.split(":"),a=parseInt(n[0]),i=parseInt(n[1]);t=parseInt(n[2])+60*i+60*a*60}return t}},{},e)}(paella.CaptionParserPlugIn)}),paella.addPlugin(function(){return function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{getInstanceName:function(){return"captionsPlugin"},getAlignment:function(){return"right"},getSubclass:function(){return"captionsPluginButton"},getIconClass:function(){return"icon-captions"},getName:function(){return"es.upv.paella.captionsPlugin"},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},getDefaultToolTip:function(){return base.dictionary.translate("Subtitles")},getIndex:function(){return 509},closeOnMouseOut:function(){return!1},checkEnabled:function(e){this._searchTimerTime=1500,this._searchTimer=null,this._pluginButton=null,this._open=0,this._parent=null,this._body=null,this._inner=null,this._bar=null,this._input=null,this._select=null,this._editor=null,this._activeCaptions=null,this._lastSel=null,this._browserLang=null,this._defaultBodyHeight=280,this._autoScroll=!0,this._searchOnCaptions=null,e(!0)},showUI:function(){paella.captions.getAvailableLangs().length>=1&&$traceurRuntime.superGet(this,t.prototype,"showUI").call(this)},setup:function(){var e=this;paella.captions.getAvailableLangs().length||paella.plugins.captionsPlugin.hideUI(),paella.events.bind(paella.events.captionsEnabled,function(t,n){e.onChangeSelection(n)}),paella.events.bind(paella.events.captionsDisabled,function(t,n){e.onChangeSelection(n)}),paella.events.bind(paella.events.captionAdded,function(t,n){e.onCaptionAdded(n),paella.plugins.captionsPlugin.showUI()}),paella.events.bind(paella.events.timeUpdate,function(t,n){e._searchOnCaptions&&e.updateCaptionHiglighted(n)}),paella.events.bind(paella.events.controlBarWillHide,function(t){e.cancelHideBar()}),e._activeCaptions=paella.captions.getActiveCaptions(),e._searchOnCaptions=e.config.searchOnCaptions||!1},cancelHideBar:function(){this._open>0&&paella.player.controls.cancelHideBar()},updateCaptionHiglighted:function(e){var t=this,n=null;e&&paella.player.videoContainer.trimming().then(function(a){var i=a.enabled?a.start:0,r=paella.captions.getActiveCaptions(),o=r&&r.getCaptionAtTime(e.currentTime+i),s=o&&o.id;null!=s&&((n=$(".bodyInnerContainer[sec-id='"+s+"']"))!=t._lasSel&&$(t._lasSel).removeClass("Highlight"),n&&($(n).addClass("Highlight"),t._autoScroll&&t.updateScrollFocus(s),t._lasSel=n))})},updateScrollFocus:function(e){var t=0,n=$(".bodyInnerContainer").slice(0,e);(n=n.toArray()).forEach(function(e){var n=$(e).outerHeight(!0);t+=n});var a=parseInt(t/280);$(".captionsBody").scrollTop(a*this._defaultBodyHeight)},onCaptionAdded:function(e){var t=paella.captions.getCaptions(e),n=document.createElement("option");n.text=t._lang.txt,n.value=e,this._select.add(n)},changeSelection:function(){var e=$(this._select).val();if(""==e)return $(this._body).empty(),void paella.captions.setActiveCaptions(e);paella.captions.setActiveCaptions(e),this._activeCaptions=e,this._searchOnCaptions&&this.buildBodyContent(paella.captions.getActiveCaptions()._captions,"list"),this.setButtonHideShow()},onChangeSelection:function(e){this._activeCaptions!=e&&($(this._body).empty(),void 0==e?(this._select.value="",$(this._input).prop("disabled",!0)):($(this._input).prop("disabled",!1),this._select.value=e,this._searchOnCaptions&&this.buildBodyContent(paella.captions.getActiveCaptions()._captions,"list")),this._activeCaptions=e,this.setButtonHideShow())},action:function(){switch(this._browserLang=base.dictionary.currentLanguage(),this._autoScroll=!0,this._open){case 0:this._browserLang&&void 0==paella.captions.getActiveCaptions()&&this.selectDefaultBrowserLang(this._browserLang),this._open=1,paella.keyManager.enabled=!1;break;case 1:paella.keyManager.enabled=!0,this._open=0}},buildContent:function(e){var t=this;t._parent=document.createElement("div"),t._parent.className="captionsPluginContainer",t._bar=document.createElement("div"),t._bar.className="captionsBar",t._searchOnCaptions&&(t._body=document.createElement("div"),t._body.className="captionsBody",t._parent.appendChild(t._body),$(t._body).scroll(function(){t._autoScroll=!1}),t._input=document.createElement("input"),t._input.className="captionsBarInput",t._input.type="text",t._input.id="captionsBarInput",t._input.name="captionsString",t._input.placeholder=base.dictionary.translate("Search captions"),t._bar.appendChild(t._input),$(t._input).change(function(){var e=$(t._input).val();t.doSearch(e)}),$(t._input).keyup(function(){var e=$(t._input).val();null!=t._searchTimer&&t._searchTimer.cancel(),t._searchTimer=new base.Timer(function(n){t.doSearch(e)},t._searchTimerTime)})),t._select=document.createElement("select"),t._select.className="captionsSelector";var n=document.createElement("option");n.text=base.dictionary.translate("None"),n.value="",t._select.add(n),paella.captions.getAvailableLangs().forEach(function(e){var n=document.createElement("option");n.text=e.lang.txt,n.value=e.id,t._select.add(n)}),t._bar.appendChild(t._select),t._parent.appendChild(t._bar),$(t._select).change(function(){t.changeSelection()}),t._editor=document.createElement("button"),t._editor.className="editorButton",t._editor.innerHTML="",t._bar.appendChild(t._editor),$(t._editor).prop("disabled",!0),$(t._editor).click(function(){var e=paella.captions.getActiveCaptions();paella.userTracking.log("paella:caption:edit",{id:e._captionsProvider+":"+e._id,lang:e._lang}),e.goToEdit()}),e.appendChild(t._parent)},selectDefaultBrowserLang:function(e){var t=null;paella.captions.getAvailableLangs().forEach(function(n){n.lang.code==e&&(t=n.id)}),t&&paella.captions.setActiveCaptions(t)},doSearch:function(e){var t=this,n=paella.captions.getActiveCaptions();n&&(""==e?t.buildBodyContent(paella.captions.getActiveCaptions()._captions,"list"):n.search(e,function(e,n){e||t.buildBodyContent(n,"search")}))},setButtonHideShow:function(){var e=$(".editorButton"),t=paella.captions.getActiveCaptions(),n=null;null!=t?($(this._select).width("39%"),t.canEdit(function(e,t){n=t}),n?($(e).prop("disabled",!1),$(e).show()):($(e).prop("disabled",!0),$(e).hide(),$(this._select).width("47%"))):($(e).prop("disabled",!0),$(e).hide(),$(this._select).width("47%")),this._searchOnCaptions||(n?$(this._select).width("92%"):$(this._select).width("100%"))},buildBodyContent:function(e,t){var n=this;$(n._body).empty(),e.forEach(function(e){paella.player.videoContainer.trimming().then(function(a){a.enabled&&(e.enda.end)||(n._inner=document.createElement("div"),n._inner.className="bodyInnerContainer",n._inner.innerHTML=e.content,"list"==t&&(n._inner.setAttribute("sec-begin",e.begin),n._inner.setAttribute("sec-end",e.end),n._inner.setAttribute("sec-id",e.id),n._autoScroll=!0),"search"==t&&n._inner.setAttribute("sec-begin",e.time),n._body.appendChild(n._inner),$(n._inner).hover(function(){$(this).css("background-color","rgba(250, 161, 102, 0.5)")},function(){$(this).removeAttr("style")}),$(n._inner).click(function(){var e=$(this).attr("sec-begin");paella.player.videoContainer.trimming().then(function(t){var n=t.enabled?t.start:0;paella.player.videoContainer.seekToTime(parseInt(e-n))})}))})})}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{checkEnabled:function(e){this.containerId="paella_plugin_CaptionsOnScreen",this.container=null,this.innerContainer=null,this.top=null,this.actualPos=null,this.lastEvent=null,this.controlsPlayback=null,this.captions=!1,this.captionProvider=null,e(!paella.player.isLiveStream())},setup:function(){},getEvents:function(){return[paella.events.controlBarDidHide,paella.events.resize,paella.events.controlBarDidShow,paella.events.captionsEnabled,paella.events.captionsDisabled,paella.events.timeUpdate]},onEvent:function(e,t){switch(e){case paella.events.controlBarDidHide:if(this.lastEvent==e||0==this.captions)break;this.moveCaptionsOverlay("down");break;case paella.events.resize:if(0==this.captions)break;paella.player.controls.isHidden()?this.moveCaptionsOverlay("down"):this.moveCaptionsOverlay("top");break;case paella.events.controlBarDidShow:if(this.lastEvent==e||0==this.captions)break;this.moveCaptionsOverlay("top");break;case paella.events.captionsEnabled:this.buildContent(t),this.captions=!0,paella.player.controls.isHidden()?this.moveCaptionsOverlay("down"):this.moveCaptionsOverlay("top");break;case paella.events.captionsDisabled:this.hideContent(),this.captions=!1;break;case paella.events.timeUpdate:this.captions&&this.updateCaptions(t)}this.lastEvent=e},buildContent:function(e){this.captionProvider=e,null==this.container?(this.container=document.createElement("div"),this.container.className="CaptionsOnScreen",this.container.id=this.containerId,this.innerContainer=document.createElement("div"),this.innerContainer.className="CaptionsOnScreenInner",this.container.appendChild(this.innerContainer),null==this.controlsPlayback&&(this.controlsPlayback=$("#playerContainer_controls_playback")),paella.player.videoContainer.domElement.appendChild(this.container)):$(this.container).show()},updateCaptions:function(e){var t=this;this.captions&&paella.player.videoContainer.trimming().then(function(n){var a=n.enabled?n.start:0,i=paella.captions.getActiveCaptions().getCaptionAtTime(e.currentTime+a);i?($(t.container).show(),t.innerContainer.innerHTML=i.content,t.moveCaptionsOverlay("auto")):(t.innerContainer.innerHTML="",t.hideContent())})},hideContent:function(){$(this.container).hide()},moveCaptionsOverlay:function(e){if(null==this.controlsPlayback&&(this.controlsPlayback=$("#playerContainer_controls_playback")),"auto"!=e&&void 0!=e||(e=paella.player.controls.isHidden()?"down":"top"),"down"==e){var t=this.container.offsetHeight;t-=this.innerContainer.offsetHeight+10,this.innerContainer.style.bottom=0-t+"px"}if("top"==e){var n=this.controlsPlayback.offset().top;n-=this.innerContainer.offsetHeight+10,this.innerContainer.style.bottom=0-n+"px"}},getIndex:function(){return 1050},getName:function(){return"es.upv.paella.overlayCaptionsPlugin"}},{},e)}(paella.EventDrivenPlugin)}),Class("paella.ChromaVideo",paella.VideoElementBase,{_posterFrame:null,_currentQuality:null,_autoplay:!1,_streamName:null,initialize:function(e,t,n,a,i,r,o){this.parent(e,t,"canvas",n,a,i,r),this._streamName=o||"chroma";var s=this;this._stream.sources[this._streamName]&&this._stream.sources[this._streamName].sort(function(e,t){return e.res.h-t.res.h}),this.video=null,new paella.Timer(function(e){!function(){if(s.canvasController){var e=s.canvasController.canvas.domElement;s.canvasController.reshape($(e).width(),$(e).height())}}()},500).repeat=!0},defaultProfile:function(){return"chroma"},_setVideoElem:function(e){$(this.video).bind("progress",evtCallback),$(this.video).bind("loadstart",evtCallback),$(this.video).bind("loadedmetadata",evtCallback),$(this.video).bind("canplay",evtCallback),$(this.video).bind("oncanplay",evtCallback)},_loadDeps:function(){return new Promise(function(e,t){window.$paella_bg2e?defer.resolve(window.$paella_bg2e):paella.require(paella.baseUrl+"resources/deps/bg2e.js").then(function(){window.$paella_bg2e=bg,e(window.$paella_bg2e)}).catch(function(e){console.error(e.message),t()})})},_deferredAction:function(e){var t=this;return new Promise(function(n,a){t.video?n(e()):$(t.video).bind("canplay",function(){t._ready=!0,n(e())})})},_getQualityObject:function(e,t){return{index:e,res:t.res,src:t.src,toString:function(){return this.res.w+"x"+this.res.h},shortLabel:function(){return this.res.h+"p"},compare:function(e){return this.res.w*this.res.h-e.res.w*e.res.h}}},allowZoom:function(){return!1},getVideoData:function(){var e=this,t=this;return new Promise(function(n,a){e._deferredAction(function(){n({duration:t.video.duration,currentTime:t.video.currentTime,volume:t.video.volume,paused:t.video.paused,ended:t.video.ended,res:{w:t.video.videoWidth,h:t.video.videoHeight}})})})},setPosterFrame:function(e){this._posterFrame=e},setAutoplay:function(e){this._autoplay=e,e&&this.video&&this.video.setAttribute("autoplay",e)},load:function(){var e=this;return new Promise(function(t,n){e._loadDeps().then(function(){var a=e._stream.sources[e._streamName];null===e._currentQuality&&e._videoQualityStrategy&&(e._currentQuality=e._videoQualityStrategy.getQualityIndex(a));var i=e._currentQuality0&&base.userAgent.system.iOS)return!1;for(var t in e.sources)if("chroma"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return paella.ChromaVideo._loaded=!0,++paella.videoFactories.Html5VideoFactory.s_instances,new paella.ChromaVideo(e,t,n.x,n.y,n.w,n.h)}}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{get divPublishComment(){return this._divPublishComment},set divPublishComment(e){this._divPublishComment=e},get divComments(){return this._divComments},set divComments(e){this._divComments=e},get publishCommentTextArea(){return this._publishCommentTextArea},set publishCommentTextArea(e){this._publishCommentTextArea=e},get publishCommentButtons(){return this._publishCommentButtons},set publishCommentButtons(e){this._publishCommentButtons=e},get canPublishAComment(){return this._canPublishAComment},set canPublishAComment(e){this._canPublishAComment=e},get comments(){return this._comments},set comments(e){this._comments=e},get commentsTree(){return this._commentsTree},set commentsTree(e){this._commentsTree=e},get domElement(){return this._domElement},set domElement(e){this._domElement=e},getSubclass:function(){return"showCommentsTabBar"},getName:function(){return"es.upv.paella.commentsPlugin"},getTabName:function(){return base.dictionary.translate("Comments")},checkEnabled:function(e){e(!0)},getIndex:function(){return 40},getDefaultToolTip:function(){return base.dictionary.translate("Comments")},action:function(e){this.loadContent()},buildContent:function(e){this.domElement=e,this.canPublishAComment=paella.initDelegate.initParams.accessControl.permissions.canWrite,this.loadContent()},loadContent:function(){this.divRoot=this.domElement,this.divRoot.innerHTML="",this.divPublishComment=document.createElement("div"),this.divPublishComment.className="CommentPlugin_Publish",this.divPublishComment.id="CommentPlugin_Publish",this.divComments=document.createElement("div"),this.divComments.className="CommentPlugin_Comments",this.divComments.id="CommentPlugin_Comments",this.canPublishAComment&&(this.divRoot.appendChild(this.divPublishComment),this.createPublishComment()),this.divRoot.appendChild(this.divComments),this.reloadComments()},createPublishComment:function(){var e,t,n,a,i=this,r=this.divPublishComment.id+"_entry";(e=document.createElement("div")).id=r,e.className="comments_entry",(t=document.createElement("img")).className="comments_entry_silhouette",t.style.width="48px",t.src=paella.initDelegate.initParams.accessControl.userData.avatar,t.id=r+"_silhouette",e.appendChild(t),(n=document.createElement("div")).className="comments_entry_container",n.id=r+"_textarea_container",e.appendChild(n),this.publishCommentTextArea=document.createElement("textarea"),this.publishCommentTextArea.id=r+"_textarea",this.publishCommentTextArea.onclick=function(){paella.keyManager.enabled=!1},this.publishCommentTextArea.onblur=function(){paella.keyManager.enabled=!0},n.appendChild(this.publishCommentTextArea),this.publishCommentButtons=document.createElement("div"),this.publishCommentButtons.id=r+"_buttons_area",n.appendChild(this.publishCommentButtons),(a=document.createElement("button")).id=r+"_btnAddComment",a.className="publish",a.onclick=function(){""!=i.publishCommentTextArea.value.replace(/\s/g,"")&&i.addComment()},a.innerHTML=base.dictionary.translate("Publish"),this.publishCommentButtons.appendChild(a),n.commentsTextArea=this.publishCommentTextArea,n.commentsBtnAddComment=a,n.commentsBtnAddCommentToInstant=this.btnAddCommentToInstant,this.divPublishComment.appendChild(e)},addComment:function(){var e=this,t=paella.AntiXSS.htmlEscape(e.publishCommentTextArea.value),n=new Date;this.comments.push({id:base.uuid(),userName:paella.initDelegate.initParams.accessControl.userData.name,mode:"normal",value:t,created:n});var a={allComments:this.comments};paella.data.write("comments",{id:paella.initDelegate.getId()},a,function(t,n){n&&e.loadContent()})},addReply:function(e,t){var n=this,a=document.getElementById(t),i=paella.AntiXSS.htmlEscape(a.value),r=new Date;paella.keyManager.enabled=!0,this.comments.push({id:base.uuid(),userName:paella.initDelegate.initParams.accessControl.userData.name,mode:"reply",parent:e,value:i,created:r});var o={allComments:this.comments};paella.data.write("comments",{id:paella.initDelegate.getId()},o,function(e,t){t&&n.reloadComments()})},reloadComments:function(){var e=this;e.commentsTree=[],e.comments=[],this.divComments.innerHTML="",paella.data.read("comments",{id:paella.initDelegate.getId()},function(t,n){var a,i,r;if(t&&"object"==$traceurRuntime.typeof(t)&&t.allComments&&t.allComments.length>0){e.comments=t.allComments;var o={};for(a=0;a";a+="",i.innerHTML=a}}),1==this.canPublishAComment){var p=document.createElement("div");p.className="reply_button",p.innerHTML=base.dictionary.translate("Reply"),p.id=o+"_comment_reply_button",p.onclick=function(){var t=r.createAReplyEntry(e.id);this.style.display="none",this.parentElement.parentElement.appendChild(t)},d.appendChild(p)}for(var h=0;h";n+="",r.innerHTML=n}}),n},createAReplyEntry:function(e){var t,n,a,i,r,o=this,s=this.divPublishComment.id+"_entry_"+e+"_reply";return(t=document.createElement("div")).id=s+"_entry",t.className="comments_entry",(n=document.createElement("img")).className="comments_entry_silhouette",n.style.width="48px",n.id=s+"_silhouette",n.src=paella.initDelegate.initParams.accessControl.userData.avatar,t.appendChild(n),(a=document.createElement("div")).className="comments_entry_container comments_reply_container",a.id=s+"_reply_container",t.appendChild(a),(i=document.createElement("textArea")).onclick=function(){paella.keyManager.enabled=!1},i.draggable=!1,i.id=s+"_textarea",a.appendChild(i),this.publishCommentButtons=document.createElement("div"),this.publishCommentButtons.id=s+"_buttons_area",a.appendChild(this.publishCommentButtons),(r=document.createElement("button")).id=s+"_btnAddComment",r.className="publish",r.onclick=function(){""!=i.value.replace(/\s/g,"")&&o.addReply(e,i.id)},r.innerHTML=base.dictionary.translate("Reply"),this.publishCommentButtons.appendChild(r),t}},{},e)}(paella.TabBarPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getSubclass:function(){return"showDescriptionTabBar"},getName:function(){return"es.upv.paella.descriptionPlugin"},getTabName:function(){return"Descripción"},get domElement(){return this._domElement||null},set domElement(e){this._domElement=e},buildContent:function(e){this.domElement=e,this.loadContent()},action:function(e){this.loadContent()},loadContent:function(){var e=this.domElement;e.innerHTML="Loading...",new paella.Timer(function(t){e.innerHTML="Loading done"},2e3)}},{},e)}(paella.TabBarPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{get currentUrl(){return this._currentUrl},set currentUrl(e){this._currentUrl=e},get currentMaster(){return this._currentMaster},set currentMaster(e){this._currentMaster=e},get currentSlave(){return this._currentSlave},set currentSlave(e){this._currentSlave=e},get availableMasters(){return this._availableMasters},set availableMasters(e){this._availableMasters=e},get availableSlaves(){return this._availableSlaves},set availableSlaves(e){this._availableSlaves=e},get showWidthRes(){return this._showWidthRes},set showWidthRes(e){this._showWidthRes=e},getAlignment:function(){return"right"},getSubclass:function(){return"extendedTabAdapterPlugin"},getIconClass:function(){return"icon-folder"},getIndex:function(){return 2030},getMinWindowSize:function(){return 550},getName:function(){return"es.upv.paella.extendedTabAdapterPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Extended Tab Adapter")},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},buildContent:function(e){e.appendChild(paella.extendedAdapter.bottomContainer)}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{get INTERVAL_LENGTH(){return this._INTERVAL_LENGTH},set INTERVAL_LENGTH(e){this._INTERVAL_LENGTH=e},get inPosition(){return this._inPosition},set inPosition(e){this._inPosition=e},get outPosition(){return this._outPosition},set outPosition(e){this._outPosition=e},get canvas(){return this._canvas},set canvas(e){this._canvas=e},get footPrintsTimer(){return this._footPrintsTimer},set footPrintsTimer(e){this._footPrintsTimer=e},get footPrintsData(){return this._footPrintsData},set footPrintsData(e){this._footPrintsData=e},getAlignment:function(){return"right"},getSubclass:function(){return"footPrints"},getIconClass:function(){return"icon-stats"},getIndex:function(){return 590},getDefaultToolTip:function(){return base.dictionary.translate("Show statistics")},getName:function(){return"es.upv.paella.footprintsPlugin"},getButtonType:function(){return paella.ButtonPlugin.type.timeLineButton},setup:function(){var e=this;switch(paella.events.bind(paella.events.timeUpdate,function(t){e.onTimeUpdate()}),this.config.skin){case"custom":this.fillStyle=this.config.fillStyle,this.strokeStyle=this.config.strokeStyle;break;case"dark":this.fillStyle="#727272",this.strokeStyle="#424242";break;case"light":default:this.fillStyle="#d8d8d8",this.strokeStyle="#ffffff"}},checkEnabled:function(e){e(!paella.player.isLiveStream())},buildContent:function(e){var t=document.createElement("div");t.className="footPrintsContainer",this.canvas=document.createElement("canvas"),this.canvas.id="footPrintsCanvas",this.canvas.className="footPrintsCanvas",t.appendChild(this.canvas),e.appendChild(t)},onTimeUpdate:function(){var e=this;paella.player.videoContainer.currentTime().then(function(t){var n=Math.round(t+paella.player.videoContainer.trimStart());e.inPosition<=n&&n<=e.inPosition+e.INTERVAL_LENGTH?(e.outPosition=n,e.inPosition+e.INTERVAL_LENGTH===e.outPosition&&(e.trackFootPrint(e.inPosition,e.outPosition),e.inPosition=e.outPosition)):(e.trackFootPrint(e.inPosition,e.outPosition),e.inPosition=n,e.outPosition=n)})},trackFootPrint:function(e,t){var n={in:e,out:t};paella.data.write("footprints",{id:paella.initDelegate.getId()},n)},willShowContent:function(){var e=this;this.loadFootprints(),this.footPrintsTimer=new base.Timer(function(t){e.loadFootprints()},5e3),this.footPrintsTimer.repeat=!0},didHideContent:function(){null!=this.footPrintsTimer&&(this.footPrintsTimer.cancel(),this.footPrintsTimer=null)},loadFootprints:function(){var e=this;paella.data.read("footprints",{id:paella.initDelegate.getId()},function(t,n){var a={};paella.player.videoContainer.duration().then(function(n){for(var i=Math.floor(paella.player.videoContainer.trimStart()),r=-1,o=0,s=0;si&&(i=e[t]);for(this.canvas.setAttribute("width",n),this.canvas.setAttribute("height",i),a.clearRect(0,0,this.canvas.width,this.canvas.height),a.fillStyle=this.fillStyle,a.strokeStyle=this.strokeStyle,a.lineWidth=2,a.webkitImageSmoothingEnabled=!1,a.mozImageSmoothingEnabled=!1,t=0;t0&&(t.buttons[i].className=e,i--,n>p&&(a=c-d),i==c*(n-1)-1-a&&0!=i&&(t.navButtons.left.scrollContainer.scrollLeft-=105*c,--n),this.hiResFrame&&t.removeHiResFrame(),base.userAgent.browser.IsMobileVersion||t.buttons[i].frameControl.onMouseOver(null,t.buttons[i].frameData),e=t.buttons[i].className,t.buttons[i].className="frameControlItem selected"):u.keyCode==l?i=0&&(t.buttons[i].className=e),i++,1==n&&(a=0),i==c*n-a&&(t.navButtons.left.scrollContainer.scrollLeft+=105*c,++n),this.hiResFrame&&t.removeHiResFrame(),base.userAgent.browser.IsMobileVersion||t.buttons[i].frameControl.onMouseOver(null,t.buttons[i].frameData),e=t.buttons[i].className,t.buttons[i].className="frameControlItem selected"):u.keyCode==r?(t.buttons[i].frameControl.onClick(null,t.buttons[i].frameData),e="frameControlItem current"):u.keyCode==o&&t.removeHiResFrame())})},buildContent:function(e){var t=this,n=this;this.frames=[];var a=document.createElement("div");a.className="frameControlContainer",n.contx=a;var i=document.createElement("div");i.className="frameControlContent",this.navButtons={left:document.createElement("div"),right:document.createElement("div")},this.navButtons.left.className="frameControl navButton left",this.navButtons.right.className="frameControl navButton right";var r=this.getFrame(null);e.appendChild(this.navButtons.left),e.appendChild(a),a.appendChild(i),e.appendChild(this.navButtons.right),this.navButtons.left.scrollContainer=a,$(this.navButtons.left).click(function(e){this.scrollContainer.scrollLeft-=100}),this.navButtons.right.scrollContainer=a,$(this.navButtons.right).click(function(e){this.scrollContainer.scrollLeft+=100}),i.appendChild(r);var o=$(r).outerWidth(!0);i.innerHTML="",$(window).mousemove(function(e){($(i).offset().top>e.pageY||!$(i).is(":visible")||$(i).offset().top+$(i).height()=2&&o.addElement(n,o.getSlaveRect()),o.enableBackgroundMode(),this.hiResFrame=n;break;case"master":o.addElement(n,o.getMasterRect()),o.enableBackgroundMode(),this.hiResFrame=n;break;case"slave":var s;(s=paella.initDelegate.initParams.videoLoader.streams).length>=2&&(o.addElement(n,o.getSlaveRect()),o.enableBackgroundMode(),this.hiResFrame=n)}},removeHiResFrame:function(){var e=paella.player.videoContainer.overlayContainer;this.hiResFrame&&e.removeElement(this.hiResFrame),e.disableBackgroundMode(),this._img=null},updateFrameVisibility:function(e,t,n){var a;if(e)for(a=0;aa+1&&this.frames[a+1].frameData.time>t?$(i).show():$(i).hide():r.time>n?$(i).hide():$(i).show()}else for(a=0;a',base.userAgent.browser.IsMobileVersion||$(n).mouseover(function(e){this.frameControl.onMouseOver(e,this.frameData)}),$(n).mouseout(function(e){this.frameControl.onMouseOut(e,this.frameData)}),$(n).click(function(e){this.frameControl.onClick(e,this.frameData)})}return n},onMouseOver:function(e,t){var n=paella.initDelegate.initParams.videoLoader.frameList[t.time];if(n){var a=n.url;this._img?(this._img.setAttribute("src",a),this._caption.innerHTML=n.caption||""):this.showHiResFrame(a,n.caption)}null!=this._searchTimer&&clearTimeout(this._searchTimer)},onMouseOut:function(e,t){var n=this;this._searchTimer=setTimeout(function(e){return n.removeHiResFrame()},this._searchTimerTime)},onClick:function(e,t){paella.player.videoContainer.trimming().then(function(e){var n=e.enabled?t.time-e.start:t.time;n>0?paella.player.videoContainer.seekToTime(n+1):paella.player.videoContainer.seekToTime(0)})},onTimeUpdate:function(e){for(var t=null,n=0;n0)},action:function(e){var t=base.dictionary.currentLanguage(),n=this.config&&this.config.langs||[],a=n.indexOf(t);a<0&&(a=0);var i="resources/style/help/help_"+n[a]+".html";base.userAgent.browser.IsMobileVersion?window.open(i):paella.messageBox.showFrame(i)}},{},e)}(paella.ButtonPlugin)}),Class("paella.HLSPlayer",paella.Html5Video,{initialize:function(e,t,n,a,i,r){this.parent(e,t,n,a,i,r,"hls")},_loadDeps:function(){return new Promise(function(e,t){window.$paella_hls?e(window.$paella_hls):require(["resources/deps/hls.min.js"],function(t){window.$paella_hls=t,e(window.$paella_hls)})})},allowZoom:function(){return!0},load:function(){var e=this;if(this._posterFrame&&this.video.setAttribute("poster",this._posterFrame),base.userAgent.system.iOS||base.userAgent.browser.Safari)return this.parent();var t=this;return new Promise(function(n,a){var i=e._stream.sources.hls;i&&i.length>0?(i=i[0],e._loadDeps().then(function(e){e.isSupported()&&(t._hls=new e,t._hls.loadSource(i.src),t._hls.attachMedia(t.video),t._hls.on(e.Events.LEVEL_SWITCHED,function(e,n){t.qualityIndex=n.level,t.setQuality(n.level)}),t._hls.on(e.Events.ERROR,function(n,a){if(a.fatal)switch(a.type){case e.ErrorTypes.NETWORK_ERROR:base.log.error("paella.HLSPlayer: Fatal network error encountered, try to recover"),t._hls.startLoad();break;case e.ErrorTypes.MEDIA_ERROR:base.log.error("paella.HLSPlayer: Fatal media error encountered, try to recover"),t._hls.recoverMediaError();break;default:base.log.error("paella.HLSPlayer: Fatal Error. Can not recover"),t._hls.destroy()}}),t._hls.on(e.Events.MANIFEST_PARSED,function(){t._deferredAction(function(){n()})}))})):a(new Error("Invalid source"))})},getQualities:function(){var e=this;if(base.userAgent.system.iOS||base.userAgent.browser.Safari)return new Promise(function(e,t){e([{index:0,res:"",src:"",toString:function(){return"auto"},shortLabel:function(){return"auto"},compare:function(e){return 0}}])});var t=this;return new Promise(function(n){e._qualities||(t._qualities=[],t._hls.levels.forEach(function(e,n){t._qualities.push(t._getQualityObject(n,{index:n,res:{w:e.width,h:e.height},bitrate:e.bitrate}))})),n(t._qualities)})},printQualityes:function(){var e=this;return new Promise(function(t,n){e.getCurrentQuality().then(function(t){return e.getNextQuality()}).then(function(e){t()})})},setQuality:function(e){if(base.userAgent.system.iOS||base.userAgent.browser.Safari)return Promise.resolve();if(null!==e){try{this.qualityIndex=e,this._hls.nextLevel=e}catch(e){}return Promise.resolve()}return Promise.resolve()},getNextQuality:function(){var e=this;return new Promise(function(t,n){var a=e._hls.nextLevel;t(e._qualities[a])})},getCurrentQuality:function(){var e=this;return base.userAgent.system.iOS||base.userAgent.browser.Safari?Promise.resolve(0):(this.getNextQuality(),new Promise(function(t,n){var a=void 0==e.qualityIndex?e._hls.currentLevel:e.qualityIndex;t(e._qualities[a])}))}}),Class("paella.videoFactories.HLSVideoFactory",{isStreamCompatible:function(e){void 0===paella.videoFactories.HLSVideoFactory.s_instances&&(paella.videoFactories.HLSVideoFactory.s_instances=0);try{if(paella.videoFactories.HLSVideoFactory.s_instances>0&&base.userAgent.system.iOS)return!1;for(var t in e.sources)if("hls"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return++paella.videoFactories.HLSVideoFactory.s_instances,new paella.HLSPlayer(e,t,n.x,n.y,n.w,n.h)}}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{isEditorVisible:function(){return null!=paella.editor.instance},getIndex:function(){return 10},getSubclass:function(){return"liveIndicator"},getAlignment:function(){return"right"},getDefaultToolTip:function(){return base.dictionary.translate("This video is a live stream")},getName:function(){return"es.upv.paella.liveStreamingIndicatorPlugin"},checkEnabled:function(e){e(paella.player.isLiveStream())},setup:function(){},action:function(e){paella.messageBox.showMessage(base.dictionary.translate("Live streaming mode: This is a live video, so, some capabilities of the player are disabled"))}},{},e)}(paella.VideoOverlayButtonPlugin)}),Class("paella.MpegDashVideo",paella.Html5Video,{_posterFrame:null,_player:null,initialize:function(e,t,n,a,i,r){this.parent(e,t,n,a,i,r)},_loadDeps:function(){return new Promise(function(e,t){window.$paella_mpd?e(window.$paella_mpd):require(["resources/deps/dash.all.js"],function(){window.$paella_mpd=!0,e(window.$paella_mpd)})})},_getQualityObject:function(e,t,n){var a=n.length,i=Math.round(100*t/a),r=0==t?"min":t==a-1?"max":i+"%";return{index:t,res:{w:null,h:null},bitrate:e.bitrate,src:null,toString:function(){return i},shortLabel:function(){return r},compare:function(e){return this.bitrate-e.bitrate}}},load:function(){var e=this,t=this;return new Promise(function(n,a){var i=e._stream.sources.mpd;i&&i.length>0?(i=i[0],e._loadDeps().then(function(){var e=dashjs.MediaPlayer().create();e.initialize(t.video,i.src,!0),e.getDebug().setLogToBrowserConsole(!1),t._player=e,e.on(dashjs.MediaPlayer.events.STREAM_INITIALIZED,function(a,i){e.getBitrateInfoListFor("video");t._deferredAction(function(){t._firstPlay||(t._player.pause(),t._firstPlay=!0),n()})})})):a(new Error("Invalid source"))})},supportAutoplay:function(){return!0},getQualities:function(){var e=this;return new Promise(function(t){e._deferredAction(function(){e._qualities||(e._qualities=[],e._player.getBitrateInfoListFor("video").sort(function(e,t){return e.bitrate-t.bitrate}).forEach(function(t,n,a){e._qualities.push(e._getQualityObject(t,n,a))}),e.autoQualityIndex=e._qualities.length,e._qualities.push({index:e.autoQualityIndex,res:{w:null,h:null},bitrate:-1,src:null,toString:function(){return"auto"},shortLabel:function(){return"auto"},compare:function(e){return this.bitrate-e.bitrate}})),t(e._qualities)})})},setQuality:function(e){var t=this;return new Promise(function(n,a){var i=t._player.getQualityFor("video");e==t.autoQualityIndex?(t._player.setAutoSwitchQuality(!0),n()):e!=i?(t._player.setAutoSwitchQuality(!1),t._player.off(dashjs.MediaPlayer.events.METRIC_CHANGED),t._player.on(dashjs.MediaPlayer.events.METRIC_CHANGED,function(e,a){"metricchanged"==e.type&&i!=t._player.getQualityFor("video")&&(i=t._player.getQualityFor("video"),n())}),t._player.setQualityFor("video",e)):n()})},getCurrentQuality:function(){var e=this;return new Promise(function(t,n){if(e._player.getAutoSwitchQuality())t({index:e.autoQualityIndex,res:{w:null,h:null},bitrate:-1,src:null,toString:function(){return"auto"},shortLabel:function(){return"auto"},compare:function(e){return this.bitrate-e.bitrate}});else{var a=e._player.getQualityFor("video");t(e._getQualityObject(e._qualities[a],a,e._player.getBitrateInfoListFor("video")))}})},unFreeze:function(){return paella_DeferredNotImplemented()},freeze:function(){return paella_DeferredNotImplemented()},unload:function(){return this._callUnloadEvent(),paella_DeferredNotImplemented()}}),Class("paella.videoFactories.MpegDashVideoFactory",{isStreamCompatible:function(e){try{if(base.userAgent.system.iOS)return!1;for(var t in e.sources)if("mpd"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return++paella.videoFactories.Html5VideoFactory.s_instances,new paella.MpegDashVideo(e,t,n.x,n.y,n.w,n.h)}}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"showMultipleQualitiesPlugin"},getIconClass:function(){return"icon-screen"},getIndex:function(){return 2030},getMinWindowSize:function(){return 550},getName:function(){return"es.upv.paella.multipleQualitiesPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Change video quality")},closeOnMouseOut:function(){return!0},checkEnabled:function(e){var t=this;this._available=[],paella.player.videoContainer.getQualities().then(function(n){t._available=n,e(n.length>1)})},setup:function(){var e=this;this.setQualityLabel(),paella.events.bind(paella.events.qualityChanged,function(t){return e.setQualityLabel()})},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},buildContent:function(e){var t=this;this._available.forEach(function(n){n.shortLabel();e.appendChild(t.getItemButton(n))})},getItemButton:function(e){var t=this,n=document.createElement("div");return paella.player.videoContainer.getCurrentQuality().then(function(a,i){var r=e.shortLabel();n.className=t.getButtonItemClass(r,e.index==a),n.id=r,n.innerHTML=r,n.data=e,$(n).click(function(e){$(".multipleQualityItem").removeClass("selected"),$(".multipleQualityItem."+this.data.toString()).addClass("selected"),paella.player.videoContainer.setQuality(this.data.index).then(function(){paella.player.controls.hidePopUp(this.getName()),this.setQualityLabel()})})}),n},setQualityLabel:function(){var e=this;paella.player.videoContainer.getCurrentQuality().then(function(t){e.setText(t.shortLabel())})},getButtonItemClass:function(e,t){return"multipleQualityItem "+e+(t?" selected":"")}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getIndex:function(){return 551},getAlignment:function(){return"right"},getSubclass:function(){return"PIPModeButton"},getIconClass:function(){return"icon-pip"},getName:function(){return"es.upv.paella.pipModePlugin"},checkEnabled:function(e){var t=paella.player.videoContainer.masterVideo().video;t&&t.webkitSetPresentationMode?e(!0):e(!1)},getDefaultToolTip:function(){return base.dictionary.translate("Set picture-in-picture mode.")},setup:function(){},action:function(e){var t=paella.player.videoContainer.masterVideo().video;"picture-in-picture"==t.webkitPresentationMode?t.webkitSetPresentationMode("inline"):t.webkitSetPresentationMode("picture-in-picture")}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).call(this),this.playIconClass="icon-play",this.pauseIconClass="icon-pause",this.playSubclass="playButton",this.pauseSubclass="pauseButton"},{getAlignment:function(){return"left"},getSubclass:function(){return this.playSubclass},getIconClass:function(){return this.playIconClass},getName:function(){return"es.upv.paella.playPauseButtonPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Play")},getIndex:function(){return 110},checkEnabled:function(e){e(!0)},setup:function(){var e=this;paella.player.playing()&&this.changeIconClass(this.playIconClass),paella.events.bind(paella.events.play,function(t){e.changeIconClass(e.pauseIconClass),e.changeSubclass(e.pauseSubclass),e.setToolTip(paella.dictionary.translate("Pause"))}),paella.events.bind(paella.events.pause,function(t){e.changeIconClass(e.playIconClass),e.changeSubclass(e.playSubclass),e.setToolTip(paella.dictionary.translate("Play"))})},action:function(e){paella.player.videoContainer.paused().then(function(e){e?paella.player.play():paella.player.pause()})}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).call(this),this.containerId="paella_plugin_PlayButtonOnScreen",this.container=null,this.enabled=!0,this.isPlaying=!1,this.showIcon=!0,this.firstPlay=!1},{checkEnabled:function(e){e(!paella.player.isLiveStream()||base.userAgent.system.Android||base.userAgent.system.iOS||!paella.player.videoContainer.supportAutoplay())},getIndex:function(){return 1010},getName:function(){return"es.upv.paella.playButtonOnScreenPlugin"},setup:function(){var e=this;this.container=document.createElement("div"),this.container.className="playButtonOnScreen",this.container.id=this.containerId,this.container.style.width="100%",this.container.style.height="100%",paella.player.videoContainer.domElement.appendChild(this.container),$(this.container).click(function(t){e.onPlayButtonClick()});var t=document.createElement("canvas");function n(){var n=jQuery(e.container).innerWidth(),a=jQuery(e.container).innerHeight();t.width=n,t.height=a;var i=n0&&(e='',e+=" "+this.score+" "+this.count+" "+base.dictionary.translate("votes")),this.scoreContainer.header.innerHTML="\n\t\t\t
\n\t\t\t\t

"+base.dictionary.translate("Video score")+":

\n\t\t\t\t
\n\t\t\t\t\t"+e+"\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t

"+base.dictionary.translate("Vote:")+"

\n\t\t\t
\n\t\t\t"},updateRateButtons:function(){if(this.scoreContainer.rateButtons.className="rateButtons",this.buttons=[],this.canVote){this.scoreContainer.rateButtons.innerHTML="";for(var e=0;e<5;++e){var t=this.getStarButton(e+1);this.buttons.push(t),this.scoreContainer.rateButtons.appendChild(t)}}else this.scoreContainer.rateButtons.innerHTML="
"+base.dictionary.translate("Login to vote")+"
";this.updateVote()},buildContent:function(e){this._domElement=e;var t=document.createElement("div");e.appendChild(t),t.className="rateContainerHeader",this.scoreContainer.header=t,this.updateHeader();var n=document.createElement("div");this.scoreContainer.rateButtons=n,e.appendChild(n),this.updateRateButtons()},getStarButton:function(e){var t=this,n=document.createElement("i");return n.data={score:e,active:!1},n.className="starButton glyphicon glyphicon-star-empty",$(n).click(function(e){t.vote(this.data.score)}),n},vote:function(e){var t=this;this.myScore=e;var n={mean:this.score,count:this.count,myScore:e,canVote:this.canVote};paella.data.write("rate",{id:paella.initDelegate.getId()},n,function(e){paella.data.read("rate",{id:paella.initDelegate.getId()},function(e,n){e&&"object"==$traceurRuntime.typeof(e)&&(t.score=Number(e.mean).toFixed(1),t.count=e.count,t.myScore=e.myScore,t.canVote=e.canVote),t.updateHeader(),t.updateRateButtons()})})},updateVote:function(){var e=this;this.buttons.forEach(function(t,n){t.className=n"+base.dictionary.translate("Please go to {0} and install it.").replace("{0}","http://www.adobe.com/go/getflash")+"
"+base.dictionary.translate("If the problem presist, contact us.");var i=document.createElement("a");i.setAttribute("href","http://www.adobe.com/go/getflash"),i.innerHTML='Obtener Adobe Flash Player',t.appendChild(n),t.appendChild(a),t.appendChild(i),paella.messageBox.showError(t.innerHTML)}});else{var i=document.createElement("div"),r=document.createElement("h3");r.innerHTML=base.dictionary.translate("Flash player needed");var o=document.createElement("div");o.innerHTML=base.dictionary.translate("You need at least Flash player 9 installed.")+"
"+base.dictionary.translate("Please go to {0} and install it.").replace("{0}","http://www.adobe.com/go/getflash");var s=document.createElement("a");s.setAttribute("href","http://www.adobe.com/go/getflash"),s.innerHTML='Obtener Adobe Flash Player',i.appendChild(r),i.appendChild(o),i.appendChild(s),paella.messageBox.showError(i.innerHTML)}return $("#"+a.id)[0]},_deferredAction:function(e){var t=this;return new Promise(function(n,a){t.ready?n(e()):$(t.swfContainer).bind("paella:flashvideoready",function(){t._ready=!0,n(e())})})},_getQualityObject:function(e,t){return{index:e,res:t.res,src:t.src,toString:function(){return this.res.w+"x"+this.res.h},shortLabel:function(){return this.res.h+"p"},compare:function(e){return this.res.w*this.res.h-e.res.w*e.res.h}}},getVideoData:function(){var e=this,t=this;return new Promise(function(n,a){e._deferredAction(function(){var e={duration:t.flashVideo.duration(),currentTime:t.flashVideo.getCurrentTime(),volume:t.flashVideo.getVolume(),paused:t._paused,ended:t._ended,res:{w:t.flashVideo.getWidth(),h:t.flashVideo.getHeight()}};n(e)})})},setPosterFrame:function(e){if(null==this._posterFrame){this._posterFrame=e;var t=document.createElement("img");t.src=e,t.className="videoPosterFrameImage",t.alt="poster frame",this.domElement.appendChild(t),this._posterFrameElement=t}},setAutoplay:function(e){this._autoplay=e},load:function(){var e=this._stream.sources.rtmp;null===this._currentQuality&&this._videoQualityStrategy&&(this._currentQuality=this._videoQualityStrategy.getQualityIndex(e));var t=this._currentQuality0?n:0];return a=parseInt(a),this._localImages[a].url},createLoadingElement:function(e){var t=document.createElement("div");t.className="loader";t.innerHTML='',e.appendChild(t);var n=document.createElement("p");n.className="sBodyText",n.innerHTML=base.dictionary.translate("Searching")+"...",e.appendChild(n)},createNotResultsFound:function(e){var t=document.createElement("div");t.className="noResults",t.innerHTML=base.dictionary.translate("Sorry! No results found."),e.appendChild(t)},doSearch:function(e,t){var n=this;$(t).empty(),n.createLoadingElement(t),n.search(e,function(e,a){if($(t).empty(),!e)if(0==a.length)n.createNotResultsFound(t);else for(var i=0;i=.7&&$(r).addClass("greenScore"));var o=document.createElement("div");o.className="TimePicContainer";var s=document.createElement("img");s.className="sBodyPicture",s.src=n.getPreviewImage(a[i].time);var l=document.createElement("p");l.className="sBodyText",l.innerHTML=""+n.prettyTime(a[i].time)+""+a[i].content,o.appendChild(s),r.appendChild(o),r.appendChild(l),t.appendChild(r),r.setAttribute("sec",a[i].time),$(r).hover(function(){$(this).css("background-color","#faa166")},function(){$(this).removeAttr("style")}),$(r).click(function(){var e=$(this).attr("sec");paella.player.videoContainer.seekToTime(e),paella.player.play()})}})},buildContent:function(e){var t=this,n=document.createElement("div");n.className="searchPluginContainer";var a=document.createElement("div");a.className="searchBody",n.appendChild(a),t._searchBody=a;var i=document.createElement("div");i.className="searchBar",n.appendChild(i);var r=document.createElement("input");r.className="searchBarInput",r.type="text",r.id="searchBarInput",r.name="searchString",r.placeholder=base.dictionary.translate("Search"),i.appendChild(r),$(r).change(function(){var e=$(r).val();null!=t._searchTimer&&t._searchTimer.cancel(),""!=e&&t.doSearch(e,a)}),$(r).keyup(function(e){if(13!=e.keyCode){var n=$(r).val();null!=t._searchTimer&&t._searchTimer.cancel(),""!=n?t._searchTimer=new base.Timer(function(e){t.doSearch(n,a)},t._searchTimerTime):$(t._searchBody).empty()}}),$(r).focus(function(){paella.keyManager.enabled=!1}),$(r).focusout(function(){paella.keyManager.enabled=!0}),e.appendChild(n)}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"showSocialPluginButton"},getIconClass:function(){return"icon-social"},getIndex:function(){return 560},getMinWindowSize:function(){return 600},getName:function(){return"es.upv.paella.socialPlugin"},checkEnabled:function(e){e(!0)},getDefaultToolTip:function(){return base.dictionary.translate("Share this video")},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},closeOnMouseOut:function(){return!0},setup:function(){if(this.buttonItems=null,this.socialMedia=null,this.buttons=[],this.selected_button=null,"es"==base.dictionary.currentLanguage()){base.dictionary.addDictionary({"Custom size:":"Tamaño personalizado:","Choose your embed size. Copy the text and paste it in your html page.":"Elija el tamaño del video a embeber. Copie el texto y péguelo en su página html.","Width:":"Ancho:","Height:":"Alto:"})}var e=this,t=13,n=38,a=40;$(this.button).keyup(function(i){e.isPopUpOpen()&&(i.keyCode==n?e.selected_button>0&&(e.selected_button=0&&(e.buttons[e.selected_button].className="socialItemButton "+e.buttons[e.selected_button].data.mediaData),e.selected_button++,e.buttons[e.selected_button].className=e.buttons[e.selected_button].className+" selected"):i.keyCode==t&&e.onItemClick(e.buttons[e.selected_button].data.mediaData))})},buildContent:function(e){var t=this;this.buttonItems={},this.socialMedia=["facebook","twitter","embed"],this.socialMedia.forEach(function(n){var a=t.getSocialMediaItemButton(n);t.buttonItems[t.socialMedia.indexOf(n)]=a,e.appendChild(a),t.buttons.push(a)}),this.selected_button=this.buttons.length},getSocialMediaItemButton:function(e){var t=document.createElement("div");return t.className="socialItemButton "+e,t.id=e+"_button",t.data={mediaData:e,plugin:this},$(t).click(function(e){this.data.plugin.onItemClick(this.data.mediaData)}),t},onItemClick:function(e){var t=this.getVideoUrl();switch(e){case"twitter":window.open("http://twitter.com/home?status="+t);break;case"facebook":window.open("http://www.facebook.com/sharer.php?u="+t);break;case"embed":this.embedPress()}paella.player.controls.hidePopUp(this.getName())},getVideoUrl:function(){return document.location.href},embedPress:function(){var e=document.location.protocol+"//"+document.location.host,t=document.location.pathname.split("/");t.length>0&&(t[t.length-1]="embed.html");var n=paella.initDelegate.getId(),a=e+t.join("/")+"?id="+n,i="
"+("
620x349
540x304
460x259
380x214
300x169
"+base.dictionary.translate("Custom size:")+"
"+base.dictionary.translate("Width:")+"
"+base.dictionary.translate("Height:")+"
")+"
"+base.dictionary.translate("Choose your embed size. Copy the text and paste it in your html page.")+"
";paella.messageBox.showMessage(i,{closeButton:!0,width:"750px",height:"210px",onClose:function(){}});var r=$("#social_embed_width-input")[0],o=$("#social_embed_height-input")[0];r.onkeyup=function(e){var t=parseInt(r.value),n=parseInt(o.value);isNaN(t)?r.value="":t<300?$("#social_embed-textarea")[0].value="Embed width too low. The minimum value is a width of 300.":(isNaN(n)&&(n=(t/(16/9)).toFixed(),o.value=n),$("#social_embed-textarea")[0].value='')};for(var s=$(".embedSizeButton"),l=0;l'}}}}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.test.videoLoadPlugin"},checkEnabled:function(e){if(this.startTime=0,this.endTime=0,this.startTime=Date.now(),"es"==base.dictionary.currentLanguage()){base.dictionary.addDictionary({"Video loaded in {0} seconds":"Video cargado en {0} segundos"})}e(!0)},getEvents:function(){return[paella.events.loadComplete]},onEvent:function(e,t){switch(e){case paella.events.loadComplete:this.onLoadComplete()}},onLoadComplete:function(){this.endTime=Date.now();var e=(this.endTime-this.startTime)/1e3;this.showOverlayMessage(base.dictionary.translate("Video loaded in {0} seconds").replace(/\{0\}/g,e))},showOverlayMessage:function(e){var t=paella.player.videoContainer.overlayContainer,n=document.createElement("div");n.className="videoLoadTestOverlay";var a=document.createElement("div");a.className="btn",a.innerHTML="X",a.onclick=function(){t.removeElement(n)};var i=document.createElement("div");i.className="videoLoadTest",i.innerHTML=e,i.appendChild(a),n.appendChild(i),t.addElement(n,{left:40,top:50,width:430,height:80})}},{},e)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"themeChooserPlugin"},getIconClass:function(){return"icon-paintbrush"},getIndex:function(){return 2030},getMinWindowSize:function(){return 600},getName:function(){return"es.upv.paella.themeChooserPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Change theme")},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},checkEnabled:function(e){this.currentUrl=null,this.currentMaster=null,this.currentSlave=null,this.availableMasters=[],this.availableSlaves=[],paella.player.config.skin&&paella.player.config.skin.available&&paella.player.config.skin.available instanceof Array&&paella.player.config.skin.available.length>0?e(!0):e(!1)},buildContent:function(e){var t=this;paella.player.config.skin.available.forEach(function(n){var a=document.createElement("div");a.className="themebutton",a.innerHTML=n.replace("-"," ").replace("_"," "),$(a).click(function(e){paella.utils.skin.set(n),paella.player.controls.hidePopUp(t.getName())}),e.appendChild(a)})}},{},e)}(paella.ButtonPlugin)}),paella.addDataDelegate("cameraTrack",function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{read:function(e,t,n){var a=paella.player.videoLoader.getVideoUrl();a?(a+="trackhd.json",paella.utils.ajax.get({url:a},function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}e.positions.sort(function(e,t){return e.time-t.time}),n(e)},function(){return n(null)})):n(null)},write:function(e,t,n,a){},remove:function(e,t,n){}},{},e)}(paella.DataDelegate)}),function(){var e=null;function t(e,t){var n=t?1e3*(t.time-e.time):100;n>2e3&&(n=2e3);var a=this._videoData.originalWidth/this._videoData.width,i=e&&e.rect||[0,0],r=i[0]/this._videoData.originalWidth,o=(i[1]+this._videoData.originalHeight/2)/this._videoData.originalHeight;paella.player.videoContainer.masterVideo().setZoom(100*a,r*a*100,100*(o*a-1),n)}paella.addPlugin(function(){return function(n){return $traceurRuntime.createClass(function t(){$traceurRuntime.superConstructor(t).call(this),e=this,this._videoData={},this._trackData=[],this._enabled=!0},{checkEnabled:function(e){var t=this;paella.data.read("cameraTrack",{id:paella.initDelegate.getId()},function(n){n?(t._videoData.width=n.width,t._videoData.height=n.height,t._videoData.originalWidth=n.originalWidth,t._videoData.originalHeight=n.originalHeight,t._trackData=n.positions,t._enabled=!0):t._enabled=!1,e(t._enabled)})},get enabled(){return this._enabled},set enabled(e){this._enabled=e,this._enabled&&t.apply(this,[this._lastPosition])},getName:function(){return"es.upv.paella.track4kPlugin"},getEvents:function(){return[paella.events.timeupdate,paella.events.play,paella.events.seekToTime]},onEvent:function(e,t){this._trackData.length&&(e==paella.events.play||(e==paella.events.timeupdate?this.updateZoom(t.currentTime):e==paella.events.seekToTime&&this.seekTo(t.newPosition)))},updateZoom:function(e){var n=function(e){var t=null;return e=Math.round(e),this._trackData.some(function(n,a){return n.time==e&&(t=n),null!=t}),t}.apply(this,[e]),a=function(e){var t=-1;return e=Math.round(e),this._trackData.some(function(n,a){return n.time>=e&&(t=a),-1!=t}),this._trackData.length>t+1?this._trackData[t+1]:null}.apply(this,[e]);n&&this._lastPosition!=n&&this._enabled&&(this._lastPosition=n,t.apply(this,[n,a]))},seekTo:function(e){var n=function(e){var t=this._trackData[0];return e=Math.round(e),this._trackData.some(function(n,a){return n.time==e||(t=n,!1)}),t}.apply(this,[e]);n&&this._enabled&&(this._lastPosition=n,t.apply(this,[n]))}},{},n)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(t){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"videoZoomToolbar"},getIconClass:function(){return"icon-screen"},closeOnMouseOut:function(){return!0},getIndex:function(){return 2030},getMinWindowSize:function(){return paella.player.config.player&&paella.player.config.player.videoZoom&&paella.player.config.player.videoZoom.minWindowSize||600},getName:function(){return"es.upv.paella.videoZoomTrack4kPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Set video zoom")},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},checkEnabled:function(t){var n=this;paella.player.videoContainer.videoPlayers().then(function(a){var i=paella.player.config.plugins.list[n.getName()],r=i.targetStreamIndex,o=i.autoModeByDefault;n.targetPlayer=a.length>r?a[r]:null,e.enabled=o,t(paella.player.config.player.videoZoom.enabled&&n.targetPlayer&&n.targetPlayer.allowZoom())})},buildContent:function(t){var n=this,a=function(){e.enabled?n.changeIconClass("icon-mini-videocamera"):n.changeIconClass("icon-mini-zoom-in")};function i(e,t,n){var a=document.createElement("div");return a.className="videoZoomToolbarItem "+e,a.innerHTML=n||'',$(a).click(t),a}paella.events.bind(paella.events.videoZoomChanged,function(e,t){a()}),a(),t.appendChild(i("zoom-in",function(e){n.zoomIn()})),t.appendChild(i("zoom-out",function(e){n.zoomOut()})),t.appendChild(i("zoom-auto",function(e){n.zoomAuto(),paella.player.controls.hidePopUp(n.getName())},"auto"))},zoomIn:function(){e.enabled=!1,this.targetPlayer.zoomIn()},zoomOut:function(){e.enabled=!1,this.targetPlayer.zoomOut()},zoomAuto:function(){e.enabled=!0}},{},t)}(paella.ButtonPlugin)})}(),paella.plugins.translectures={},Class("paella.captions.translectures.Caption",paella.captions.Caption,{initialize:function(e,t,n,a,i,r){this.parent(e,t,n,a,r),this._captionsProvider="translecturesCaptionsProvider",this._editURL=i},canEdit:function(e){e(!1,void 0!=this._editURL&&""!=this._editURL)},goToEdit:function(){var e=this;paella.player.auth.userData().then(function(t){1==t.isAnonymous?e.askForAnonymousOrLoginEdit():e.doEdit()})},doEdit:function(){window.location.href=this._editURL},doLoginAndEdit:function(){paella.player.auth.login(this._editURL)},askForAnonymousOrLoginEdit:function(){var e=this,t=document.createElement("div");t.className="translecturesCaptionsMessageBox";var n=document.createElement("div");n.className="title",n.innerHTML=base.dictionary.translate("You are trying to modify the transcriptions, but you are not Logged in!"),t.appendChild(n);var a=document.createElement("div");a.className="authMethodsContainer",t.appendChild(a);var i=document.createElement("div");i.className="authMethod",a.appendChild(i);var r=document.createElement("a");r.href="#",r.style.color="#004488",i.appendChild(r);var o=document.createElement("img");o.src="resources/style/caption_mlangs_anonymous.png",o.alt="Anonymous",o.style.height="100px",r.appendChild(o);var s=document.createElement("p");s.innerHTML=base.dictionary.translate("Continue editing the transcriptions anonymously"),r.appendChild(s),$(r).click(function(){e.doEdit()}),(i=document.createElement("div")).className="authMethod",a.appendChild(i),(r=document.createElement("a")).href="#",r.style.color="#004488",i.appendChild(r),(o=document.createElement("img")).src="resources/style/caption_mlangs_lock.png",o.alt="Login",o.style.height="100px",r.appendChild(o),(s=document.createElement("p")).innerHTML=base.dictionary.translate("Log in and edit the transcriptions"),r.appendChild(s),$(r).click(function(){e.doLoginAndEdit()}),paella.messageBox.showElement(t)}}),Class("paella.plugins.translectures.CaptionsPlugIn",paella.EventDrivenPlugin,{getName:function(){return"es.upv.paella.translecture.captionsPlugin"},getEvents:function(){return[]},onEvent:function(e,t){},checkEnabled:function(e){var t=this,n=paella.player.videoIdentifier;if(void 0==this.config.tLServer||void 0==this.config.tLdb)base.log.warning(this.getName()+" plugin not configured!"),e(!1);else{var a=(this.config.tLServer+"/langs?db=${tLdb}&id=${videoId}").replace(/\$\{videoId\}/gi,n).replace(/\$\{tLdb\}/gi,this.config.tLdb);base.ajax.get({url:a},function(i,r,o,s){0==i.scode?(i.langs.forEach(function(e){var a,i=(t.config.tLServer+"/dfxp?format=1&pol=0&db=${tLdb}&id=${videoId}&lang=${tl.lang.code}").replace(/\$\{videoId\}/gi,n).replace(/\$\{tLdb\}/gi,t.config.tLdb).replace(/\$\{tl.lang.code\}/gi,e.code);t.config.tLEdit&&(a=t.config.tLEdit.replace(/\$\{videoId\}/gi,n).replace(/\$\{tLdb\}/gi,t.config.tLdb).replace(/\$\{tl.lang.code\}/gi,e.code));var r=e.value;switch(e.type){case 0:r+=" ("+paella.dictionary.translate("Auto")+")";break;case 1:r+=" ("+paella.dictionary.translate("Under review")+")"}var o=new paella.captions.translectures.Caption(e.code,"dfxp",i,{code:e.code,txt:r},a);paella.captions.addCaptions(o)}),e(!1)):(base.log.debug("Error getting available captions from translectures: "+a),e(!1))},function(t,n,i){base.log.debug("Error getting available captions from translectures: "+a),e(!1)})}}}),new paella.plugins.translectures.CaptionsPlugIn,paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.usertracking.elasticsearchSaverPlugin"},checkEnabled:function(e){this.type="userTrackingSaverPlugIn",this._url=this.config.url,this._index=this.config.index||"paellaplayer",this._type=this.config.type||"usertracking";var t=!0;void 0==this._url&&(t=!1,base.log.debug("No ElasticSearch URL found in config file. Disabling ElasticSearch PlugIn")),e(t)},log:function(e,t){var n=t;"object"!=$traceurRuntime.typeof(n)&&(n={value:n}),paella.player.videoContainer.currentTime().then(function(t){var a={date:new Date,video:paella.initDelegate.getId(),playing:!paella.player.videoContainer.paused(),time:parseInt(t+paella.player.videoContainer.trimStart()),event:e,params:n};paella.ajax.post({url:this._url+"/"+this._index+"/"+this._type+"/",params:JSON.stringify(a)})})}},{},e)}(paella.userTracking.SaverPlugIn)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.usertracking.GoogleAnalyticsSaverPlugin"},checkEnabled:function(e){var t,n,a,i,r,o,s=this.config.trackingID,l=this.config.domain||"auto";s?(base.log.debug("Google Analitycs Enabled"),t=window,n=document,a="script",i="__gaTracker",t.GoogleAnalyticsObject=i,t[i]=t[i]||function(){(t[i].q=t[i].q||[]).push(arguments)},t[i].l=1*new Date,r=n.createElement(a),o=n.getElementsByTagName(a)[0],r.async=1,r.src="//www.google-analytics.com/analytics.js",o.parentNode.insertBefore(r,o),__gaTracker("create",s,l),__gaTracker("send","pageview"),e(!0)):(base.log.debug("No Google Tracking ID found in config file. Disabling Google Analitycs PlugIn"),e(!1))},log:function(e,t){if(void 0===this.config.category||!0===this.config.category){var n=this.config.category||"PaellaPlayer",a=e,i="";try{i=JSON.stringify(t)}catch(e){}__gaTracker("send","event",n,a,i)}}},{},e)}(paella.userTracking.SaverPlugIn)});var _paq=_paq||[];function buildVideo360Canvas(e,t){var n=new(function(e){return $traceurRuntime.createClass(function e(t){$traceurRuntime.superConstructor(e).call(this),this.stream=t},{get video(){return this.texture?this.texture.video:null},loaded:function(){var e=this;return new Promise(function(t){var n=function(){e.video?t(e):setTimeout(n,100)};n()})},buildScene:function(){var e=this;this._root=new bg.scene.Node(this.gl,"Root node"),bg.base.Loader.RegisterPlugin(new bg.base.TextureLoaderPlugin),bg.base.Loader.RegisterPlugin(new bg.base.VideoTextureLoaderPlugin),bg.base.Loader.RegisterPlugin(new bg.base.VWGLBLoaderPlugin),bg.base.Loader.Load(this.gl,this.stream.src).then(function(t){e.texture=t;var n=bg.scene.PrimitiveFactory.Sphere(e.gl,1,50),a=new bg.scene.Node(e.gl);a.addComponent(n),n.getMaterial(0).texture=t,n.getMaterial(0).lightEmission=1,n.getMaterial(0).lightEmissionMaskInvert=!0,n.getMaterial(0).cullFace=!1,e._root.addChild(a),e.postRedisplay()});var t=new bg.scene.Node(this.gl,"Light");this._root.addChild(t),this._camera=new bg.scene.Camera;var n=new bg.scene.Node("Camera");n.addComponent(this._camera),n.addComponent(new bg.scene.Transform);var a=new bg.manipulation.OrbitCameraController;n.addComponent(a),a.maxPitch=90,a.minPitch=-90,a.maxDistance=0,a.minDistace=0,this._root.addChild(n)},init:function(){bg.Engine.Set(new bg.webgl1.Engine(this.gl)),this.buildScene(),this._renderer=bg.render.Renderer.Create(this.gl,bg.render.RenderPath.FORWARD),this._inputVisitor=new bg.scene.InputVisitor},frame:function(e){this.texture&&this.texture.update(),this._renderer.frame(this._root,e)},display:function(){this._renderer.display(this._root,this._camera)},reshape:function(e,t){this._camera.viewport=new bg.Viewport(0,0,e,t),this._camera.projection.perspective(60,this._camera.viewport.aspectRatio,.1,100)},mouseDown:function(e){this._inputVisitor.mouseDown(this._root,e)},mouseDrag:function(e){this._inputVisitor.mouseDrag(this._root,e),this.postRedisplay()},mouseWheel:function(e){this._inputVisitor.mouseWheel(this._root,e),this.postRedisplay()},touchStart:function(e){this._inputVisitor.touchStart(this._root,e)},touchMove:function(e){this._inputVisitor.touchMove(this._root,e),this.postRedisplay()},mouseUp:function(e){this._inputVisitor.mouseUp(this._root,e)},mouseMove:function(e){this._inputVisitor.mouseMove(this._root,e)},mouseOut:function(e){this._inputVisitor.mouseOut(this._root,e)},touchEnd:function(e){this._inputVisitor.touchEnd(this._root,e)}},{},e)}(bg.app.WindowController))(e),a=bg.app.MainLoop.singleton;return a.updateMode=bg.app.FrameUpdate.AUTO,a.canvas=t,a.run(n),n.loaded()}function buildVideo360ThetaCanvas(e,t){function n(e,t,n){var a,i,r=(a=((e+90)/180-1)*Math.PI,i=(.5-t/180)*Math.PI,new bg.Vector3(Math.cos(i)*Math.cos(a),Math.cos(i)*Math.sin(a),Math.sin(i))),o=function(e,t,n){var a=n;return n<-1?a=-1:n>1&&(a=1),new bg.Vector2(Math.atan2(t,e),Math.acos(a)/Math.PI)}(Math.sin(-.5*Math.PI)*r.z+Math.cos(-.5*Math.PI)*r.x,r.y,Math.cos(-.5*Math.PI)*r.z-Math.sin(-.5*Math.PI)*r.x),s=0===n?.883*o.y*Math.cos(o.x)*.5+.25:.883*(1-o.y)*Math.cos(-1*o.x+Math.PI)*.5+.75,l=0===n?.784888888888881*o.y*Math.sin(o.x)+.55555555555556:.784888888888881*(1-o.y)*Math.sin(-1*o.x+Math.PI)+.55555555555556;return new bg.Vector2(s,l)}var a=new(function(e){return $traceurRuntime.createClass(function e(t){$traceurRuntime.superConstructor(e).call(this),this.stream=t},{get video(){return this.texture?this.texture.video:null},loaded:function(){var e=this;return new Promise(function(t){var n=function(){e.video?t(e):setTimeout(n,100)};n()})},buildScene:function(){var e=this;this._root=new bg.scene.Node(this.gl,"Root node"),bg.base.Loader.RegisterPlugin(new bg.base.TextureLoaderPlugin),bg.base.Loader.RegisterPlugin(new bg.base.VideoTextureLoaderPlugin),bg.base.Loader.RegisterPlugin(new bg.base.VWGLBLoaderPlugin),bg.base.Loader.Load(this.gl,this.stream.src).then(function(t){e.texture=t;var a=function(e){var t=new bg.scene.Node(e),a=new bg.scene.Drawable;t.addComponent(a);for(var i=new bg.base.PolyList(e),r=[],o=[],s=[],l=0;l<=180;l+=5){for(var u=0;u<=360;u+=5)r.push(new bg.Vector3(Math.sin(Math.PI*l/180)*Math.sin(Math.PI*u/180)*1,1*Math.cos(Math.PI*l/180),Math.sin(Math.PI*l/180)*Math.cos(Math.PI*u/180)*1)),o.push(new bg.Vector3(0,0,-1));for(var c=0;c<=180;c+=5)s.push(n(c,l,0));for(var d=180;d<=360;d+=5)s.push(n(d,l,1))}function p(e,t,n,a,r,o,s,l,u){i.vertex.push(e.x),i.vertex.push(e.y),i.vertex.push(e.z),i.vertex.push(t.x),i.vertex.push(t.y),i.vertex.push(t.z),i.vertex.push(n.x),i.vertex.push(n.y),i.vertex.push(n.z),i.normal.push(a.x),i.normal.push(a.y),i.normal.push(a.z),i.normal.push(r.x),i.normal.push(r.y),i.normal.push(r.z),i.normal.push(o.x),i.normal.push(o.z),i.normal.push(o.z),i.texCoord0.push(s.x),i.texCoord0.push(s.y),i.texCoord0.push(l.x),i.texCoord0.push(l.y),i.texCoord0.push(u.x),i.texCoord0.push(u.y),i.index.push(i.index.length),i.index.push(i.index.length),i.index.push(i.index.length)}for(var h=0;h<36;h++)for(var m=0;m<72;m++){var f=73*h+m,g=m<36?74*h+m:74*h+m+1;s[g+0],s[g+1],s[g+74],s[g+1],s[g+75],s[g+74];var v=r[f+0],y=o[f+0],b=s[g+0],_=r[f+1],C=o[f+1],w=s[g+1],P=r[f+73],E=o[f+73],k=s[g+74],T=r[f+74],x=o[f+74],S=s[g+75];p(v,_,P,y,C,E,b,w,k),p(_,T,P,C,x,E,w,S,k)}i.build(),a.addPolyList(i);var I=bg.Matrix4.Scale(-1,1,1);return t.addComponent(new bg.scene.Transform(I)),t}(e.gl),i=a.component("bg.scene.Drawable");i.getMaterial(0).texture=t,i.getMaterial(0).lightEmission=1,i.getMaterial(0).lightEmissionMaskInvert=!0,i.getMaterial(0).cullFace=!1,e._root.addChild(a),e.postRedisplay()});var t=new bg.scene.Node(this.gl,"Light");this._root.addChild(t),this._camera=new bg.scene.Camera;var a=new bg.scene.Node("Camera");a.addComponent(this._camera),a.addComponent(new bg.scene.Transform);var i=new bg.manipulation.OrbitCameraController;a.addComponent(i),i.maxPitch=90,i.minPitch=-90,i.maxDistance=0,i.minDistace=0,this._root.addChild(a)},init:function(){bg.Engine.Set(new bg.webgl1.Engine(this.gl)),this.buildScene(),this._renderer=bg.render.Renderer.Create(this.gl,bg.render.RenderPath.FORWARD),this._inputVisitor=new bg.scene.InputVisitor},frame:function(e){this.texture&&this.texture.update(),this._renderer.frame(this._root,e)},display:function(){this._renderer.display(this._root,this._camera)},reshape:function(e,t){this._camera.viewport=new bg.Viewport(0,0,e,t),this._camera.projection.perspective(60,this._camera.viewport.aspectRatio,.1,100)},mouseDown:function(e){this._inputVisitor.mouseDown(this._root,e)},mouseDrag:function(e){this._inputVisitor.mouseDrag(this._root,e),this.postRedisplay()},mouseWheel:function(e){this._inputVisitor.mouseWheel(this._root,e),this.postRedisplay()},touchStart:function(e){this._inputVisitor.touchStart(this._root,e)},touchMove:function(e){this._inputVisitor.touchMove(this._root,e),this.postRedisplay()},mouseUp:function(e){this._inputVisitor.mouseUp(this._root,e)},mouseMove:function(e){this._inputVisitor.mouseMove(this._root,e)},mouseOut:function(e){this._inputVisitor.mouseOut(this._root,e)},touchEnd:function(e){this._inputVisitor.touchEnd(this._root,e)}},{},e)}(bg.app.WindowController))(e),i=bg.app.MainLoop.singleton;return i.updateMode=bg.app.FrameUpdate.AUTO,i.canvas=t,i.run(a),a.loaded()}function onYouTubeIframeAPIReady(){paella.youtubePlayerVars.apiReadyPromise.resolve()}paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.usertracking.piwikSaverPlugIn"},checkEnabled:function(e){this.config.tracker&&this.config.siteId?(_paq.push(["trackPageView"]),_paq.push(["enableLinkTracking"]),function(){var t=this.config.tracker;_paq.push(["setTrackerUrl",t+"/piwik.php"]),_paq.push(["setSiteId",this.config.siteId]);var n=document,a=n.createElement("script"),i=n.getElementsByTagName("script")[0];a.type="text/javascript",a.async=!0,a.defer=!0,a.src=t+"piwik.js",i.parentNode.insertBefore(a,i),e(!0)}()):e(!1)},log:function(e,t){var n=this.config.category||"PaellaPlayer",a=e,i="";try{i=JSON.stringify(t)}catch(e){}_paq.push(["trackEvent",n,a,i])}},{},e)}(paella.userTracking.SaverPlugIn)}),Class("paella.Video360",paella.VideoElementBase,{_posterFrame:null,_currentQuality:null,_autoplay:!1,_streamName:null,initialize:function(e,t,n,a,i,r,o){this.parent(e,t,"canvas",0,0,1280,720),this._streamName=o||"video360";var s=this;paella.player.videoContainer.disablePlayOnClick(),this._stream.sources[this._streamName]&&this._stream.sources[this._streamName].sort(function(e,t){return e.res.h-t.res.h}),this.video=null,new paella.Timer(function(e){s.canvasController&&s.canvasController.canvas.domElement},500).repeat=!0},defaultProfile:function(){return"chroma"},_setVideoElem:function(e){$(this.video).bind("progress",evtCallback),$(this.video).bind("loadstart",evtCallback),$(this.video).bind("loadedmetadata",evtCallback),$(this.video).bind("canplay",evtCallback),$(this.video).bind("oncanplay",evtCallback)},_loadDeps:function(){return new Promise(function(e,t){window.$paella_bg2e?defer.resolve(window.$paella_bg2e):paella.require(paella.baseUrl+"resources/deps/bg2e.js").then(function(){window.$paella_bg2e=bg,e(window.$paella_bg2e)}).catch(function(e){console.error(e.message),t()})})},_deferredAction:function(e){var t=this;return new Promise(function(n,a){t.video?n(e()):$(t.video).bind("canplay",function(){t._ready=!0,n(e())})})},_getQualityObject:function(e,t){return{index:e,res:t.res,src:t.src,toString:function(){return this.res.w+"x"+this.res.h},shortLabel:function(){return this.res.h+"p"},compare:function(e){return this.res.w*this.res.h-e.res.w*e.res.h}}},allowZoom:function(){return!1},getVideoData:function(){var e=this,t=this;return new Promise(function(n,a){e._deferredAction(function(){n({duration:t.video.duration,currentTime:t.video.currentTime,volume:t.video.volume,paused:t.video.paused,ended:t.video.ended,res:{w:t.video.videoWidth,h:t.video.videoHeight}})})})},setPosterFrame:function(e){this._posterFrame=e},setAutoplay:function(e){this._autoplay=e,e&&this.video&&this.video.setAttribute("autoplay",e)},load:function(){var e=this;return new Promise(function(t,n){e._loadDeps().then(function(){var a=e._stream.sources[e._streamName];null===e._currentQuality&&e._videoQualityStrategy&&(e._currentQuality=e._videoQualityStrategy.getQualityIndex(a));var i=e._currentQuality0&&base.userAgent.system.iOS)return!1;for(var t in e.sources)if("video360"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return paella.ChromaVideo._loaded=!0,++paella.videoFactories.Html5VideoFactory.s_instances,new paella.Video360(e,t,n.x,n.y,n.w,n.h)}}),Class("paella.Video360Theta",paella.VideoElementBase,{_posterFrame:null,_currentQuality:null,_autoplay:!1,_streamName:null,initialize:function(e,t,n,a,i,r,o){this.parent(e,t,"canvas",0,0,1280,720),this._streamName=o||"video360theta";var s=this;paella.player.videoContainer.disablePlayOnClick(),this._stream.sources[this._streamName]&&this._stream.sources[this._streamName].sort(function(e,t){return e.res.h-t.res.h}),this.video=null,new paella.Timer(function(e){s.canvasController&&s.canvasController.canvas.domElement},500).repeat=!0},defaultProfile:function(){return"chroma"},_setVideoElem:function(e){$(this.video).bind("progress",evtCallback),$(this.video).bind("loadstart",evtCallback),$(this.video).bind("loadedmetadata",evtCallback),$(this.video).bind("canplay",evtCallback),$(this.video).bind("oncanplay",evtCallback)},_loadDeps:function(){return new Promise(function(e,t){window.$paella_bg2e?defer.resolve(window.$paella_bg2e):paella.require(paella.baseUrl+"resources/deps/bg2e.js").then(function(){window.$paella_bg2e=bg,e(window.$paella_bg2e)}).catch(function(e){console.error(e.message),t()})})},_deferredAction:function(e){var t=this;return new Promise(function(n,a){t.video?n(e()):$(t.video).bind("canplay",function(){t._ready=!0,n(e())})})},_getQualityObject:function(e,t){return{index:e,res:t.res,src:t.src,toString:function(){return this.res.w+"x"+this.res.h},shortLabel:function(){return this.res.h+"p"},compare:function(e){return this.res.w*this.res.h-e.res.w*e.res.h}}},allowZoom:function(){return!1},getVideoData:function(){var e=this,t=this;return new Promise(function(n,a){e._deferredAction(function(){n({duration:t.video.duration,currentTime:t.video.currentTime,volume:t.video.volume,paused:t.video.paused,ended:t.video.ended,res:{w:t.video.videoWidth,h:t.video.videoHeight}})})})},setPosterFrame:function(e){this._posterFrame=e},setAutoplay:function(e){this._autoplay=e,e&&this.video&&this.video.setAttribute("autoplay",e)},load:function(){var e=this;return new Promise(function(t,n){e._loadDeps().then(function(){var a=e._stream.sources[e._streamName];null===e._currentQuality&&e._videoQualityStrategy&&(e._currentQuality=e._videoQualityStrategy.getQualityIndex(a));var i=e._currentQuality0&&base.userAgent.system.iOS)return!1;for(var t in e.sources)if("video360theta"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return paella.ChromaVideo._loaded=!0,++paella.videoFactories.Html5VideoFactory.s_instances,new paella.Video360Theta(e,t,n.x,n.y,n.w,n.h)}}),paella.addDataDelegate("metadata",function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{read:function(e,t,n){n(paella.player.videoLoader.getMetadata()[t],!0)},write:function(e,t,n,a){a({},!0)},remove:function(e,t,n){n({},!0)}},{},e)}(paella.DataDelegate)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getIndex:function(){return 10},getSubclass:function(){return"videoData"},getAlignment:function(){return"left"},getDefaultToolTip:function(){return""},checkEnabled:function(e){var t=paella.player.config.plugins.list["es.upv.paella.videoDataPlugin"],n=t&&t.excludeLocations||[],a=t&&t.excludeParentLocations||[],i=n.some(function(e){return RegExp(e,"i").test(location.href)});window!=window.parent&&(i=i||a.some(function(e){var t=RegExp(e,"i");try{return t.test(parent.location.href)}catch(e){return!1}})),e(!i)},setup:function(){var e=document.createElement("h1");e.innerHTML="",e.className="videoTitle",this.button.appendChild(e),paella.data.read("metadata","title",function(t){e.innerHTML=t})},action:function(e){},getName:function(){return"es.upv.paella.videoDataPlugin"}},{},e)}(paella.VideoOverlayButtonPlugin)}),paella.addPlugin(function(){var e=320,t=180;return function(n){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getIndex:function(){return 10},getSubclass:function(){return"videoZoom"},getAlignment:function(){return"right"},getDefaultToolTip:function(){return""},checkEnabled:function(e){e(!0)},setup:function(){var n=this;function a(){var e=$(".videoZoomButton"),t=$(".videoZoom");this._visible?(e.show(),t.show()):(e.hide(),t.hide())}this._thumbnails=[],this._visible=!1,paella.player.videoContainer.videoPlayers().then(function(i){i.forEach(function(i,r){i.allowZoom()&&(n._visible=i.zoomAvailable(),function(e){var t=e.parent.domElement,n=document.createElement("button");t.appendChild(n),n.className="videoZoomButton btn zoomIn",n.innerHTML='',$(n).on("mousedown",function(){paella.player.videoContainer.disablePlayOnClick(),e.zoomIn()}),$(n).on("mouseup",function(){setTimeout(function(){return paella.player.videoContainer.enablePlayOnClick()},10)}),n=document.createElement("button"),t.appendChild(n),n.className="videoZoomButton btn zoomOut",n.innerHTML='',$(n).on("mousedown",function(){paella.player.videoContainer.disablePlayOnClick(),e.zoomOut()}),$(n).on("mouseup",function(){setTimeout(function(){return paella.player.videoContainer.enablePlayOnClick()},10)})}.apply(n,[i]),i.supportsCaptureFrame().then(function(o){if(o){var s=document.createElement("div");s.className="zoom-container";var l=function(n){var a=document.createElement("canvas");return a.width=e,a.height=t,a.className="zoom-thumbnail",a.id="zoomContainer"+n,a}.apply(n,[r]),u=function(){var e=document.createElement("div");return e.className="zoom-rect",e}.apply(n);n.button.appendChild(s),s.appendChild(l),s.appendChild(u),$(s).hide(),n._thumbnails.push({player:i,thumbContainer:s,zoomRect:u,canvas:l}),a.apply(n)}}))})});var i=!1;paella.events.bind(paella.events.play,function(a){var r=function(){n._thumbnails.forEach(function(n){var a,i,r;i=(a=n).player,r=a.canvas,i.captureFrame().then(function(n){r.getContext("2d").drawImage(n.source,0,0,e,t)})}),i&&setTimeout(function(){r()},2e3)};i=!0,r()}),paella.events.bind(paella.events.pause,function(e){i=!1}),paella.events.bind(paella.events.videoZoomChanged,function(e,t){n._thumbnails.some(function(e){if(e.player==t.video){if(e.player.zoom>100){$(e.thumbContainer).show();var n=100*t.video.zoomOffset.x/t.video.zoom,a=100*t.video.zoomOffset.y/t.video.zoom,i=e.zoomRect;$(i).css({left:n+"%",top:a+"%",width:1e4/t.video.zoom+"%",height:1e4/t.video.zoom+"%"})}else $(e.thumbContainer).hide();return!0}})}),paella.events.bind(paella.events.zoomAvailabilityChanged,function(e,t){n._visible=t.available,a.apply(n)})},action:function(e){},getName:function(){return"es.upv.paella.videoZoomPlugin"}},{},n)}(paella.VideoOverlayButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"videoZoomToolbar"},getIconClass:function(){return"icon-screen"},getIndex:function(){return 2030},getMinWindowSize:function(){return paella.player.config.player&&paella.player.config.player.videoZoom&&paella.player.config.player.videoZoom.minWindowSize||600},getName:function(){return"es.upv.paella.videoZoomToolbarPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Change theme")},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},checkEnabled:function(e){var t=this;paella.player.videoContainer.videoPlayers().then(function(n){var a=paella.player.config.plugins.list["es.upv.paella.videoZoomToolbarPlugin"].targetStreamIndex;t.targetPlayer=n.length>a?n[a]:null,e(paella.player.config.player.videoZoom.enabled&&t.targetPlayer&&t.targetPlayer.allowZoom())})},buildContent:function(e){var t=this;function n(e,t){var n=document.createElement("div");return n.className="videoZoomToolbarItem "+e,n.innerHTML='',$(n).click(t),n}paella.events.bind(paella.events.videoZoomChanged,function(e,n){t.setText(Math.round(n.video.zoom)+"%")}),this.setText("100%"),e.appendChild(n("zoom-in",function(e){t.targetPlayer.zoomIn()})),e.appendChild(n("zoom-out",function(e){t.targetPlayer.zoomOut()}))}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"showViewModeButton"},getIconClass:function(){return"icon-presentation-mode"},getIndex:function(){return 540},getMinWindowSize:function(){return 300},getName:function(){return"es.upv.paella.viewModePlugin"},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},getDefaultToolTip:function(){return base.dictionary.translate("Change video layout")},checkEnabled:function(e){this.buttonItems=null,this.buttons=[],this.selected_button=null,this.active_profiles=null,this.active_profiles=this.config.activeProfiles,e(!paella.player.videoContainer.isMonostream)},closeOnMouseOut:function(){return!0},setup:function(){var e=this,t=13,n=38,a=40;paella.events.bind(paella.events.setProfile,function(t,n){e.onProfileChange(n.profileName)}),$(this.button).keyup(function(i){e.isPopUpOpen()&&(i.keyCode==n?e.selected_button>0&&(e.selected_button=0&&(e.buttons[e.selected_button].className="viewModeItemButton "+e.buttons[e.selected_button].data.profile),e.selected_button++,e.buttons[e.selected_button].className=e.buttons[e.selected_button].className+" selected"):i.keyCode==t&&e.onItemClick(e.buttons[e.selected_button],e.buttons[e.selected_button].data.profile,e.buttons[e.selected_button].data.profile))})},buildContent:function(e){var t=this;this.buttonItems={},paella.Profiles.loadProfileList(function(n){Object.keys(n).forEach(function(a){if(!n[a].hidden){if(t.active_profiles){var i=!1;if(t.active_profiles.forEach(function(e){e==a&&(i=!0)}),0==i)return}var r=paella.player.videoContainer.sourceData[0].sources;if(("s_p_blackboard2"!=a||0!=r.hasOwnProperty("image"))&&("chroma"!=a||r.chroma)){var o=n[a],s=t.getProfileItemButton(a,o);t.buttonItems[a]=s,e.appendChild(s),t.buttons.push(s),paella.player.selectedProfile==a&&(t.buttonItems[a].className=t.getButtonItemClass(a,!0))}}}),t.selected_button=t.buttons.length})},getProfileItemButton:function(e,t){var n=document.createElement("div");return n.className=this.getButtonItemClass(e,!1),n.id=e+"_button",n.data={profile:e,profileData:t,plugin:this},$(n).click(function(e){this.data.plugin.onItemClick(this,this.data.profile,this.data.profileData)}),n},onProfileChange:function(e){var t=this,n=this.buttonItems[e],a=this.buttonItems;Object.keys(a).forEach(function(e){t.buttonItems[e].className=t.getButtonItemClass(e,!1)}),n&&(n.className=t.getButtonItemClass(e,!0))},onItemClick:function(e,t,n){this.buttonItems[t]&&paella.player.setProfile(t),paella.player.controls.hidePopUp(this.getName())},getButtonItemClass:function(e,t){return"viewModeItemButton "+e+(t?" selected":"")}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"left"},getSubclass:function(){return"volumeRangeButton"},getIconClass:function(){return"icon-volume-high"},getName:function(){return"es.upv.paella.volumeRangePlugin"},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},getDefaultToolTip:function(){return base.dictionary.translate("Volume")},getIndex:function(){return 120},closeOnMouseOut:function(){return!0},checkEnabled:function(e){this._tempMasterVolume=0,this._inputMaster=null,this._control_NotMyselfEvent=!0,this._storedValue=!1,e(!base.userAgent.browser.IsMobileVersion)},setup:function(){var e=this;paella.events.bind(paella.events.videoUnloaded,function(t,n){e.storeVolume()}),paella.events.bind(paella.events.singleVideoReady,function(t,n){e.loadStoredVolume(n)}),paella.events.bind(paella.events.setVolume,function(t,n){e.updateVolumeOnEvent(n)})},updateVolumeOnEvent:function(e){this._control_NotMyselfEvent?this._inputMaster=e.master:this._control_NotMyselfEvent=!0},storeVolume:function(){var e=this;paella.player.videoContainer.mainAudioPlayer().volume().then(function(t){e._tempMasterVolume=t,e._storedValue=!0})},loadStoredVolume:function(e){0==this._storedValue&&this.storeVolume(),this._tempMasterVolume&&paella.player.videoContainer.setVolume({master:this._tempMasterVolume}),this._storedValue=!1},buildContent:function(e){var t=this,n=this,a=document.createElement("div");a.className="videoRangeContainer";var i=document.createElement("div");i.className="range";var r=document.createElement("div");r.className="image master";var o=document.createElement("input");function s(){var e=$(o).val();n._control_NotMyselfEvent=!1,paella.player.videoContainer.setVolume({master:e})}n._inputMaster=o,o.type="range",o.min=0,o.max=1,o.step=.01,paella.player.videoContainer.masterVideo().volume().then(function(e){o.value=e}),$(o).bind("input",function(e){s()}),$(o).change(function(){s()}),i.appendChild(r),i.appendChild(o),a.appendChild(i),paella.events.bind(paella.events.setVolume,function(e,n){o.value=n.master,t.updateClass()}),e.appendChild(a),n.updateClass();var l=37,u=39;$(this.button).keyup(function(e){n.isPopUpOpen()&&paella.player.videoContainer.volume().then(function(t){var n=-1;e.keyCode==l?n=t-.1:e.keyCode==u&&(n=t+.1),-1!=n&&(n=n<0?0:n>1?1:n,paella.player.videoContainer.setVolume(n).then(function(e){}))})})},updateClass:function(){var e=this,t="";paella.player.videoContainer.mainAudioPlayer().volume().then(function(n){t=void 0===n?"icon-volume-mid":0==n?"icon-volume-mute":n<.33?"icon-volume-low":n<.66?"icon-volume-mid":"icon-volume-high",e.changeIconClass(t)})}},{},e)}(paella.ButtonPlugin)}),Class("paella.videoFactories.WebmVideoFactory",{webmCapable:function(){var e=document.createElement("video");return!!e.canPlayType&&""!==e.canPlayType('video/webm; codecs="vp8, vorbis"')},isStreamCompatible:function(e){try{if(!this.webmCapable())return!1;for(var t in e.sources)if("webm"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return new paella.Html5Video(e,t,n.x,n.y,n.w,n.h,"webm")}}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.windowTitlePlugin"},checkEnabled:function(e){var t=this;this._initDone=!1,paella.player.videoContainer.masterVideo().duration().then(function(e){t.loadTitle()}),e(!0)},loadTitle:function(){var e=paella.player.videoLoader.getMetadata()&&paella.player.videoLoader.getMetadata().title;document.title=e||document.title,this._initDone=!0}},{},e)}(paella.EventDrivenPlugin)}),Class("paella.YoutubeVideo",paella.VideoElementBase,{_posterFrame:null,_currentQuality:null,_autoplay:!1,_readyPromise:null,initialize:function(e,t,n,a,i,r){this.parent(e,t,"div",n,a,i,r);var o=this;this._readyPromise=$.Deferred(),Object.defineProperty(this,"video",{get:function(){return o._youtubePlayer}})},_deferredAction:function(e){var t=this;return new Promise(function(n,a){t._readyPromise.then(function(){n(e())},function(){a()})})},_getQualityObject:function(e,t){var n=0;switch(t){case"small":n=1;break;case"medium":n=2;break;case"large":n=3;break;case"hd720":n=4;break;case"hd1080":n=5;break;case"highres":n=6}return{index:e,res:{w:null,h:null},src:null,label:t,level:n,bitrate:n,toString:function(){return this.label},shortLabel:function(){return this.label},compare:function(e){return this.level-e.level}}},_onStateChanged:function(e){console.log("On state changed")},getVideoData:function(){var e=this,t=this;return new Promise(function(n,a){var i=e._stream.sources.youtube[0];e._deferredAction(function(){var e={duration:t.video.getDuration(),currentTime:t.video.getCurrentTime(),volume:t.video.getVolume(),paused:!t._playing,ended:t.video.ended,res:{w:i.res.w,h:i.res.h}};n(e)})})},setPosterFrame:function(e){this._posterFrame=e},setAutoplay:function(e){this._autoplay=e},setRect:function(e,t){this._rect=JSON.parse(JSON.stringify(e));var n=new paella.RelativeVideoSize,a={top:n.percentVSize(e.top)+"%",left:n.percentWSize(e.left)+"%",width:n.percentWSize(e.width)+"%",height:n.percentVSize(e.height)+"%",position:"absolute"};if(t){this.disableClassName();var i=this;$("#"+this.identifier).animate(a,400,function(){i.enableClassName(),paella.events.trigger(paella.events.setComposition,{video:i})}),this.enableClassNameAfter(400)}else $("#"+this.identifier).css(a),paella.events.trigger(paella.events.setComposition,{video:this})},setVisible:function(e,t){"true"==e&&t?($("#"+this.identifier).show(),$("#"+this.identifier).animate({opacity:1},300)):"true"!=e||t?"false"==e&&t?$("#"+this.identifier).animate({opacity:0},300):"false"!=e||t||$("#"+this.identifier).hide():$("#"+this.identifier).show()},setLayer:function(e){$("#"+this.identifier).css({zIndex:e})},load:function(){var e=this,t=this;return new Promise(function(n,a){e._qualityListReadyPromise=$.Deferred(),paella.youtubePlayerVars.apiReadyPromise.then(function(){var i=e._stream.sources.youtube[0];i?(e._youtubePlayer=new YT.Player(t.identifier,{height:"390",width:"640",videoId:i.id,playerVars:{controls:0,disablekb:1},events:{onReady:function(e){t._readyPromise.resolve()},onStateChanged:function(e){console.log("state changed")},onPlayerStateChange:function(e){console.log("state changed")}}}),n()):a(new Error("Could not load video: invalid quality stream index"))})})},getQualities:function(){var e=this;return new Promise(function(t,n){e._qualityListReadyPromise.then(function(n){var a=[],i=-1;e._qualities={},n.forEach(function(t){i++,e._qualities[t]=e._getQualityObject(i,t),a.push(e._qualities[t])}),t(a)})})},setQuality:function(e){var t=this;return new Promise(function(n,a){t._qualityListReadyPromise.then(function(a){for(var i in t._qualities){var r=t._qualities[i];if("object"==$traceurRuntime.typeof(r)&&r.index==e){t.video.setPlaybackQuality(r.label);break}}n()})})},getCurrentQuality:function(){var e=this;return new Promise(function(t,n){e._qualityListReadyPromise.then(function(n){t(e._qualities[e.video.getPlaybackQuality()])})})},play:function(){var e=this,t=this;return new Promise(function(n,a){t._playing=!0,t.video.playVideo(),new base.Timer(function(t){var a=e.video.getAvailableQualityLevels();a.length?(t.repeat=!1,e._qualityListReadyPromise.resolve(a),n()):t.repeat=!0},500)})},pause:function(){var e=this;return this._deferredAction(function(){e._playing=!1,e.video.pauseVideo()})},isPaused:function(){var e=this;return this._deferredAction(function(){return!e._playing})},duration:function(){var e=this;return this._deferredAction(function(){return e.video.getDuration()})},setCurrentTime:function(e){var t=this;return this._deferredAction(function(){t.video.seekTo(e)})},currentTime:function(){var e=this;return this._deferredAction(function(){return e.video.getCurrentTime()})},setVolume:function(e){var t=this;return this._deferredAction(function(){t.video.setVolume&&t.video.setVolume(100*e)})},volume:function(){var e=this;return this._deferredAction(function(){return e.video.getVolume()/100})},setPlaybackRate:function(e){var t=this;return this._deferredAction(function(){t.video.playbackRate=e})},playbackRate:function(){var e=this;return this._deferredAction(function(){return e.video.playbackRate})},goFullScreen:function(){var e=this;return this._deferredAction(function(){var t=e.video;t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitEnterFullscreen&&t.webkitEnterFullscreen()})},unFreeze:function(){var e=this;return this._deferredAction(function(){var t=document.getElementById(e.video.className+"canvas");$(t).remove()})},freeze:function(){var e=this;return this._deferredAction(function(){var t=document.createElement("canvas");t.id=e.video.className+"canvas",t.width=e.video.videoWidth,t.height=e.video.videoHeight,t.style.cssText=e.video.style.cssText,t.style.zIndex=2,t.getContext("2d").drawImage(e.video,0,0,16*Math.ceil(t.width/16),16*Math.ceil(t.height/16)),e.video.parentElement.appendChild(t)})},unload:function(){return this._callUnloadEvent(),paella_DeferredNotImplemented()},getDimensions:function(){return paella_DeferredNotImplemented()}}),Class("paella.videoFactories.YoutubeVideoFactory",{initYoutubeApi:function(){if(!this._initialized){var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),paella.youtubePlayerVars={apiReadyPromise:new $.Deferred},this._initialized=!0}},isStreamCompatible:function(e){try{for(var t in e.sources)if("youtube"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return this.initYoutubeApi(),new paella.YoutubeVideo(e,t,n.x,n.y,n.w,n.h)}}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getIndex:function(){return 20},getAlignment:function(){return"right"},getSubclass:function(){return"zoomButton"},getDefaultToolTip:function(){return base.dictionary.translate("Zoom")},getEvents:function(){return[paella.events.timeUpdate,paella.events.setComposition,paella.events.loadPlugins,paella.events.play]},onEvent:function(e,t){switch(e){case paella.events.timeUpdate:this.imageUpdate(e,t);break;case paella.events.setComposition:this.compositionChanged(e,t);break;case paella.events.loadPlugins:this.loadPlugin(e,t);break;case paella.events.play:this.exitPhotoMode()}},checkEnabled:function(e){if(paella.player.videoContainer.sourceData.length<2)return this._zImages=null,this._imageNumber=null,this._isActivated=!1,this._isCreated=!1,this._keys=null,this._ant=null,this._next=null,this._videoLength=null,this._compChanged=!1,this._restartPlugin=!1,this._actualImage=null,this._zoomIncr=null,this._maxZoom=null,this._minZoom=null,this._dragMode=!1,this._mouseDownPosition=null,void e(!1);paella.player.videoContainer.sourceData[0].sources.hasOwnProperty("image")?e(!0):e(!1)},setupIcons:function(){var e=this,t=$(".zoomFrame").width(),n=document.createElement("div");n.className="arrowsLeft",n.style.display="none";var a=document.createElement("div");a.className="arrowsRight",a.style.display="none",a.style.left=t-24+"px",$(n).click(function(){e.arrowCallLeft(),event.stopPropagation()}),$(a).click(function(){e.arrowCallRight(),event.stopPropagation()});var i=document.createElement("div");i.className="iconsFrame";var r=document.createElement("button");r.className="zoomActionButton buttonZoomIn",r.style.display="none";var o=document.createElement("button");o.className="zoomActionButton buttonZoomOut",o.style.display="none";var s=document.createElement("button");s.className="zoomActionButton buttonSnapshot",s.style.display="none";var l=document.createElement("button");l.className="zoomActionButton buttonZoomOn",$(i).append(l),$(i).append(s),$(i).append(r),$(i).append(o),$(".newframe").append(i),$(".newframe").append(n),$(".newframe").append(a),$(l).click(function(){e._isActivated?(e.exitPhotoMode(),$(".zoomActionButton.buttonZoomOn").removeClass("clicked")):(e.enterPhotoMode(),$(".zoomActionButton.buttonZoomOn").addClass("clicked")),event.stopPropagation()}),$(s).click(function(){null!=e._actualImage&&window.open(e._actualImage,"_blank"),event.stopPropagation()}),$(r).click(function(){e.zoomIn(),event.stopPropagation()}),$(o).click(function(){e.zoomOut(),event.stopPropagation()})},enterPhotoMode:function(){$(".zoomFrame").show(),$(".zoomFrame").css("opacity","1"),this._isActivated=!0,$(".buttonSnapshot").show(),$(".buttonZoomOut").show(),$(".buttonZoomIn").show(),$(".arrowsRight").show(),$(".arrowsLeft").show(),paella.player.pause(),this._imageNumber<=1?$(".arrowsLeft").hide():this._isActivated&&$(".arrowsLeft").show(),this._imageNumber>=this._keys.length-2?$(".arrowsRight").hide():this._isActivated&&$(".arrowsRight").show()},exitPhotoMode:function(){$(".zoomFrame").hide(),this._isActivated=!1,$(".buttonSnapshot").hide(),$(".buttonZoomOut").hide(),$(".buttonZoomIn").hide(),$(".arrowsRight").hide(),$(".arrowsLeft").hide(),$(".zoomActionButton.buttonZoomOn").removeClass("clicked")},setup:function(){this._maxZoom=this.config.maxZoom||500,this._minZoom=this.config.minZoom||100,this._zoomIncr=this.config.zoomIncr||10,this._zImages={},this._zImages=paella.player.videoContainer.sourceData[0].sources.image[0].frames,this._videoLength=paella.player.videoContainer.sourceData[0].sources.image[0].duration,this._keys=Object.keys(this._zImages),this._keys=this._keys.sort(function(e,t){return e=e.slice(6),t=t.slice(6),parseInt(e)-parseInt(t)}),this._next=0,this._ant=0},loadPlugin:function(){0==this._isCreated&&(this.createOverlay(),this.setupIcons(),$(".zoomFrame").hide(),this._isActivated=!1,this._isCreated=!0)},imageUpdate:function(e,t){var n=Math.round(t.currentTime),a=$(".zoomFrame").css("background-image");if($(".newframe").length>0){if(this._zImages.hasOwnProperty("frame_"+n)){if(a==this._zImages["frame_"+n])return;a=this._zImages["frame_"+n]}else{if(!(n>this._next||n=this._keys.length-2?$(".arrowsRight").hide():this._isActivated&&$(".arrowsRight").show()}},returnSrc:function(e){var t=0;for(i=0;ia&&e=0){var e=this._keys[this._imageNumber-1];this._imageNumber-=1,paella.player.videoContainer.seekToTime(parseInt(e.slice(6)))}},arrowCallRight:function(){if(this._imageNumber+1<=this._keys.length){var e=this._keys[this._imageNumber+1];this._imageNumber+=1,paella.player.videoContainer.seekToTime(parseInt(e.slice(6)))}},createOverlay:function(){var e=this,t=document.createElement("div");t.className="newframe",overlayContainer=paella.player.videoContainer.overlayContainer,overlayContainer.addElement(t,overlayContainer.getMasterRect());var n=document.createElement("div");n.className="zoomFrame",t.insertBefore(n,t.firstChild),$(n).click(function(e){e.stopPropagation()}),$(n).bind("mousewheel",function(t){t.originalEvent.wheelDelta/120>0?e.zoomIn():e.zoomOut()}),$(n).mousedown(function(t){e.mouseDown(t.clientX,t.clientY)}),$(n).mouseup(function(t){e.mouseUp()}),$(n).mouseleave(function(t){e.mouseLeave()}),$(n).mousemove(function(t){e.mouseMove(t.clientX,t.clientY)})},mouseDown:function(e,t){this._dragMode=!0,this._mouseDownPosition={x:e,y:t}},mouseUp:function(){this._dragMode=!1},mouseLeave:function(){this._dragMode=!1},mouseMove:function(e,t){if(this._dragMode){$(".zoomFrame")[0];var n=this._backgroundPosition?this._backgroundPosition:{left:0,top:0},a=($(".zoomFrame").width(),$(".zoomFrame").height(),this._mouseDownPosition.x-e),i=this._mouseDownPosition.y-t,r=n.left+a,o=n.top+i;r=(r=r>=0?r:0)<=100?r:100,o=(o=o>=0?o:0)<=100?o:100,$(".zoomFrame").css("background-position",r+"% "+o+"%"),this._backgroundPosition={left:r,top:o},this._mouseDownPosition.x=e,this._mouseDownPosition.y=t}},zoomIn:function(){var e=$(".zoomFrame").css("background-size");e=e.split(" "),(e=parseInt(e[0]))this._minZoom&&$(".zoomFrame").css("background-size",e-this._zoomIncr+"% auto")},imageUpdateOnPause:function(e){var t=Math.round(e),n=$(".zoomFrame").css("background-image");if($(".newframe").length>0&&n!=this._actualImage){if(this._zImages.hasOwnProperty("frame_"+t)){if(n==this._zImages["frame_"+t])return;n=this._zImages["frame_"+t]}else this._compChanged=!1,n=this.returnSrc(t);$("#photo_01").attr("src",n).load();var a=new Image;a.onload=function(){$(".zoomFrame").css("background-image","url("+n+")")},a.src=n,this._actualImage=n}},compositionChanged:function(e,t){var n=this;$(".newframe").remove(),this._isCreated=!1,paella.player.videoContainer.getMasterVideoRect().visible&&(this.loadPlugin(),paella.player.paused()&&paella.player.videoContainer.currentTime().then(function(e){n.imageUpdateOnPause(e)})),this._compChanged=!0},getName:function(){return"es.upv.paella.zoomPlugin"}},{},e)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"org.opencast.usertracking.MatomoSaverPlugIn"},checkEnabled:function(e){var t=this.config.site_id,n=this.config.server,a=this.config.heartbeat,i=this;n&&t?("/"!=n.substr(-1)&&(n+="/"),require([n+"piwik.js"],function(e){base.log.debug("Matomo Analytics Enabled"),paella.userTracking.matomotracker=Piwik.getAsyncTracker(n+"piwik.php",t),paella.userTracking.matomotracker.client_id=i.config.client_id,a&&a>0&&paella.userTracking.matomotracker.enableHeartBeatTimer(a),Piwik&&Piwik.MediaAnalytics&&Piwik.MediaAnalytics.scanForMedia(),i.registerVisit()}),e(!0)):(base.log.debug("No Matomo Site ID found in config file. Disabling Matomo Analytics PlugIn"),e(!1))},registerVisit:function(){var e,t,n,a,i;paella.opencast&&paella.opencast._episode?(e=paella.opencast._episode.dcTitle,t=paella.opencast._episode.id,i=paella.opencast._episode.dcCreator,paella.userTracking.matomotracker.setCustomVariable(5,"client",paella.userTracking.matomotracker.client_id||"Paella Opencast")):paella.userTracking.matomotracker.setCustomVariable(5,"client",paella.userTracking.matomotracker.client_id||"Paella Standalone"),paella.opencast&&paella.opencast._episode&&paella.opencast._episode.mediapackage&&(a=paella.opencast._episode.mediapackage.series,n=paella.opencast._episode.mediapackage.seriestitle),e&&paella.userTracking.matomotracker.setCustomVariable(1,"event",e+" ("+t+")","page"),n&&paella.userTracking.matomotracker.setCustomVariable(2,"series",n+" ("+a+")","page"),i&&paella.userTracking.matomotracker.setCustomVariable(3,"presenter",i,"page"),paella.userTracking.matomotracker.setCustomVariable(4,"view_mode",void 0,"page"),e&&i?(paella.userTracking.matomotracker.setDocumentTitle(e+" - "+(i||"Unknown")),paella.userTracking.matomotracker.trackPageView(e+" - "+(i||"Unknown"))):paella.userTracking.matomotracker.trackPageView()},log:function(e,t){if(void 0!==paella.userTracking.matomotracker){if(void 0===this.config.category||!0===this.config.category){var n="";try{n=JSON.stringify(t)}catch(e){}switch(e){case paella.events.play:paella.userTracking.matomotracker.trackEvent("Player.Controls","Play");break;case paella.events.pause:paella.userTracking.matomotracker.trackEvent("Player.Controls","Pause");break;case paella.events.endVideo:paella.userTracking.matomotracker.trackEvent("Player.Status","Ended");break;case paella.events.showEditor:paella.userTracking.matomotracker.trackEvent("Player.Editor","Show");break;case paella.events.hideEditor:paella.userTracking.matomotracker.trackEvent("Player.Editor","Hide");break;case paella.events.enterFullscreen:paella.userTracking.matomotracker.trackEvent("Player.View","Fullscreen");break;case paella.events.exitFullscreen:paella.userTracking.matomotracker.trackEvent("Player.View","ExitFullscreen");break;case paella.events.loadComplete:paella.userTracking.matomotracker.trackEvent("Player.Status","LoadComplete");break;case paella.events.showPopUp:paella.userTracking.matomotracker.trackEvent("Player.PopUp","Show",n);break;case paella.events.hidePopUp:paella.userTracking.matomotracker.trackEvent("Player.PopUp","Hide",n);break;case paella.events.captionsEnabled:paella.userTracking.matomotracker.trackEvent("Player.Captions","Enabled",n);break;case paella.events.captionsDisabled:paella.userTracking.matomotracker.trackEvent("Player.Captions","Disabled",n);break;case paella.events.setProfile:paella.userTracking.matomotracker.trackEvent("Player.View","Profile",n);break;case paella.events.seekTo:case paella.events.seekToTime:paella.userTracking.matomotracker.trackEvent("Player.Controls","Seek",n);break;case paella.events.setVolume:paella.userTracking.matomotracker.trackEvent("Player.Settings","Volume",n);break;case paella.events.resize:paella.userTracking.matomotracker.trackEvent("Player.View","resize",n);break;case paella.events.setPlaybackRate:paella.userTracking.matomotracker.trackEvent("Player.Controls","PlaybackRate",n)}}}else base.log.debug("Matomo Tracker is missing")}},{},e)}(paella.userTracking.SaverPlugIn)}); \ No newline at end of file +"use strict";var GlobalParams={video:{zIndex:1},background:{zIndex:0}};window.paella=window.paella||{},paella.player=null,paella.version="5.3.4 - build: 92cc4ff",function(){if(window.paella_debug_baseUrl)paella.baseUrl=window.paella_debug_baseUrl;else{var e=document.getElementsByTagName("script"),t=e[e.length-1].src.split("/");t.pop(),t.pop(),paella.baseUrl=t.join("/")+"/"}}(),paella.events={play:"paella:play",pause:"paella:pause",next:"paella:next",previous:"paella:previous",seeking:"paella:seeking",seeked:"paella:seeked",timeupdate:"paella:timeupdate",timeUpdate:"paella:timeupdate",seekTo:"paella:setseek",endVideo:"paella:endvideo",seekToTime:"paella:seektotime",setTrim:"paella:settrim",setPlaybackRate:"paella:setplaybackrate",setVolume:"paella:setVolume",setComposition:"paella:setComposition",loadStarted:"paella:loadStarted",loadComplete:"paella:loadComplete",loadPlugins:"paella:loadPlugins",error:"paella:error",setProfile:"paella:setprofile",documentChanged:"paella:documentChanged",didSaveChanges:"paella:didsavechanges",controlBarWillHide:"paella:controlbarwillhide",controlBarDidHide:"paella:controlbardidhide",controlBarDidShow:"paella:controlbardidshow",hidePopUp:"paella:hidePopUp",showPopUp:"paella:showPopUp",enterFullscreen:"paella:enterFullscreen",exitFullscreen:"paella:exitFullscreen",resize:"paella:resize",videoZoomChanged:"paella:videoZoomChanged",audioLanguageChanged:"paella:audiolanguagechanged",zoomAvailabilityChanged:"paella:zoomavailabilitychanged",qualityChanged:"paella:qualityChanged",singleVideoReady:"paella:singleVideoReady",singleVideoUnloaded:"paella:singleVideoUnloaded",videoReady:"paella:videoReady",videoUnloaded:"paella:videoUnloaded",controlBarLoaded:"paella:controlBarLoaded",flashVideoEvent:"paella:flashVideoEvent",captionAdded:"paella:caption:add",captionsEnabled:"paella:caption:enabled",captionsDisabled:"paella:caption:disabled",trigger:function(e,t){$(document).trigger(e,t)},bind:function(e,t){$(document).bind(e,function(e,n){t(e,n)})},setupExternalListener:function(){window.addEventListener("message",function(e){e.data&&e.data.event&&paella.events.trigger(e.data.event,e.data.params)},!1)}},paella.events.setupExternalListener(),Class("paella.MouseManager",{targetObject:null,initialize:function(){var e=this;paella.events.bind("mouseup",function(t){e.up(t)}),paella.events.bind("mousemove",function(t){e.move(t)}),paella.events.bind("mouseover",function(t){e.over(t)})},down:function(e,t){return this.targetObject=e,this.targetObject&&this.targetObject.down&&(this.targetObject.down(t,t.pageX,t.pageY),t.cancelBubble=!0),!1},up:function(e){return this.targetObject&&this.targetObject.up&&(this.targetObject.up(e,e.pageX,e.pageY),e.cancelBubble=!0),this.targetObject=null,!1},out:function(e){return this.targetObject&&this.targetObject.out&&(this.targetObject.out(e,e.pageX,e.pageY),e.cancelBubble=!0),!1},move:function(e){return this.targetObject&&this.targetObject.move&&(this.targetObject.move(e,e.pageX,e.pageY),e.cancelBubble=!0),!1},over:function(e){return this.targetObject&&this.targetObject.over&&(this.targetObject.over(e,e.pageX,e.pageY),e.cancelBubble=!0),!1}}),function(){var e=document.createElement("link");e.rel="stylesheet",e.href=paella.baseUrl+"resources/bootstrap/css/bootstrap.min.css",e.type="text/css",e.media="screen",e.charset="utf-8",document.head.appendChild(e)}(),paella.utils={mouseManager:new paella.MouseManager,folders:{get:function(e){if(paella.player&&paella.player.config&&paella.player.config.folders&&paella.player.config.folders[e])return paella.player.config.folders[e]},profiles:function(){return paella.baseUrl+(paella.utils.folders.get("profiles")||"config/profiles")},resources:function(){return paella.baseUrl+(paella.utils.folders.get("resources")||"resources")},skins:function(){return paella.baseUrl+(paella.utils.folders.get("skins")||paella.utils.folders.get("resources")+"/style")}},styleSheet:{removeById:function(e){var t=$(document.head).find("#"+e)[0];t&&document.head.removeChild(t)},remove:function(e){for(var t=document.head.getElementsByTagName("link"),n=0;n/g,">")},htmlUnescape:function(e){return String(e).replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}},Class("paella.Node",{identifier:"",nodeList:null,parent:null,initialize:function(e){this.nodeList={},this.identifier=e},addTo:function(e){e.addNode(this)},addNode:function(e){return e.parent=this,this.nodeList[e.identifier]=e,e},getNode:function(e){return this.nodeList[e]},removeNode:function(e){return!!this.nodeList[e.identifier]&&(delete this.nodeList[e.identifier],!0)}}),Class("paella.DomNode",paella.Node,{domElement:null,initialize:function(e,t,n){this.parent(t),this.domElement=document.createElement(e),this.domElement.id=t,n&&$(this.domElement).css(n)},addNode:function(e){var t=this.parent(e);return this.domElement.appendChild(e.domElement),t},onresize:function(){},removeNode:function(e){this.parent(e)&&this.domElement.removeChild(e.domElement)}}),Class("paella.Button",paella.DomNode,{isToggle:!1,initialize:function(e,t,n,a){this.isToggle=a;if(this.parent("div",e,{}),this.domElement.className=t,a){var i=this;$(this.domElement).click(function(e){i.toggleIcon()})}$(this.domElement).click("click",n)},isToggled:function(){if(this.isToggle){var e=this.domElement;return/([a-zA-Z0-9_]+)_active/.test(e.className)}return!1},toggle:function(){this.toggleIcon()},toggleIcon:function(){var e=this.domElement;/([a-zA-Z0-9_]+)_active/.test(e.className)?e.className=RegExp.$1:e.className=e.className+"_active"},show:function(){$(this.domElement).show()},hide:function(){$(this.domElement).hide()},visible:function(){return this.domElement.visible()}}),Class("paella.VideoQualityStrategy",{getParams:function(){return paella.player.config.player.videoQualityStrategyParams||{}},getQualityIndex:function(e){return e.length>0?e[e.length-1]:e}}),Class("paella.BestFitVideoQualityStrategy",paella.VideoQualityStrategy,{getQualityIndex:function(e){var t=e.length-1;if(e.length>0){var n=e[0],a=$(window).width()*$(window).height();if(n.res&&n.res.w&&n.res.h)for(var i=parseInt(n.res.w)*parseInt(n.res.h),r=Math.abs(a-i),o=0;o0){var a=$(window).height(),i=n.maxAutoQualityRes||720,r=Number.MAX_VALUE;e.forEach(function(e,n){e.res&&e.res.h<=i&&(Math.abs(a-e.res.h)=t.audio.HAVE_CURRENT_DATA?(t._ready=!0,n("function"!=typeof e||e())):setTimeout(i,50)};i()}})}var t=function(t){return $traceurRuntime.createClass(function e(t,n){$traceurRuntime.superConstructor(e).call(this,t,n),this._streamName="audio",this._audio=document.createElement("audio"),this.domElement.appendChild(this._audio)},{get audio(){return this._audio},setAutoplay:function(e){this.audio.autoplay=e},load:function(){var t=this._stream.sources[this._streamName],n=t.length>0?t[0]:null;if(this.audio.innerHTML="",n){var a=this.audio.querySelector("source");return a||(a=document.createElement("source"),this.audio.appendChild(a)),a.src=n.src,n.type&&(a.type=n.type),this.audio.load(),e.apply(this,[function(){return n}])}return Promise.reject(new Error("Could not load video: invalid quality stream index"))},play:function(){var t=this;return e.apply(this,[function(){t.audio.play()}])},pause:function(){var t=this;return e.apply(this,[function(){t.audio.pause()}])},isPaused:function(){var t=this;return e.apply(this,[function(){return t.audio.paused}])},duration:function(){var t=this;return e.apply(this,[function(){return t.audio.duration}])},setCurrentTime:function(t){var n=this;return e.apply(this,[function(){n.audio.currentTime=t}])},currentTime:function(){var t=this;return e.apply(this,[function(){return t.audio.currentTime}])},setVolume:function(t){var n=this;return e.apply(this,[function(){return n.audio.volume=t}])},volume:function(){var t=this;return e.apply(this,[function(){return t.audio.volume}])},setPlaybackRate:function(t){var n=this;return e.apply(this,[function(){n.audio.playbackRate=t}])},playbackRate:function(){var t=this;return e.apply(this,[function(){return t.audio.playbackRate}])},unload:function(){return Promise.resolve()}},{},t)}(paella.AudioElementBase);paella.MultiformatAudioElement=t;var n=function(){return $traceurRuntime.createClass(function(){},{isStreamCompatible:function(e){return!0},getAudioObject:function(e,t){return new paella.MultiformatAudioElement(e,t)}},{})}();paella.audioFactories.MultiformatAudioFactory=n}(),paella.Profiles={profileList:null,getDefaultProfile:function(){return paella.player.videoContainer.masterVideo()&&paella.player.videoContainer.masterVideo().defaultProfile()?paella.player.videoContainer.masterVideo().defaultProfile():paella.player&&paella.player.config&&paella.player.config.defaultProfile?paella.player.config.defaultProfile:void 0},loadProfile:function(e,t){var n=this.getDefaultProfile();this.loadProfileList(function(a){var i;if(a[e])i=a[e];else{if(!a[n])return base.log.debug("Error loading the default profile. Check your Paella Player configuration"),!1;i=a[n]}t(i)})},loadProfileList:function(e){var t=this;if(null==this.profileList){var n={url:paella.utils.folders.profiles()+"/profiles.json"};base.ajax.get(n,function(n,a,i){"string"==typeof n&&(n=JSON.parse(n)),t.profileList=n,e(t.profileList)},function(e,t,n){base.log.debug("Error loading video profiles. Check your Paella Player configuration")})}else e(t.profileList)}},Class("paella.RelativeVideoSize",{w:1280,h:720,proportionalHeight:function(e){return Math.floor(this.h*e/this.w)},proportionalWidth:function(e){return Math.floor(this.w*e/this.h)},percentVSize:function(e){return 100*e/this.h},percentWSize:function(e){return 100*e/this.w},aspectRatio:function(){return this.w/this.h}}),Class("paella.VideoRect",paella.DomNode,{_rect:null,initialize:function(e,t,n,a,i,r){var o=this,s=paella.player.config.player.videoZoom||{},l=(void 0===s.enabled||s.enabled)&&this.allowZoom();this.parent(t,e,l?{width:this._zoom+"%",height:"100%",position:"absolute"}:{width:"100%",height:"100%"});var u=document.createElement("div");if(setTimeout(function(){return o.domElement.parentElement.appendChild(u)},10),u.style.position="absolute",u.style.top="0px",u.style.left="0px",u.style.right="0px",u.style.bottom="0px",this.eventCapture=u,l){var c=function(){var e=paella.player.config.player&&paella.player.config.player.videoZoom&&paella.player.config.player.videoZoom.minWindowSize||500,t=$(window).width()>=e;this._zoomAvailable!=t&&(this._zoomAvailable=t,paella.events.trigger(paella.events.zoomAvailabilityChanged,{available:t}))},d=function(e){return{x:e.originalEvent.offsetX,y:e.originalEvent.offsetY}},p=function(e,t){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))},h=function(e){var t={x:this._mouseCenter.x-1.1*e.x,y:this._mouseCenter.y-1.1*e.y},n=$(this.domElement).width(),a=$(this.domElement).height(),i=this._zoom-100,r={x:t.x*i/n,y:t.y*i/a};r.x>i?r.x=i:r.x<0?r.x=0:this._mouseCenter.x=t.x,r.y>i?r.y=i:r.y<0?r.y=0:this._mouseCenter.y=t.y,$(this.domElement).css({left:"-"+r.x+"%",top:"-"+r.y+"%"}),this._zoomOffset={x:r.x,y:r.y},paella.events.trigger(paella.events.videoZoomChanged,{video:this})};this._zoomAvailable=!0,c.apply(this),$(window).resize(function(){c.apply(o)}),this._zoom=100,this._mouseCenter={x:0,y:0},this._mouseDown={x:0,y:0},this._zoomOffset={x:0,y:0},this._maxZoom=s.max||400,$(this.domElement).css({width:"100%",height:"100%",left:"0%",top:"0%"}),Object.defineProperty(this,"zoom",{get:function(){return this._zoom}}),Object.defineProperty(this,"zoomOffset",{get:function(){return this._zoomOffset}});var m=[];$(u).on("touchstart",function(e){if(o.allowZoom()&&o._zoomAvailable){m=[];for(var t=$(o.domElement).offset(),n=0;n1&&e.preventDefault()}}),$(u).on("touchmove",function(e){if(o.allowZoom()&&o._zoomAvailable){for(var t,n,a=[],i=$(o.domElement).offset(),r=0;r1&&m.length>1){var l=p(m[0],m[1]),u=p(a[0],a[1])-l,c=(t=m[0],{x:((n=m[1]).x-t.x)/2+t.x,y:(n.y-t.y)/2+t.y});o._mouseCenter=c,o._zoom+=u,o._zoom=o._zoom<100?100:o._zoom,o._zoom=o._zoom>o._maxZoom?o._maxZoom:o._zoom;var d={w:$(o.domElement).width(),h:$(o.domElement).height()},f=o._mouseCenter;$(o.domElement).css({width:o._zoom+"%",height:o._zoom+"%"});var g=o._zoom-100,v={x:f.x*g/d.w,y:f.y*g/d.h};v.x=v.x0){var y={x:a[0].x-m[0].x,y:a[0].y-m[0].y};h.apply(o,[y]),m=a,e.preventDefault()}}}),$(u).on("touchend",function(e){o.allowZoom()&&o._zoomAvailable&&m.length>1&&e.preventDefault()}),this.zoomIn=function(){if(!(o._zoom>=o._maxZoom)&&o._zoomAvailable){o._mouseCenter||(o._mouseCenter={x:$(o.domElement).width()/2,y:$(o.domElement).height()/2}),o._zoom+=25,o._zoom=o._zoom<100?100:o._zoom,o._zoom=o._zoom>o._maxZoom?o._maxZoom:o._zoom;var e=$(o.domElement).width(),t=$(o.domElement).height(),n=o._mouseCenter;$(o.domElement).css({width:o._zoom+"%",height:o._zoom+"%"});var a=o._zoom-100,i={x:n.x*a/e,y:n.y*a/t};i.x=i.xo._maxZoom?o._maxZoom:o._zoom;var e=$(o.domElement).width(),t=$(o.domElement).height(),n=o._mouseCenter;$(o.domElement).css({width:o._zoom+"%",height:o._zoom+"%"});var a=o._zoom-100,i={x:n.x*a/e,y:n.y*a/t};i.x=i.x=o._maxZoom&&n>0)){o._zoom+=n,o._zoom=o._zoom<100?100:o._zoom,o._zoom=o._zoom>o._maxZoom?o._maxZoom:o._zoom;var a=$(o.domElement).width(),i=$(o.domElement).height();$(o.domElement).css({width:o._zoom+"%",height:o._zoom+"%"});var r=o._zoom-100,s={x:t.x*r/a,y:t.y*r/i};return s.x=s.x=12&&paella.utils.userAgent.browser.Safari,t=paella.utils.userAgent.system.iOS,n=paella.utils.userAgent.browser.Chrome&&paella.utils.userAgent.browser.Version.major>=64;return!(e||t||n)},goFullScreen:function(){var e=this;return this._deferredAction(function(){var t=e.video;t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitEnterFullscreen&&t.webkitEnterFullscreen()})},unFreeze:function(){var e=this;return this._deferredAction(function(){var t=document.getElementById(e.video.id+"canvas");t&&$(t).remove()})},freeze:function(){var e=this;return this._deferredAction(function(){var t=document.createElement("canvas");t.id=e.video.id+"canvas",t.className="freezeFrame",t.width=e.video.videoWidth,t.height=e.video.videoHeight,t.style.cssText=e.video.style.cssText,t.style.zIndex=2,t.getContext("2d").drawImage(e.video,0,0,16*Math.ceil(t.width/16),16*Math.ceil(t.height/16)),e.video.parentElement.appendChild(t)})},unload:function(){return this._callUnloadEvent(),paella_DeferredNotImplemented()},getDimensions:function(){return paella_DeferredNotImplemented()}}),Class("paella.videoFactories.Html5VideoFactory",{isStreamCompatible:function(e){try{if(paella.videoFactories.Html5VideoFactory.s_instances>0&&base.userAgent.system.iOS&&paella.utils.userAgent.system.Version.major<=10&&paella.utils.userAgent.system.Version.minor<3)return!1;for(var t in e.sources)if("mp4"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return++paella.videoFactories.Html5VideoFactory.s_instances,new paella.Html5Video(e,t,n.x,n.y,n.w,n.h)}}),paella.videoFactories.Html5VideoFactory.s_instances=0,Class("paella.ImageVideo",paella.VideoElementBase,{_posterFrame:null,_currentQuality:null,_currentTime:0,_duration:0,_ended:!1,_playTimer:null,_playbackRate:1,_frameArray:null,initialize:function(e,t,n,a,i,r){this.parent(e,t,"img",n,a,i,r);var o=this;this._stream.sources.image.sort(function(e,t){return e.res.h-t.res.h}),Object.defineProperty(this,"img",{get:function(){return o.domElement}}),Object.defineProperty(this,"imgStream",{get:function(){return this._stream.sources.image[this._currentQuality]}}),Object.defineProperty(this,"_paused",{get:function(){return null==this._playTimer}})},_deferredAction:function(e){var t=this;return new Promise(function(n){if(t.ready)n(e());else{n=function(){t._ready=!0,n(e())};$(t.video).bind("paella:imagevideoready",n)}})},_getQualityObject:function(e,t){return{index:e,res:t.res,src:t.src,toString:function(){return this.res.w+"x"+this.res.h},shortLabel:function(){return this.res.h+"p"},compare:function(e){return this.res.w*this.res.h-e.res.w*e.res.h}}},_loadCurrentFrame:function(){var e=this;if(this._frameArray){var t=this._frameArray[0];this._frameArray.some(function(n){if(e._currentTimen._trimming.end&&n.setCurrentTime(n._trimming.end),n._trimming.enabled){var o=paella.captions.getActiveCaptions();void 0!==o&&paella.plugins.captionsPlugin.buildBodyContent(o._captions,"list")}paella.events.trigger(paella.events.setTrim,{trimEnabled:n._trimming.enabled,trimStart:n._trimming.start,trimEnd:n._trimming.end}),a()})})},setTrimmingStart:function(e){return this.setTrimming(e,this._trimming.end)},setTrimmingEnd:function(e){return this.setTrimming(this._trimming.start,e)},setCurrentPercent:function(e){var t=this,n=this,a=0;return new Promise(function(i){t.duration().then(function(e){return a=e,n.trimming()}).then(function(t){var i=0;if(t.enabled){var r=t.start,o=t.end;a=o-r,i=parseFloat(e*a/100)}else i=e*a/100;return n.setCurrentTime(i)}).then(function(e){i(e)})})},setCurrentTime:function(e){base.log.debug("VideoContainerBase.setCurrentTime("+e+")")},currentTime:function(){return base.log.debug("VideoContainerBase.currentTime()"),0},duration:function(){return base.log.debug("VideoContainerBase.duration()"),0},paused:function(){return base.log.debug("VideoContainerBase.paused()"),!0},setupVideo:function(e){base.log.debug("VideoContainerBase.setupVide()")},isReady:function(){return base.log.debug("VideoContainerBase.isReady()"),!0},onresize:function(){this.parent(onresize)}}),Class("paella.ProfileFrameStrategy",{valid:function(){return!0},adaptFrame:function(e,t){return t}}),Class("paella.LimitedSizeProfileFrameStrategy",paella.ProfileFrameStrategy,{adaptFrame:function(e,t){if(e.width0?this._slaveVideos[0]:null},get audioStreams(){return this._audioStreams},get isLiveStreaming(){return paella.player.isLiveStream()}},{})}();function t(e,t){var n=new paella.VideoWrapper(e);return n.addNode(t),this.videoWrappers.push(n),this.container.addNode(n),n}paella.StreamProvider=e;var n=function(e){function n(e){$traceurRuntime.superConstructor(n).call(this,e),this.containerId="",this.video1Id="",this.videoSlaveId="",this.backgroundId="",this.container=null,this.profileFrameStrategy=null,this.videoWrappers=[],this._players=[],this._videoPlayers=[],this._audioPlayers=[],this._audioPlayer=null,this._audioLanguage=paella.dictionary.currentLanguage(),this._volume=1,this.videoClasses={master:"video masterVideo",slave:"video slaveVideo"},this.isHidden=!1,this.logos=null,this.overlayContainer=null,this.videoSyncTimeMillis=5e3,this.currentMasterVideoRect={},this.currentSlaveVideoRect={},this._maxSyncDelay=.5,this._isMonostream=!1,this._videoQualityStrategy=null,this._sourceData=null,this._isMasterReady=!1,this._isSlaveReady=!1,this._firstLoad=!1,this._playOnLoad=!1,this._seekToOnLoad=0,this._showPosterFrame=!0,this._currentProfile=null;var t=this;this._sourceData=[],this.containerId=e+"_container",this.video1Id=e+"_master",this.videoSlaveId=e+"_slave_",this.audioId=e+"_audio_",this.backgroundId=e+"_bkg",this.logos=[],this._videoQualityStrategy=this._getQualityStrategyObject(),this.container=new paella.DomNode("div",this.containerId,{position:"relative",display:"block",marginLeft:"auto",marginRight:"auto",width:"1024px",height:"567px"}),this.container.domElement.setAttribute("role","main"),this.addNode(this.container),this.overlayContainer=new paella.VideoOverlay(this.domElement),this.container.addNode(this.overlayContainer),this.container.addNode(new paella.BackgroundContainer(this.backgroundId,paella.utils.folders.profiles()+"/resources/default_background_paella.jpg")),Object.defineProperty(this,"sourceData",{get:function(){return this._sourceData}}),new base.Timer(function(e){t.syncVideos()},t.videoSyncTimeMillis).repeat=!0;var a=paella.player.config;try{var i=a.player.profileFrameStrategy,r=new(Class.fromString(i));dynamic_cast("paella.ProfileFrameStrategy",r)&&this.setProfileFrameStrategy(r)}catch(e){}this._streamProvider=new paella.StreamProvider,Object.defineProperty(this,"ready",{get:function(){return this._isMasterReady&&this._isSlaveReady}}),Object.defineProperty(this,"isMonostream",{get:function(){return this._isMonostream}})}return $traceurRuntime.createClass(n,{_getQualityStrategyObject:function(){var e=null;return paella.player.config.player.videoQualityStrategy.split(".").forEach(function(t,n,a){e=0==n&&a.length>1?window[t]:e[t]}),new(e=e||paella.VideoQualityStrategy())},getVideoData:function(){var e=this;return new Promise(function(t){var n={master:null,slaves:[]},a=[];e.masterVideo()&&a.push(e.masterVideo().getVideoData().then(function(e){return n.master=e,Promise.resolve(e)})),e.slaveVideo()&&a.push(e.slaveVideo().getVideoData().then(function(e){return n.slaves.push(e),Promise.resolve(e)})),Promise.all(a).then(function(){t(n)})})},setVideoQualityStrategy:function(e){this._videoQualityStrategy=e,this.masterVideo()&&this.masterVideo().setVideoQualityStrategy(this._videoQualityStrategy),this.slaveVideo()&&slaveVideo.setVideoQualityStrategy(this._videoQualityStrategy)},setProfileFrameStrategy:function(e){this.profileFrameStrategy=e},getMasterVideoRect:function(){return this.currentMasterVideoRect},getSlaveVideoRect:function(){return this.currentSlaveVideoRect},setHidden:function(e){this.isHidden=e},hideVideo:function(){this.setHidden(!0)},publishVideo:function(){this.setHidden(!1)},syncVideos:function(){var e=this,t=this.masterVideo(),n=this.slaveVideo(),a=0,i=0;!this._isMonostream&&t&&t.currentTime().then(function(e){return a=e,n?n.currentTime():Promise.resolve(-1)}).then(function(t){if(t>=-1){i=t;var r=Math.abs(a-i);r>e._maxSyncDelay&&(base.log.debug("Sync videos performed, diff="+r),n.setCurrentTime(a))}var o=[];return e._audioPlayers.forEach(function(e){o.push(e.currentTime())}),Promise.all(o)}).then(function(t){t.forEach(function(t,n){var i=e._audioPlayers[n],r=Math.abs(a-t);r>e._maxSyncDelay&&(base.log.debug("Sync audio performed, diff="+r),i.setCurrentTime(t))})})},checkVideoBounds:function(e,t,n,a){var i=this,r=e.start,o=e.end,s=e.enabled;paella.events.bind(paella.events.endVideo,function(){i.setCurrentTime(0)}),s?t>=Math.floor(o)&&!n?(paella.events.trigger(paella.events.endVideo,{videoContainer:this}),this.pause()):t=a&&(paella.events.trigger(paella.events.endVideo,{videoContainer:this}),this.pause())},play:function(){var e=this;return new Promise(function(t){e._firstLoad?e._playOnLoad=!0:e._firstLoad=!0;var a=e.masterVideo(),i=e.slaveVideo();a?a.play().then(function(){i&&i.play(),e._audioPlayers.forEach(function(e){e.play()}),$traceurRuntime.superGet(e,n.prototype,"play").call(e),t()}):reject(new Error("Invalid master video"))})},pause:function(){var e=this;return new Promise(function(t,a){var i=e.masterVideo(),r=e.slaveVideo();i?i.pause().then(function(){r&&r.pause(),e._audioPlayers.forEach(function(e){e.pause()}),$traceurRuntime.superGet(e,n.prototype,"pause").call(e),t()}):a(new Error("invalid master video"))})},next:function(){0!==this._trimming.end?this.setCurrentTime(this._trimming.end):this.duration(!0).then(function(e){this.setCurrentTime(e)}),$traceurRuntime.superGet(this,n.prototype,"next").call(this)},previous:function(){this.setCurrentTime(this._trimming.start),$traceurRuntime.superGet(this,n.prototype,"previous").call(this)},setCurrentTime:function(e){var t=this;return new Promise(function(n){var a=[];t._trimming.enabled&&((e+=t._trimming.start)t._trimming.end&&(e=t._trimming.end)),a.push(t.masterVideo().setCurrentTime(e)),t.slaveVideo()&&a.push(t.slaveVideo().setCurrentTime(e)),t._audioPlayers.forEach(function(t){a.push(t.setCurrentTime(e))}),Promise.all(a).then(function(){return t.duration(!1)}).then(function(t){n({time:e,duration:t})})})},currentTime:function(){var e=void 0!==arguments[0]&&arguments[0],t=this;if(this._trimming.enabled&&!e){var n=this._trimming.start;return new Promise(function(e){t.masterVideo().currentTime().then(function(t){e(t-n)})})}return this.masterVideo().currentTime()},setPlaybackRate:function(e){var t=this.masterVideo(),a=this.slaveVideo();t&&t.setPlaybackRate(e),a&&a.setPlaybackRate(e),$traceurRuntime.superGet(this,n.prototype,"setPlaybackRate").call(this,e)},setVolume:function(e){var t=this;return new Promise(function(n){"object"==$traceurRuntime.typeof(e)&&(e=void 0!==e.master?e.master:1),t.mainAudioPlayer().setVolume(e).then(function(){paella.events.trigger(paella.events.setVolume,{master:e}),t._volume=e,n(e)})})},volume:function(){var e=this;return new Promise(function(t){e.mainAudioPlayer().volume().then(function(e){t(e)})})},masterVideo:function(){return this.videoWrappers.length>0?this.videoWrappers[0].getNode(this.video1Id):null},slaveVideo:function(){return this.videoWrappers.length>1?this.videoWrappers[1].getNode(this.videoSlaveId+1):null},mainAudioPlayer:function(){return this._audioPlayer},players:function(){var e=this;return new Promise(function(t){!function n(){e.masterVideo()?t(e._players):setTimeout(function(){return n()},10)}()})},videoPlayers:function(){var e=this;return new Promise(function(t){!function n(){e.masterVideo()?t(e._videoPlayers):setTimeout(function(){return n()},10)}()})},audioPlayers:function(){var e=this;return new Promise(function(t){!function n(){e.masterVideo()?t(e._audioPlayers):setTimeout(function(){return n()},10)}()})},duration:function(e){var t=this;return this.masterVideo().duration().then(function(n){return t._trimming.enabled&&!e&&(n=t._trimming.end-t._trimming.start),n})},paused:function(){return this.masterVideo().isPaused()},trimEnabled:function(){return this._trimming.enabled},trimStart:function(){return this._trimming.enabled?this._trimming.start:0},trimEnd:function(){return this._trimming.enabled?this._trimming.end:this.duration()},getQualities:function(){var e=this;return new Promise(function(t){e.masterVideo().getQualities().then(function(e){t(e)})})},setQuality:function(e){var t=this,n=[],a=[],i=this;return new Promise(function(r){t.masterVideo().getQualities().then(function(e){return n=e,t.slaveVideo()?t.slaveVideo().getQualities():paella_DeferredResolved()}).then(function(t){var o,s;a=t||[],o=e0?{x:850,y:140,w:360,h:550}:{x:0,y:0,w:1280,h:720};this._isMonostream=0==this._streamProvider.slaveVideos.length;var o=this._streamProvider.masterVideo,s=this._streamProvider.audioStreams;this._players=[],this._videoPlayers=[],this._audioPlayers=[];var l=this._streamProvider.mainSlaveVideo,u=paella.videoFactory.getVideoObject(this.video1Id,o,r);this._audioPlayer=u,this._players.push(u),this._videoPlayers.push(u);var c=l?paella.videoFactory.getVideoObject(this.videoSlaveId+1,l,{x:10,y:40,w:800,h:600}):null;c&&(c.setVolume(0),this._players.push(c),this._videoPlayers.push(c)),s.forEach(function(e,t){var a=paella.audioFactory.getAudioObject(n.audioId+t,e);a&&(n._audioPlayers.push(a),n._players.push(a),n.container.addNode(a))}),u.setVideoQualityStrategy(this._videoQualityStrategy),c&&c.setVideoQualityStrategy(this._videoQualityStrategy),t.apply(this,["masterVideoWrapper",u]),this._streamProvider.slaveVideos.length>0&&t.apply(this,["slaveVideoWrapper",c]);var d=this.autoplay();return u.setAutoplay(d),c&&c.setAutoplay(d),u.load().then(function(){return n._streamProvider.slaveVideos.length>0?c.load():paella_DeferredResolved(!0)}).then(function(){if(a._audioPlayers.length>0){var e=[];return a._audioPlayers.forEach(function(t){e.push(t.load())}),Promise.all(e)}return paella_DeferredResolved(!0)}).then(function(){$(u.video).bind("timeupdate",function(e){var t=a._trimming,n=e.currentTarget.currentTime,i=e.currentTarget.duration;t.enabled&&(n-=t.start,i=t.end-t.start),paella.events.trigger(paella.events.timeupdate,{videoContainer:a,currentTime:n,duration:i}),a.checkVideoBounds(t,e.currentTarget.currentTime,e.currentTarget.paused,i)}),a.overlayContainer.removeElement(i),a._isMasterReady=!0,a._isSlaveReady=!0;var e=paella.player.config,t=e.player.audio&&void 0!=e.player.audio.master?e.player.audio.master:1;return u.setVolume(t),a.setAudioLanguage(a._audioLanguage)}).then(function(){paella.events.trigger(paella.events.videoReady);var e=base.parameters.get("profile"),t=base.cookies.get("lastProfile");return e?a.setProfile(e,!1):t?a.setProfile(t,!1):a.setProfile(paella.Profiles.getDefaultProfile(),!1)})},setAutoplay:function(){var e=void 0===arguments[0]||arguments[0];return!!this.supportAutoplay()&&(this._autoplay=e,this.masterVideo()&&this.masterVideo().setAutoplay(e),this.slaveVideo()&&this.slaveVideo().setAutoplay(e),this._audioPlayers.length>0&&this._audioPlayers.forEach(function(t){t.setAutoplay(e)}),!0)},autoplay:function(){return this.supportAutoplay()&&("true"==base.parameters.get("autoplay")||this._streamProvider.isLiveStreaming)&&!base.userAgent.browser.IsMobileVersion},supportAutoplay:function(){var e=!1;return this.masterVideo()&&(e=this.masterVideo().supportAutoplay()),this.slaveVideo()&&e&&(e=e&&this.slaveVideo().supportAutoplay()),this._audioPlayers.length>0&&e&&this._audioPlayers.forEach(function(t){e=e&&t.supportAutoplay()}),e},numberOfStreams:function(){return this._sourceData.length},getMonostreamMasterProfile:function(){this.masterVideo();return{content:"presenter",visible:!0,layer:1,rect:[{aspectRatio:"1/1",left:280,top:0,width:720,height:720},{aspectRatio:"6/5",left:208,top:0,width:864,height:720},{aspectRatio:"5/4",left:190,top:0,width:900,height:720},{aspectRatio:"4/3",left:160,top:0,width:960,height:720},{aspectRatio:"11/8",left:145,top:0,width:990,height:720},{aspectRatio:"1.41/1",left:132,top:0,width:1015,height:720},{aspectRatio:"1.43/1",left:125,top:0,width:1029,height:720},{aspectRatio:"3/2",left:100,top:0,width:1080,height:720},{aspectRatio:"16/10",left:64,top:0,width:1152,height:720},{aspectRatio:"5/3",left:40,top:0,width:1200,height:720},{aspectRatio:"16/9",left:0,top:0,width:1280,height:720},{aspectRatio:"1.85/1",left:0,top:14,width:1280,height:692},{aspectRatio:"2.35/1",left:0,top:87,width:1280,height:544},{aspectRatio:"2.41/1",left:0,top:94,width:1280,height:531},{aspectRatio:"2.76/1",left:0,top:128,width:1280,height:463}]}},getMonostreamSlaveProfile:function(){return{content:"slides",visible:!1,layer:0,rect:[{aspectRatio:"16/9",left:0,top:0,width:0,height:0},{aspectRatio:"4/3",left:0,top:0,width:0,height:0}]}},getCurrentProfileName:function(){return this._currentProfile},setProfile:function(e,t){var n=this;return new Promise(function(a){t=!base.userAgent.browser.Explorer&&t,n.masterVideo()?paella.Profiles.loadProfile(e,function(i){n._currentProfile=e,0==n._streamProvider.slaveVideos.length&&(i.masterVideo=n.getMonostreamMasterProfile(),i.slaveVideo=n.getMonostreamSlaveProfile()),n.applyProfileWithJson(i,t),a(e)}):a()})},getProfile:function(e){return new Promise(function(t,n){paella.Profiles.loadProfile(e,function(e){t(e)})})},hideAllLogos:function(){for(var e=0;et&&(n=t,i=e)}),i},applyProfileWithJson:function(e,t){var n=function(n,a){void 0==t&&(t=!0);var i=this.videoWrappers[0],r=this.videoWrappers.length>1?this.videoWrappers[1]:null,o=(this.masterVideo(),this.slaveVideo(),this.container.getNode(this.backgroundId)),s=n.res,l=a&&a.res,u=this.getClosestRect(e.masterVideo,n.res),c=a&&this.getClosestRect(e.slaveVideo,a.res);if(this.hideAllLogos(),this.showLogos(e.logos),dynamic_cast("paella.ProfileFrameStrategy",this.profileFrameStrategy)){var d={width:$(this.domElement).width(),height:$(this.domElement).height()},p=u.width/d.width,h={width:s.w*p,height:s.h*p};if(u.left=Number(u.left),u.top=Number(u.top),u.width=Number(u.width),u.height=Number(u.height),u=this.profileFrameStrategy.adaptFrame(h,u),r){var m={width:l.w*p,height:l.h*p};c.left=Number(c.left),c.top=Number(c.top),c.width=Number(c.width),c.height=Number(c.height),c=this.profileFrameStrategy.adaptFrame(m,c)}}i.setRect(u,t),this.currentMasterVideoRect=u,i.setVisible(e.masterVideo.visible,t),this.currentMasterVideoRect.visible=!!/true/i.test(e.masterVideo.visible),this.currentMasterVideoRect.layer=parseInt(e.masterVideo.layer),r&&(r.setRect(c,t),this.currentSlaveVideoRect=c,this.currentSlaveVideoRect.visible=!!/true/i.test(e.slaveVideo.visible),this.currentSlaveVideoRect.layer=parseInt(e.slaveVideo.layer),r.setVisible(e.slaveVideo.visible,t),r.setLayer(e.slaveVideo.layer)),i.setLayer(e.masterVideo.layer),o.setImage(paella.utils.folders.profiles()+"/resources/"+e.background.content)},a=this;if(this.masterVideo())if(this.slaveVideo()){var i={};this.masterVideo().getVideoData().then(function(e){return i=e,a.slaveVideo().getVideoData()}).then(function(e){n.apply(a,[i,e])})}else this.masterVideo().getVideoData().then(function(e){n.apply(a,[e])})},resizePortrail:function(){var e=1==paella.player.isFullScreen()?$(window).width():$(this.domElement).width(),t=(new paella.RelativeVideoSize).proportionalHeight(e);this.container.domElement.style.width=e+"px",this.container.domElement.style.height=t+"px";var n=(1==paella.player.isFullScreen()?$(window).height():$(this.domElement).height())/2-t/2;this.container.domElement.style.top=n+"px"},resizeLandscape:function(){var e=1==paella.player.isFullScreen()?$(window).height():$(this.domElement).height(),t=(new paella.RelativeVideoSize).proportionalWidth(e);this.container.domElement.style.width=t+"px",this.container.domElement.style.height=e+"px",this.container.domElement.style.top="0px"},onresize:function(){$traceurRuntime.superGet(this,n.prototype,"onresize").call(this);var e=(new paella.RelativeVideoSize).aspectRatio();(1==paella.player.isFullScreen()?$(window).width():$(this.domElement).width())/(1==paella.player.isFullScreen()?$(window).height():$(this.domElement).height())>e?this.resizeLandscape():this.resizePortrail()}},{},e)}(paella.VideoContainerBase);paella.VideoContainer=n}(),function(){Class("paella.PluginManager",{targets:null,pluginList:[],eventDrivenPlugins:[],enabledPlugins:[],doResize:!0,setupPlugin:function(e){e.setup(),this.enabledPlugins.push(e),dynamic_cast("paella.UIPlugin",e)&&e.checkVisibility()},checkPluginsVisibility:function(){this.enabledPlugins.forEach(function(e){dynamic_cast("paella.UIPlugin",e)&&e.checkVisibility()})},initialize:function(){this.targets={};var e=this;paella.events.bind(paella.events.loadPlugins,function(t){e.loadPlugins("paella.DeferredLoadPlugin")}),new base.Timer(function(){paella.player&&paella.player.controls&&e.doResize&&paella.player.controls.onresize()},1e3).repeat=!0},setTarget:function(e,t){t.addPlugin&&(this.targets[e]=t)},getTarget:function(e){return"eventDriven"==e?this:this.targets[e]},registerPlugin:function(e){this.importLibraries(e),this.pluginList.push(e),this.pluginList.sort(function(e,t){return e.getIndex()-t.getIndex()})},importLibraries:function(e){e.getDependencies().forEach(function(e){var t=document.createElement("script");t.type="text/javascript",t.src="javascript/"+e+".js",document.head.appendChild(t)})},loadPlugins:function(e){if(void 0!=e){var t=this;this.foreach(function(n,a){n.isLoaded()||null!=dynamic_cast(e,n)&&a.enabled&&(base.log.debug("Load plugin ("+e+"): "+n.getName()),n.config=a,n.load(t))})}},foreach:function(e){var t=!1,n={};try{t=paella.player.config.plugins.enablePluginsByDefault}catch(e){}try{n=paella.player.config.plugins.list}catch(e){}this.pluginList.forEach(function(a){var i=a.getName(),r=n[i];r||(r={enabled:t}),e(a,r)})},addPlugin:function(e){var t=this;e.__added__||(e.__added__=!0,e.checkEnabled(function(n){if("eventDriven"==e.type&&n){paella.pluginManager.setupPlugin(e),t.eventDrivenPlugins.push(e);for(var a=e.getEvents(),i=function(t,n){e.onEvent(t.type,n)},r=0;r",this._i&&this.container.appendChild(this._i)},hideButton:function(){this.hideUI()},showButton:function(){this.showUI()},changeSubclass:function(e){this.subclass=e,this.container.className=this.getClassName()},changeIconClass:function(e){this._i.className="button-icon "+e},getClassName:function(){return paella.ButtonPlugin.kClassName+" "+this.getAlignment()+" "+this.subclass},getContainerClassName:function(){return this.getButtonType()==paella.ButtonPlugin.type.timeLineButton?paella.ButtonPlugin.kTimeLineClassName+" "+this.getSubclass():this.getButtonType()==paella.ButtonPlugin.type.popUpButton?paella.ButtonPlugin.kPopUpClassName+" "+this.getSubclass():void 0},setToolTip:function(e){this.button.setAttribute("title",e),this.button.setAttribute("aria-label",e)},getDefaultToolTip:function(){return""},isPopUpOpen:function(){return this.button.popUpIdentifier==this.containerManager.currentContainerId}}),paella.ButtonPlugin.alignment={left:"left",right:"right"},paella.ButtonPlugin.kClassName="buttonPlugin",paella.ButtonPlugin.kPopUpClassName="buttonPluginPopUp",paella.ButtonPlugin.kTimeLineClassName="buttonTimeLine",paella.ButtonPlugin.type={actionButton:1,popUpButton:2,timeLineButton:3},paella.ButtonPlugin.buildPluginButton=function(e,t){e.subclass=e.getSubclass();var n=document.createElement("div");n.className=e.getClassName(),n.id=t,n.innerHTML=''+e.getText()+"",n.setAttribute("tabindex",1e3+e.getIndex()),n.setAttribute("alt",""),n.setAttribute("role","button"),n.plugin=e,e.button=n,e.container=n,e.ui=n,e.setToolTip(e.getDefaultToolTip());var a=document.createElement("i");function i(e){paella.userTracking.log("paella:button:action",e.plugin.getName()),e.plugin.action(e)}return a.className="button-icon "+e.getIconClass(),n.appendChild(a),e._i=a,$(n).click(function(e){i(this)}),$(n).keyup(function(e){13==e.keyCode&&i(this)}),n},paella.ButtonPlugin.buildPluginPopUp=function(e,t,n){t.subclass=t.getSubclass();var a=document.createElement("div");return e.appendChild(a),a.className=t.getContainerClassName(),a.id=n,a.plugin=t,t.buildContent(a),a},Class("paella.VideoOverlayButtonPlugin",paella.ButtonPlugin,{type:"videoOverlayButton",getSubclass:function(){return"myVideoOverlayButtonPlugin "+this.getAlignment()},action:function(e){},getName:function(){return"VideoOverlayButtonPlugin"}}),Class("paella.EventDrivenPlugin",paella.EarlyLoadPlugin,{type:"eventDriven",initialize:function(){this.parent();for(var e=this.getEvents(),t=0;t=e)return n}},getCaptionById:function(e){if(void 0!=this._captions)for(var t=0;tr.end)||i.push({time:t.begin,content:t.content,score:e.score})}),t&&t(!1,i)})}}}),Class("paella.CaptionParserPlugIn",paella.FastLoadPlugin,{type:"captionParser",getIndex:function(){return-1},ext:[],parse:function(e,t,n){throw new Error("paella.CaptionParserPlugIn#parse must be overridden by subclass")}})}(),function(){var e=new(Class({_plugins:[],addPlugin:function(e){this._plugins.push(e)},initialize:function(){paella.pluginManager.setTarget("SearchServicePlugIn",this)}})),t=Class(base.AsyncLoaderCallback,{initialize:function(e,t){this.name="searchCallback",this.plugin=e,this.text=t},load:function(e,t){var n=this;this.plugin.search(this.text,function(a,i){a?t():(n.result=i,e())})}});paella.searchService={search:function(n,a){var i=new base.AsyncLoader;paella.userTracking.log("paella:searchService:search",n),e._plugins.forEach(function(e){i.addCallback(new t(e,n))}),i.load(function(){var e=[];Object.keys(i.callbackArray).forEach(function(t){e=e.concat(i.getCallback(t).result)}),a&&a(!1,e)},function(){a&&a(!0)})}},Class("paella.SearchServicePlugIn",paella.FastLoadPlugin,{type:"SearchServicePlugIn",getIndex:function(){return-1},search:function(e,t){throw new Error("paella.SearchServicePlugIn#search must be overridden by subclass")}})}(),function(){var e=new(Class({_plugins:[],addPlugin:function(e){var t=this;e.checkEnabled(function(n){n&&(e.setup(),t._plugins.push(e))})},initialize:function(){paella.pluginManager.setTarget("userTrackingSaverPlugIn",this)}}));paella.userTracking={},Class("paella.userTracking.SaverPlugIn",paella.FastLoadPlugin,{type:"userTrackingSaverPlugIn",getIndex:function(){return-1},checkEnabled:function(e){e(!0)},log:function(e,t){throw new Error("paella.userTracking.SaverPlugIn#log must be overridden by subclass")}});var t={};paella.userTracking.log=function(n,a){void 0!=t[n]&&t[n].cancel(),t[n]=new base.Timer(function(i){e._plugins.forEach(function(e){e.log(n,a)}),delete t[n]},500)},[paella.events.play,paella.events.pause,paella.events.endVideo,paella.events.showEditor,paella.events.hideEditor,paella.events.enterFullscreen,paella.events.exitFullscreen,paella.events.loadComplete].forEach(function(e){paella.events.bind(e,function(t,n){paella.userTracking.log(e)})}),[paella.events.showPopUp,paella.events.hidePopUp].forEach(function(e){paella.events.bind(e,function(t,n){paella.userTracking.log(e,n.identifier)})}),[paella.events.captionsEnabled,paella.events.captionsDisabled].forEach(function(e){paella.events.bind(e,function(t,n){var a;if(void 0!=n){var i=paella.captions.getCaptions(n);a={id:n,lang:i._lang,url:i._url}}paella.userTracking.log(e,a)})}),[paella.events.setProfile].forEach(function(e){paella.events.bind(e,function(t,n){paella.userTracking.log(e,n.profileName)})}),[paella.events.seekTo,paella.events.seekToTime].forEach(function(e){paella.events.bind(e,function(t,n){var a;try{JSON.stringify(n),a=n}catch(e){}paella.userTracking.log(e,a)})}),[paella.events.setVolume,paella.events.resize,paella.events.setPlaybackRate,paella.events.qualityChanged].forEach(function(e){paella.events.bind(e,function(t,n){var a;try{JSON.stringify(n),a=n}catch(e){}paella.userTracking.log(e,a)})})}(),Class("paella.TimeControl",paella.DomNode,{initialize:function(e){this.parent("div",e,{left:"0%"}),this.domElement.className="timeControlOld",this.domElement.className="timeControl";var t=this;paella.events.bind(paella.events.timeupdate,function(e,n){t.onTimeUpdate(n)})},onTimeUpdate:function(e){e.videoContainer,e.currentTime,e.duration;this.domElement.innerHTML=this.secondsToHours(parseInt(e.currentTime))},secondsToHours:function(e){var t=Math.floor(e/3600),n=Math.floor((e-3600*t)/60),a=e-3600*t-60*n;return t<10&&(t="0"+t),n<10&&(n="0"+n),a<10&&(a="0"+a),t+":"+n+":"+a}}),Class("paella.PlaybackBar",paella.DomNode,{playbackFullId:"",updatePlayBar:!0,timeControlId:"",_images:null,_keys:null,_prev:null,_next:null,_videoLength:null,_lastSrc:null,_aspectRatio:1.777777778,_hasSlides:null,_imgNode:null,_canvas:null,initialize:function(e){this.parent("div",e,{}),this.domElement.className="playbackBar",this.domElement.setAttribute("alt",""),this.domElement.setAttribute("aria-label","Timeline Slider"),this.domElement.setAttribute("role","slider"),this.domElement.setAttribute("aria-valuemin","0"),this.domElement.setAttribute("aria-valuemax","100"),this.domElement.setAttribute("aria-valuenow","0"),this.domElement.setAttribute("tabindex","1100"),$(this.domElement).keyup(function(e){var t=0,n=0;paella.player.videoContainer.currentTime().then(function(e){return t=e,paella.player.videoContainer.duration()}).then(function(a){var i;switch(n=a,e.keyCode){case 37:i=100*t/n-5,paella.player.videoContainer.seekTo(i);break;case 39:i=100*t/n+5,paella.player.videoContainer.seekTo(i)}})}),this.playbackFullId=e+"_full",this.timeControlId=e+"_timeControl";var t=new paella.DomNode("div",this.playbackFullId,{width:"0%"});t.domElement.className="playbackBarFull",this.addNode(t),this.addNode(new paella.TimeControl(this.timeControlId));var n=this;paella.events.bind(paella.events.timeupdate,function(e,t){n.onTimeUpdate(t)}),$(this.domElement).bind("mousedown",function(e){paella.utils.mouseManager.down(n,e),e.stopPropagation()}),$(t.domElement).bind("mousedown",function(e){paella.utils.mouseManager.down(n,e),e.stopPropagation()}),base.userAgent.browser.IsMobileVersion||($(this.domElement).bind("mousemove",function(e){n.movePassive(e),paella.utils.mouseManager.move(e)}),$(t.domElement).bind("mousemove",function(e){paella.utils.mouseManager.move(e)}),$(this.domElement).bind("mouseout",function(e){n.mouseOut(e)})),$(this.domElement).bind("mouseup",function(e){paella.utils.mouseManager.up(e)}),$(t.domElement).bind("mouseup",function(e){paella.utils.mouseManager.up(e)}),paella.player.isLiveStream()&&$(this.domElement).hide()},mouseOut:function(e){this._hasSlides?$("#divTimeImageOverlay").remove():$("#divTimeOverlay").remove()},drawTimeMarks:function(){var e=this,t={};paella.player.videoContainer.trimming().then(function(n){return t=n,e.imageSetup()}).then(function(){var n=e,a=(t.enabled?(t.end,t.start):e._videoLength,$("#playerContainer_controls_playback_playbackBar"));e.clearCanvas(),e._keys&&paella.player.config.player.slidesMarks.enabled&&e._keys.forEach(function(e){var i=parseInt(e)-t.start;if(i>0){var r=i*a.width()/n._videoLength;n.drawTimeMark(r)}})})},drawTimeMark:function(e){var t=this.getCanvasContext();t.fillStyle=paella.player.config.player.slidesMarks.color,t.fillRect(e,0,1,12)},clearCanvas:function(){this._canvas&&this.getCanvasContext().clearRect(0,0,this._canvas.width,this._canvas.height)},getCanvas:function(){if(!this._canvas){var e=$("#playerContainer_controls_playback_playbackBar"),t=document.createElement("canvas");t.className="playerContainer_controls_playback_playbackBar_canvas",t.id="playerContainer_controls_playback_playbackBar_canvas",t.width=e.width();t.height=e.height();e.prepend(t),this._canvas=document.getElementById("playerContainer_controls_playback_playbackBar_canvas")}return this._canvas},getCanvasContext:function(){return this.getCanvas().getContext("2d")},movePassive:function(e){var t=this;paella.player.videoContainer.duration();var n=0;paella.player.videoContainer.duration().then(function(e){return n=e,paella.player.videoContainer.trimming()}).then(function(a){!function(n,a){var i=$(t.domElement),r=i.offset(),o=i.width(),s=e.clientX-r.left,l=100*(s=s<0?0:s)/o*n/100;a.enabled&&(l+=a.start);var u=Math.floor((l-a.start)/3600)%24;u=("00"+u).slice(u.toString().length);var c=Math.floor((l-a.start)/60)%60;c=("00"+c).slice(c.toString().length);var d=Math.floor((l-a.start)%60),p=u+":"+c+":"+(d=("00"+d).slice(d.toString().length));if(t._hasSlides?(0==$("#divTimeImageOverlay").length?t.setupTimeImageOverlay(p,r.top,o):$("#divTimeOverlay")[0].innerHTML=p,t.imageUpdate(l)):0==$("#divTimeOverlay").length?t.setupTimeOnly(p,r.top,o):$("#divTimeOverlay")[0].innerHTML=p,t._hasSlides){var h=$("#divTimeImageOverlay").width(),m=e.clientX-h/2;e.clientX>h/2+r.left&&e.clientXf/2+r.left&&e.clientXthis._next||e0?n:0],i=t[n+2],r=t[n];return i=void 0==i?t.length-1:parseInt(i),this._next=i,r=void 0==r?0:parseInt(r),this._prev=r,a=parseInt(a),!!this._images[a]&&(this._images[a].url||this._images[a].url)},setupTimeImageOverlay:function(e,t,n){var a=document.createElement("div");a.className="divTimeImageOverlay",a.id="divTimeImageOverlay";var i=Math.round(n/10);if(a.style.width=Math.round(i*this._aspectRatio)+"px",this._hasSlides){var r=document.createElement("img");r.className="imgOverlay",r.id="imgOverlay",this._imgNode=r,a.appendChild(r)}var o=document.createElement("div");o.className="divTimeOverlay",o.style.top=t-20+"px",o.id="divTimeOverlay",o.innerHTML=e,a.appendChild(o),$(this.domElement).parent().append(a)},setupTimeOnly:function(e,t,n){var a=document.createElement("div");a.className="divTimeOverlay",a.style.top=t-20+"px",a.id="divTimeOverlay",a.innerHTML=e,$(this.domElement).parent().append(a)},playbackFull:function(){return this.getNode(this.playbackFullId)},timeControl:function(){return this.getNode(this.timeControlId)},setPlaybackPosition:function(e){this.playbackFull().domElement.style.width=e+"%"},isSeeking:function(){return!this.updatePlayBar},onTimeUpdate:function(e){if(this.updatePlayBar){var t=e.currentTime,n=e.duration;this.setPlaybackPosition(100*t/n)}},down:function(e,t,n){this.updatePlayBar=!1,this.move(e,t,n)},move:function(e,t,n){var a=$(this.domElement).width(),i=t-$(this.domElement).offset().left;i=i<0?0:i>a?100:100*i/a,this.setPlaybackPosition(i)},up:function(e,t,n){var a=$(this.domElement).width(),i=t-$(this.domElement).offset().left;i=i<0?0:i>a?100:100*i/a,paella.player.videoContainer.seekTo(i),this.updatePlayBar=!0},onresize:function(){this.drawTimeMarks()}}),Class("paella.PlaybackControl",paella.DomNode,{playbackBarId:"",pluginsContainer:null,_popUpPluginContainer:null,_timeLinePluginContainer:null,playbackPluginsWidth:0,popupPluginsWidth:0,minPlaybackBarSize:120,playbackBarInstance:null,buttonPlugins:[],addPlugin:function(e){var t=this,n="buttonPlugin"+this.buttonPlugins.length;this.buttonPlugins.push(e);var a=paella.ButtonPlugin.buildPluginButton(e,n);e.button=a,this.pluginsContainer.domElement.appendChild(a),$(a).hide(),e.checkEnabled(function(n){var i;if(n){$(e.button).show(),paella.pluginManager.setupPlugin(e);var r="buttonPlugin"+t.buttonPlugins.length;if(e.getButtonType()==paella.ButtonPlugin.type.popUpButton){i=t.popUpPluginContainer.domElement;var o=paella.ButtonPlugin.buildPluginPopUp(i,e,r+"_container");t.popUpPluginContainer.registerContainer(e.getName(),o,a,e)}else if(e.getButtonType()==paella.ButtonPlugin.type.timeLineButton){i=t.timeLinePluginContainer.domElement;var s=paella.ButtonPlugin.buildPluginPopUp(i,e,r+"_timeline");t.timeLinePluginContainer.registerContainer(e.getName(),s,a,e)}}else t.pluginsContainer.domElement.removeChild(e.button)})},initialize:function(e){this.parent("div",e,{}),this.domElement.className="playbackControls",this.playbackBarId=e+"_playbackBar";this.pluginsContainer=new paella.DomNode("div",e+"_playbackBarPlugins"),this.pluginsContainer.domElement.className="playbackBarPlugins",this.pluginsContainer.domElement.setAttribute("role","toolbar"),this.addNode(this.pluginsContainer),this.addNode(new paella.PlaybackBar(this.playbackBarId)),paella.pluginManager.setTarget("button",this),Object.defineProperty(this,"popUpPluginContainer",{get:function(){return this._popUpPluginContainer||(this._popUpPluginContainer=new paella.PopUpContainer(e+"_popUpPluginContainer","popUpPluginContainer"),this.addNode(this._popUpPluginContainer)),this._popUpPluginContainer}}),Object.defineProperty(this,"timeLinePluginContainer",{get:function(){return this._timeLinePluginContainer||(this._timeLinePluginContainer=new paella.TimelineContainer(e+"_timelinePluginContainer","timelinePluginContainer"),this.addNode(this._timeLinePluginContainer)),this._timeLinePluginContainer}})},showPopUp:function(e,t){this.popUpPluginContainer.showContainer(e,t),this.timeLinePluginContainer.showContainer(e,t)},hidePopUp:function(e,t){this.popUpPluginContainer.hideContainer(e,t),this.timeLinePluginContainer.hideContainer(e,t)},playbackBar:function(){return null==this.playbackBarInstance&&(this.playbackBarInstance=this.getNode(this.playbackBarId)),this.playbackBarInstance},onresize:function(){var e=$(this.domElement).width();base.log.debug("resize playback bar (width="+e+")");for(var t=0;t0&&e1?1:e,paella.player.videoContainer.setVolume({master:e,slave:0})})},volumeDown:function(){paella.player.videoContainer.volume().then(function(e){e=(e-=.1)<0?0:e,paella.player.videoContainer.setVolume({master:e,slave:0})})}}),paella.keyManager=new paella.KeyManager,Class("paella.VideoLoader",{metadata:{title:"",duration:0},streams:[],frameList:[],loadStatus:!1,codecStatus:!1,getMetadata:function(){return this.metadata},getVideoId:function(){return paella.initDelegate.getId()},getVideoUrl:function(){return""},getDataUrl:function(){},loadVideo:function(e){e()}}),Class("paella.AccessControl",{canRead:function(){return paella_DeferredResolved(!0)},canWrite:function(){return paella_DeferredResolved(!1)},userData:function(){return paella_DeferredResolved({username:"anonymous",name:"Anonymous",avatar:paella.utils.folders.resources()+"/images/default_avatar.png",isAnonymous:!0})},getAuthenticationUrl:function(e){var t=this._authParams.authCallbackName&&window[this._authParams.authCallbackName];return!t&&paella.player.config.auth&&(t=paella.player.config.auth.authCallbackName&&window[paella.player.config.auth.authCallbackName]),"function"==typeof t?t(e):""}}),Class("paella.PlayerBase",{config:null,playerId:"",mainContainer:null,videoContainer:null,controls:null,accessControl:null,checkCompatibility:function(){var e="";if(base.parameters.get("ignoreBrowserCheck"))return!0;if(base.userAgent.browser.IsMobileVersion)return!0;if(base.userAgent.browser.Chrome||base.userAgent.browser.Safari||base.userAgent.browser.Firefox||base.userAgent.browser.Opera||base.userAgent.browser.Edge||base.userAgent.browser.Explorer&&base.userAgent.browser.Version.major>=9)return!0;var t=base.dictionary.translate("It seems that your browser is not HTML 5 compatible");return paella.events.trigger(paella.events.error,{error:t}),e=t+'',e+='",paella.messageBox.showError(e,{height:"40%"}),!1},initialize:function(e){if(Object.defineProperty(this,"repoUrl",{get:function(){return paella.player.videoLoader._url||""}}),Object.defineProperty(this,"videoUrl",{get:function(){return paella.player.videoLoader.getVideoUrl()}}),Object.defineProperty(this,"dataUrl",{get:function(){return paella.player.videoLoader.getDataUrl()}}),Object.defineProperty(this,"videoId",{get:function(){return paella.initDelegate.getId()}}),void 0!=base.parameters.get("log")){var t=0;switch(base.parameters.get("log")){case"error":t=base.Log.kLevelError;break;case"warn":t=base.Log.kLevelWarning;break;case"debug":t=base.Log.kLevelDebug;break;case"log":case"true":t=base.Log.kLevelLog}base.log.setLevel(t)}if(this.checkCompatibility()){paella.player=this,this.playerId=e,this.mainContainer=$("#"+this.playerId)[0];var n=this;paella.events.bind(paella.events.loadComplete,function(e,t){n.loadComplete(e,t)})}else base.log.debug("It seems that your browser is not HTML 5 compatible")},loadComplete:function(e,t){},auth:{login:function(e){e=e||window.location.href;var t=paella.initDelegate.initParams.accessControl.getAuthenticationUrl(e);t&&(window.location.href=t)},canRead:function(){return paella.initDelegate.initParams.accessControl.canRead()},canWrite:function(){return paella.initDelegate.initParams.accessControl.canWrite()},userData:function(){return paella.initDelegate.initParams.accessControl.userData()}}}),Class("paella.InitDelegate",{initParams:{configUrl:paella.baseUrl+"config/config.json",dictionaryUrl:paella.baseUrl+"localization/paella",accessControl:null,videoLoader:null},initialize:function(e){if(2==arguments.length&&(this._config=arguments[0]),e)for(var t in e)this.initParams[t]=e[t]},getId:function(){return base.parameters.get("id")||"noid"},loadDictionary:function(){var e=this;return new Promise(function(t){base.ajax.get({url:e.initParams.dictionaryUrl+"_"+base.dictionary.currentLanguage()+".json"},function(e,n,a){base.dictionary.addDictionary(e),t(e)},function(e,n,a){t()})})},loadConfig:function(){var e=this,t=function(t){var n=Class.fromString(t.player.accessControlClass||"paella.AccessControl");e.initParams.accessControl=new n};return this.initParams.config?new Promise(function(n){t(e.initParams.config),n(e.initParams.config)}):this.initParams.loadConfig?new Promise(function(n,a){e.initParams.loadConfig(e.initParams.configUrl).then(function(e){t(e),n(e)}).catch(function(e){a(e)})}):new Promise(function(n,a){var i=e.initParams.configUrl,r={};r.url=i,base.ajax.get(r,function(e,a,i){try{e=JSON.parse(e)}catch(e){}t(e),n(e)},function(e,t,n){paella.messageBox.showError(base.dictionary.translate("Error! Config file not found. Please configure paella!"))})})}});var paellaPlayer=null;paella.plugins={},paella.plugins.events={},paella.initDelegate=null,Class("paella.PaellaPlayer",paella.PlayerBase,{player:null,videoIdentifier:"",loader:null,videoData:null,getPlayerMode:function(){return paella.player.isFullScreen()?paella.PaellaPlayer.mode.fullscreen:window.self!==window.top?paella.PaellaPlayer.mode.embed:paella.PaellaPlayer.mode.standard},checkFullScreenCapability:function(){var e=document.getElementById(paella.player.mainContainer.id);return!!(e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.requestFullScreen)||!(!base.userAgent.browser.IsMobileVersion||!paella.player.videoContainer.isMonostream)},addFullScreenListeners:function(){var e=this,t=function(){setTimeout(function(){paella.pluginManager.checkPluginsVisibility()},1e3);var t=document.getElementById(paella.player.mainContainer.id);paella.player.isFullScreen()?(t.style.width="100%",t.style.height="100%"):(t.style.width="",t.style.height=""),e.isFullScreen()?paella.events.trigger(paella.events.enterFullscreen):paella.events.trigger(paella.events.exitFullscreen)};this.eventFullScreenListenerAdded||(this.eventFullScreenListenerAdded=!0,document.addEventListener("fullscreenchange",t,!1),document.addEventListener("webkitfullscreenchange",t,!1),document.addEventListener("mozfullscreenchange",t,!1),document.addEventListener("MSFullscreenChange",t,!1),document.addEventListener("webkitendfullscreen",t,!1))},isFullScreen:function(){var e=!0===document.webkitIsFullScreen,t=void 0!==document.msFullscreenElement&&null!==document.msFullscreenElement,n=!0===document.mozFullScreen,a=void 0!==document.fullScreenElement&&null!==document.fullScreenElement;return e||t||n||a},goFullScreen:function(){if(!this.isFullScreen())if(base.userAgent.system.iOS)paella.player.videoContainer.masterVideo().goFullScreen();else{var e=document.getElementById(paella.player.mainContainer.id);e.webkitRequestFullScreen?e.webkitRequestFullScreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.requestFullScreen&&e.requestFullScreen()}},exitFullScreen:function(){this.isFullScreen()&&(document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen()?document.msExitFullscreen():document.cancelFullScreen&&document.cancelFullScreen())},setProfile:function(e,t){this.videoContainer.setProfile(e,t).then(function(e){return paella.player.getProfile(e)}).then(function(t){paella.player.videoContainer.isMonostream||base.cookies.set("lastProfile",e),paella.events.trigger(paella.events.setProfile,{profileName:e})})},getProfile:function(e){return this.videoContainer.getProfile(e)},initialize:function(e){if(this.parent(e),this.playerId==e){this.loadPaellaPlayer()}Object.defineProperty(this,"selectedProfile",{get:function(){return this.videoContainer.getCurrentProfileName()}})},loadPaellaPlayer:function(){var e=this;this.loader=new paella.LoaderContainer("paellaPlayer_loader"),$("body")[0].appendChild(this.loader.domElement),paella.events.trigger(paella.events.loadStarted),paella.initDelegate.loadDictionary().then(function(){return paella.initDelegate.loadConfig()}).then(function(t){if(e.accessControl=paella.initDelegate.initParams.accessControl,e.videoLoader=paella.initDelegate.initParams.videoLoader,e.onLoadConfig(t),t.skin){var n=t.skin.default||"dark";paella.utils.skin.restore(n)}})},onLoadConfig:function(e){if(paella.data=new paella.Data(e),paella.pluginManager.registerPlugins(),this.config=e,this.videoIdentifier=paella.initDelegate.getId(),this.videoIdentifier){if(this.mainContainer){this.videoContainer=new paella.VideoContainer(this.playerId+"_videoContainer");var t=new paella.BestFitVideoQualityStrategy;try{var n=this.config.player.videoQualityStrategy;t=new(Class.fromString(n))}catch(e){base.log.warning("Error selecting video quality strategy: strategy not found")}this.videoContainer.setVideoQualityStrategy(t),this.mainContainer.appendChild(this.videoContainer.domElement)}$(window).resize(function(e){paella.player.onresize()}),this.onload()}paella.pluginManager.loadPlugins("paella.FastLoadPlugin")},onload:function(){var e=this,t=(this.accessControl,!1),n={};this.accessControl.canRead().then(function(n){return t=n,e.accessControl.userData()}).then(function(a){if(n=a,t)e.loadVideo(),e.videoContainer.publishVideo();else if(n.isAnonymous){var i=paella.initDelegate.initParams.accessControl.getAuthenticationUrl("player/?id="+paella.player.videoIdentifier),r="
"+base.dictionary.translate("You are not authorized to view this resource")+"
";i&&(r+='"),e.unloadAll(r)}else{var o=base.dictionary.translate("You are not authorized to view this resource");e.unloadAll(o),paella.events.trigger(paella.events.error,{error:o})}}).catch(function(t){var n=base.dictionary.translate(t);e.unloadAll(n),paella.events.trigger(paella.events.error,{error:n})})},onresize:function(){this.videoContainer.onresize(),this.controls&&this.controls.onresize();var e=paella.utils.cookies.get("lastProfile");e?this.setProfile(e,!1):this.setProfile(paella.Profiles.getDefaultProfile(),!1),paella.events.trigger(paella.events.resize,{width:$(this.videoContainer.domElement).width(),height:$(this.videoContainer.domElement).height()})},unloadAll:function(e){$("#paellaPlayer_loader")[0];this.mainContainer.innerHTML="",paella.messageBox.showError(e)},reloadVideos:function(e,t){this.videoContainer&&(this.videoContainer.reloadVideos(e,t),this.onresize())},loadVideo:function(){if(this.videoIdentifier){var e=this,t=paella.player.videoLoader;this.onresize(),t.loadVideo(function(){e.videoContainer.setStreamData(t.streams).then(function(){paella.events.trigger(paella.events.loadComplete),e.addFullScreenListeners(),e.onresize(),e.videoContainer.autoplay()&&e.play()}).catch(function(e){console.log(e)})})}},showPlaybackBar:function(){this.controls||(this.controls=new paella.ControlsContainer(this.playerId+"_controls"),this.mainContainer.appendChild(this.controls.domElement),this.controls.onresize(),paella.events.trigger(paella.events.loadPlugins,{pluginManager:paella.pluginManager}))},isLiveStream:function(){if(void 0===this._isLiveStream){var e=paella.initDelegate.initParams.videoLoader,t=function(e,t){if(e.length>t){var n=e[t];for(var a in n.sources)if("object"==$traceurRuntime.typeof(n.sources[a]))for(var i=0;i=2&&(t=e[1].preview),n){var a=paella.player.videoContainer.overlayContainer.getMasterRect();this.masterPreviewElem=document.createElement("img"),this.masterPreviewElem.src=n,paella.player.videoContainer.overlayContainer.addElement(this.masterPreviewElem,a)}if(t){var i=paella.player.videoContainer.overlayContainer.getSlaveRect();this.slavePreviewElem=document.createElement("img"),this.slavePreviewElem.src=t,paella.player.videoContainer.overlayContainer.addElement(this.slavePreviewElem,i)}paella.events.bind(paella.events.timeUpdate,function(e){paella.player.unloadPreviews()})},unloadPreviews:function(){this.masterPreviewElem&&(paella.player.videoContainer.overlayContainer.removeElement(this.masterPreviewElem),this.masterPreviewElem=null),this.slavePreviewElem&&(paella.player.videoContainer.overlayContainer.removeElement(this.slavePreviewElem),this.slavePreviewElem=null)},loadComplete:function(e,t){paella.pluginManager.loadPlugins("paella.EarlyLoadPlugin"),paella.player.videoContainer._autoplay&&this.play()},play:function(){if(!this.controls){this.showPlaybackBar();var e=base.parameters.get("time"),t=base.hashParams.get("time"),n=t||(e||"0s"),a=paella.utils.timeParse.timeToSeconds(n);a&&paella.player.videoContainer.setStartTime(a),paella.events.trigger(paella.events.controlBarLoaded),this.controls.onresize()}return this.videoContainer.play()},pause:function(){return this.videoContainer.pause()},playing:function(){var e=this;return new Promise(function(t){e.paused().then(function(e){t(!e)})})},paused:function(){return this.videoContainer.paused()}});var PaellaPlayer=paella.PaellaPlayer;function initPaellaEngage(e,t){t||(t=new paella.InitDelegate),paella.initDelegate=t;navigator.language||window.navigator.userLanguage;paellaPlayer=new PaellaPlayer(e,paella.initDelegate)}function DeprecatedClass(e,t,n){Class(e,n,{initialize:function(){base.log.warning(e+" is deprecated, use "+t+" instead."),this.parent.apply(this,arguments)}})}function DeprecatedFunc(e,t,n){return function(){base.log.warning(e+" is deprecated, use "+t+" instead."),n.apply(this,arguments)}}function buildChromaVideoCanvas(e,t){var n=new(function(e){return $traceurRuntime.createClass(function e(t){$traceurRuntime.superConstructor(e).call(this),this.stream=t,this._chroma=bg.Color.White(),this._crop=new bg.Vector4(.3,.01,.3,.01),this._transform=bg.Matrix4.Identity().translate(.6,-.04,0),this._bias=.01},{get chroma(){return this._chroma},get bias(){return this._bias},get crop(){return this._crop},get transform(){return this._transform},set chroma(e){this._chroma=e},set bias(e){this._bias=e},set crop(e){this._crop=e},set transform(e){this._transform=e},get video(){return this.texture?this.texture.video:null},loaded:function(){var e=this;return new Promise(function(t){var n=function(){e.video?t(e):setTimeout(n,100)};n()})},buildShape:function(){this.plist=new bg.base.PolyList(this.gl),this.plist.vertex=[-1,-1,0,1,-1,0,1,1,0,-1,1,0],this.plist.texCoord0=[0,0,1,0,1,1,0,1],this.plist.index=[0,1,2,2,3,0],this.plist.build()},buildShader:function(){this.shader=new bg.base.Shader(this.gl),this.shader.addShaderSource(bg.base.ShaderType.VERTEX,"\n\t\t\t\t\tattribute vec4 position;\n\t\t\t\t\tattribute vec2 texCoord;\n\t\t\t\t\tuniform mat4 inTransform;\n\t\t\t\t\tvarying vec2 vTexCoord;\n\t\t\t\t\tvoid main() {\n\t\t\t\t\t\tgl_Position = inTransform * position;\n\t\t\t\t\t\tvTexCoord = texCoord;\n\t\t\t\t\t}\n\t\t\t\t"),this.shader.addShaderSource(bg.base.ShaderType.FRAGMENT,"\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t\tvarying vec2 vTexCoord;\n\t\t\t\t\tuniform sampler2D inTexture;\n\t\t\t\t\tuniform vec4 inChroma;\n\t\t\t\t\tuniform float inBias;\n\t\t\t\t\tuniform vec4 inCrop;\n\t\t\t\t\tvoid main() {\n\t\t\t\t\t\tvec4 result = texture2D(inTexture,vTexCoord);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ((result.r>=inChroma.r-inBias && result.r<=inChroma.r+inBias &&\n\t\t\t\t\t\t\tresult.g>=inChroma.g-inBias && result.g<=inChroma.g+inBias &&\n\t\t\t\t\t\t\tresult.b>=inChroma.b-inBias && result.b<=inChroma.b+inBias) ||\n\t\t\t\t\t\t\t(vTexCoord.xinCrop.z || vTexCoord.yinCrop.y)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdiscard;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tgl_FragColor = result;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t"),status=this.shader.link(),this.shader.status||(console.log(this.shader.compileError),console.log(this.shader.linkError)),this.shader.initVars(["position","texCoord"],["inTransform","inTexture","inChroma","inBias","inCrop"])},init:function(){var e=this;bg.Engine.Set(new bg.webgl1.Engine(this.gl)),bg.base.Loader.RegisterPlugin(new bg.base.VideoTextureLoaderPlugin),this.buildShape(),this.buildShader(),this.pipeline=new bg.base.Pipeline(this.gl),bg.base.Pipeline.SetCurrent(this.pipeline),this.pipeline.clearColor=bg.Color.Transparent(),bg.base.Loader.Load(this.gl,this.stream.src).then(function(t){e.texture=t})},frame:function(e){this.texture&&this.texture.update()},display:function(){this.pipeline.clearBuffers(bg.base.ClearBuffers.COLOR|bg.base.ClearBuffers.DEPTH),this.texture&&(this.shader.setActive(),this.shader.setInputBuffer("position",this.plist.vertexBuffer,3),this.shader.setInputBuffer("texCoord",this.plist.texCoord0Buffer,2),this.shader.setMatrix4("inTransform",this.transform),this.shader.setTexture("inTexture",this.texture||bg.base.TextureCache.WhiteTexture(this.gl),bg.base.TextureUnit.TEXTURE_0),this.shader.setVector4("inChroma",this.chroma),this.shader.setValueFloat("inBias",this.bias),this.shader.setVector4("inCrop",new bg.Vector4(this.crop.x,1-this.crop.y,1-this.crop.z,this.crop.w)),this.plist.draw(),this.shader.disableInputBuffer("position"),this.shader.disableInputBuffer("texCoord"),this.shader.clearActive())},reshape:function(e,t){var n=this.canvas.domElement;n.width=e,n.height=t,this.pipeline.viewport=new bg.Viewport(0,0,e,t)},mouseMove:function(e){this.postRedisplay()}},{},e)}(bg.app.WindowController))(e),a=bg.app.MainLoop.singleton;return a.updateMode=bg.app.FrameUpdate.AUTO,a.canvas=t,a.run(n),n.loaded()}paella.PaellaPlayer.mode={standard:"standard",fullscreen:"fullscreen",embed:"embed"},Class("paella.DefaultVideoLoader",paella.VideoLoader,{_url:null,initialize:function(e){if("object"==$traceurRuntime.typeof(e))this._data=e;else try{this._data=JSON.parse(e)}catch(t){this._url=e}},getVideoUrl:function(){return paella.initDelegate.initParams.videoUrl?"function"==typeof paella.initDelegate.initParams.videoUrl?paella.initDelegate.initParams.videoUrl():paella.initDelegate.initParams.videoUrl:(/\/$/.test(this._url)?this._url:this._url+"/")+paella.initDelegate.getId()+"/"},getDataUrl:function(){return paella.initDelegate.initParams.dataUrl?"function"==typeof paella.initDelegate.initParams.dataUrl?paella.initDelegate.initParams.dataUrl():paella.initDelegate.initParams.dataUrl:this.getVideoUrl()+"data.json"},loadVideo:function(e){var t=this,n=paella.initDelegate.initParams.loadVideo;if(this._data)this.loadVideoData(this._data,e);else if(n)n().then(function(n){t._data=n,t.loadVideoData(t._data,e)});else if(this._url){var a=this;base.ajax.get({url:this.getDataUrl()},function(t,n,i){if("string"==typeof t)try{t=JSON.parse(t)}catch(e){}a._data=t,a.loadVideoData(a._data,e)},function(e,t,n){switch(n){case 401:paella.messageBox.showError(base.dictionary.translate("You are not logged in"));break;case 403:paella.messageBox.showError(base.dictionary.translate("You are not authorized to view this resource"));break;case 404:paella.messageBox.showError(base.dictionary.translate("The specified video identifier does not exist"));break;default:paella.messageBox.showError(base.dictionary.translate("Could not load the video"))}})}},loadVideoData:function(e,t){var n=this;e.metadata&&(this.metadata=e.metadata),e.streams&&e.streams.forEach(function(e){n.loadStream(e)}),e.frameList&&this.loadFrameData(e),e.captions&&this.loadCaptions(e.captions),e.blackboard&&this.loadBlackboard(e.streams[0],e.blackboard),this.streams=e.streams,this.frameList=e.frameList,this.loadStatus=this.streams.length>0,t()},loadFrameData:function(e){var t=this;if(e.frameList&&e.frameList.forEach){var n={};e.frameList.forEach(function(e){/^[a-zA-Z]+:\/\//.test(e.url)||/^data:/.test(e.url)||(e.url=t.getVideoUrl()+e.url),!e.thumb||/^[a-zA-Z]+:\/\//.test(e.thumb)||/^data:/.test(e.thumb)||(e.thumb=t.getVideoUrl()+e.thumb);var a=e.time;n[a]=e}),e.frameList=n}},loadStream:function(e){var t=this;for(var n in!e.preview||/^[a-zA-Z]+:\/\//.test(e.preview)||/^data:/.test(e.preview)||(e.preview=t.getVideoUrl()+e.preview),e.sources.image&&e.sources.image.forEach(function(e){if(e.frames.forEach){var n={};e.frames.forEach(function(e){!e.src||/^[a-zA-Z]+:\/\//.test(e.src)||/^data:/.test(e.src)||(e.src=t.getVideoUrl()+e.src),!e.thumb||/^[a-zA-Z]+:\/\//.test(e.thumb)||/^data:/.test(e.thumb)||(e.thumb=t.getVideoUrl()+e.thumb);var a="frame_"+e.time;n[a]=e.src}),e.frames=n}}),e.sources){if(e.sources[n]){if("image"!=n)e.sources[n].forEach(function(e){"string"==typeof e.src&&null==e.src.match(/^[a-zA-Z\:]+\:\/\//gi)&&(e.src=t.getVideoUrl()+e.src),e.type=e.mimetype})}else delete e.sources[n]}},loadCaptions:function(e){if(e)for(var t=0;t ([0-9]{2}:)?[0-9]{2}:[0-9]{2}.[0-9]{3})/.test(u)?(s=!1,void 0!=a&&(i.push(a),o++),a={id:o,begin:this.parseTimeTextToSeg(u.split("--\x3e")[0]),end:this.parseTimeTextToSeg(u.split("--\x3e")[1])}):void 0===a||s||(u=(u=u.replace(/^- /,"")).replace(/<[^>]*>/g,""),void 0===a.content?a.content=u:a.content+="
"+u)))}i.push(a),i.length>0?n(!1,i):n(!0)},parseTimeTextToSeg:function(e){for(var t=0,n=1,a=(e=/(([0-9]{2}:)?[0-9]{2}:[0-9]{2}.[0-9]{3})/.exec(e))[0].split(":"),i=a.length-1;i>=0;i--)n=Math.pow(60,a.length-1-i),t+=a[i]*n;return t}},{},e)}(paella.CaptionParserPlugIn)}),Class("paella.plugins.xAPISaverPlugin",paella.userTracking.SaverPlugIn,{getName:function(){return"es.teltek.paella.usertracking.xAPISaverPlugin"},setup:function(){this.endpoint=this.config.endpoint,this.auth=this.config.auth,this.user_info={},this.paused=!0,this.played_segments="",this.played_segments_segment_start=null,this.played_segments_segment_end=null,this.progress=0,this.duration=0,this.current_time=[],this.completed=!1,this.volume=null,this.speed=null,this.language="us-US",this.quality=null,this.fullscreen=!1,this.title="No title available",this.description="",this.user_agent="",this.total_time=0,this.total_time_start=0,this.total_time_end=0,this.session_id="";var e=this;this._loadDeps().then(function(){var t={endpoint:e.endpoint,auth:"Basic "+toBase64(e.auth)};ADL.XAPIWrapper.changeConfig(t)}),paella.events.bind(paella.events.timeUpdate,function(t,n){e.current_time.push(n.currentTime),e.current_time.length>=10&&(e.current_time=e.current_time.slice(-10));var a=Math.round(e.current_time[0]),i=Math.round(e.current_time[9]);0!==n.currentTime&&a+1>=i&&i-1>=a&&(e.progress=e.get_progress(n.currentTime,n.duration),e.progress>=.95&&!1===e.completed&&(e.completed=!0,e.end_played_segment(n.currentTime),e.start_played_segment(n.currentTime),e.send_completed(n.currentTime,e.progress)))})},get_session_data:function(){var e=ADL.XAPIWrapper.searchParams(),t=JSON.stringify({mbox:this.user_info.email}),n=new Date;n.setDate(n.getDate()-1),n=n.toISOString(),e.activity=window.location.href,e.verb="http://adlnet.gov/expapi/verbs/terminated",e.since=n,e.limit=1,e.agent=t;var a=ADL.XAPIWrapper.getStatements(e);1===a.statements.length?(this.played_segments=a.statements[0].result.extensions["https://w3id.org/xapi/video/extensions/played-segments"],this.progress=a.statements[0].result.extensions["https://w3id.org/xapi/video/extensions/progress"],ADL.XAPIWrapper.lrs.registration=a.statements[0].context.registration):ADL.XAPIWrapper.lrs.registration=ADL.ruuid()},getCookie:function(e){for(var t=e+"=",n=decodeURIComponent(document.cookie).split(";"),a=0;a=n+1}));var i=a.filter(Number).pop();this.current_time=[],this.current_time.push(n),e.progress=e.get_progress(i,e.duration),this.paused||(this.end_played_segment(i),this.start_played_segment(n));var r={verb:{id:"https://w3id.org/xapi/video/verbs/seeked",description:"seeked"},result:{extensions:{"https://w3id.org/xapi/video/extensions/time-from":i,"https://w3id.org/xapi/video/extensions/time-to":n,"https://w3id.org/xapi/video/extensions/progress":e.progress,"https://w3id.org/xapi/video/extensions/played-segments":e.played_segments}}};e.send(r)},send_completed:function(e,t){var n={verb:{id:"http://adlnet.gov/xapi/verbs/completed",description:"completed"},result:{completion:!0,success:!0,duration:"PT"+this.total_time+"S",extensions:{"https://w3id.org/xapi/video/extensions/time":e,"https://w3id.org/xapi/video/extensions/progress":t,"https://w3id.org/xapi/video/extensions/played-segments":this.played_segments}}};this.send(n)},send_interacted:function(e,t){var n={verb:{id:"http://adlnet.gov/expapi/verbs/interacted",description:"interacted"},result:{extensions:{"https://w3id.org/xapi/video/extensions/time":e}},interacted:t};this.send(n)},start_played_segment:function(e){this.played_segments_segment_start=e},end_played_segment:function(e){var t;(t=""===this.played_segments?[]:this.played_segments.split("[,]")).push(this.played_segments_segment_start+"[.]"+e),this.played_segments=t.join("[,]"),this.played_segments_segment_end=e},format_float:function(e){return e=parseFloat(e),parseFloat(e.toFixed(3))},get_title:function(){paella.player.videoLoader.getMetadata().i18nTitle?this.title=paella.player.videoLoader.getMetadata().i18nTitle:paella.player.videoLoader.getMetadata().title&&(this.title=paella.player.videoLoader.getMetadata().title)},get_description:function(){paella.player.videoLoader.getMetadata().i18nTitle?this.description=paella.player.videoLoader.getMetadata().i18nDescription:this.description=paella.player.videoLoader.getMetadata().description},get_progress:function(e,t){var n,a;n=""===this.played_segments?[]:this.played_segments.split("[,]"),null!=this.played_segments_segment_start&&n.push(this.played_segments_segment_start+"[.]"+e),a=[],n.forEach(function(e,t){a[t]=e.split("[.]"),a[t][0]*=1,a[t][1]*=1}),a.sort(function(e,t){return e[0]-t[0]}),a.forEach(function(e,t){t>0&&a[t][0]a[t][1]&&(a[t][1]=a[t][0]))});var i=0;return a.forEach(function(e,t){e[1]>e[0]&&(i+=e[1]-e[0])}),1*(i/t).toFixed(2)}}),paella.plugins.xAPISaverPlugin=new paella.plugins.xAPISaverPlugin,paella.plugins.TrimmingTrackPlugin=Class.create(paella.editor.MainTrackPlugin,{trimmingTrack:null,trimmingData:{s:0,e:0},getTrackItems:function(){null==this.trimmingTrack&&(this.trimmingTrack={id:1,s:0,e:0},this.trimmingTrack.s=paella.player.videoContainer.trimStart(),this.trimmingTrack.e=paella.player.videoContainer.trimEnd(),this.trimmingData.s=this.trimmingTrack.s,this.trimmingData.e=this.trimmingTrack.e);var e=[];return e.push(this.trimmingTrack),e},getName:function(){return"es.upv.paella.editor.trimmingTrackPlugin"},getTools:function(){if(this.config.enableResetButton)return[{name:"reset",label:base.dictionary.translate("Reset"),hint:base.dictionary.translate("Resets the trimming bar to the default length of the video.")}]},onToolSelected:function(e){if(this.config.enableResetButton&&"reset"==e)return this.trimmingTrack={id:1,s:0,e:0},this.trimmingTrack.s=0,this.trimmingTrack.e=paella.player.videoContainer.duration(!0),!0},getTrackName:function(){return base.dictionary.translate("Trimming")},getColor:function(){return"rgb(0, 51, 107)"},onSave:function(e){paella.player.videoContainer.enableTrimming(),paella.player.videoContainer.setTrimmingStart(this.trimmingTrack.s),paella.player.videoContainer.setTrimmingEnd(this.trimmingTrack.e),this.trimmingData.s=this.trimmingTrack.s,this.trimmingData.e=this.trimmingTrack.e,paella.data.write("trimming",{id:paella.initDelegate.getId()},{start:this.trimmingTrack.s,end:this.trimmingTrack.e},function(t,n){e(n)})},onDiscard:function(e){this.trimmingTrack.s=this.trimmingData.s,this.trimmingTrack.e=this.trimmingData.e,e(!0)},allowDrag:function(){return!1},onTrackChanged:function(e,t,n){playerEnd=paella.player.videoContainer.duration(!0),t=t<0?0:t,n=n>playerEnd?playerEnd:n,this.trimmingTrack.s=t,this.trimmingTrack.e=n,this.parent(e,t,n)},contextHelpString:function(){return"es"==base.dictionary.currentLanguage()?'Utiliza la herramienta de recorte para definir el instante inicial y el instante final de la clase. Para cambiar la duración solo hay que arrastrar el inicio o el final de la pista "Recorte", en la linea de tiempo.':"Use this tool to define the start and finish time."}}),paella.plugins.trimmingTrackPlugin=new paella.plugins.TrimmingTrackPlugin,paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.trimmingPlayerPlugin"},getEvents:function(){return[paella.events.controlBarLoaded,paella.events.showEditor,paella.events.hideEditor]},onEvent:function(e,t){switch(e){case paella.events.controlBarLoaded:this.loadTrimming();break;case paella.events.showEditor:paella.player.videoContainer.disableTrimming();break;case paella.events.hideEditor:paella.player.config.trimming&&paella.player.config.trimming.enabled&&paella.player.videoContainer.enableTrimming()}},loadTrimming:function(){var e=paella.initDelegate.getId();paella.data.read("trimming",{id:e},function(e,t){if(e&&t&&e.end>0)paella.player.videoContainer.setTrimming(e.start,e.end).then(function(){return paella.player.videoContainer.enableTrimming()});else{var n=base.parameters.get("start"),a=base.parameters.get("end");n&&a&&paella.player.videoContainer.setTrimming(n,a).then(function(){return paella.player.videoContainer.enableTrimming()})}})}},{},e)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getIndex:function(){return 552},getAlignment:function(){return"right"},getSubclass:function(){return"AirPlayButton"},getIconClass:function(){return"icon-airplay"},getName:function(){return"es.upv.paella.airPlayPlugin"},checkEnabled:function(e){this._visible=!1,e(window.WebKitPlaybackTargetAvailabilityEvent)},getDefaultToolTip:function(){return base.dictionary.translate("Emit to AirPlay.")},setup:function(){var e=this,t=paella.player.videoContainer.masterVideo().video;window.WebKitPlaybackTargetAvailabilityEvent&&t.addEventListener("webkitplaybacktargetavailabilitychanged",function(t){switch(t.availability){case"available":e._visible=!0;break;case"not-available":e._visible=!1}e.updateClassName()})},action:function(e){paella.player.videoContainer.masterVideo().video.webkitShowPlaybackTargetPicker()},updateClassName:function(){this.button.className=this.getButtonItemClass(!0)},getButtonItemClass:function(e){return"buttonPlugin "+this.getSubclass()+" "+this.getAlignment()+" "+(this._visible?"available":"not-available")}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.arrowSlidesNavigatorPlugin"},checkEnabled:function(e){!paella.initDelegate.initParams.videoLoader.frameList||0==Object.keys(paella.initDelegate.initParams.videoLoader.frameList).length&&paella.player.videoContainer.isMonostream?e(!1):e(!0)},setup:function(){var e=this;this._showArrowsIn=this.config.showArrowsIn||"slave",this.createOverlay(),e._frames=[];var t=paella.initDelegate.initParams.videoLoader.frameList;if(t){var n=Object.keys(t);n.length,n.map(function(e){return Number(e,10)}).sort(function(e,t){return e-t}).forEach(function(n){e._frames.push(t[n])})}},createOverlay:function(){var e=this,t=paella.player.videoContainer.overlayContainer;if(!this.arrows){this.arrows=document.createElement("div"),this.arrows.id="arrows",this.arrows.style.marginTop="25%";var n=document.createElement("div");n.className="buttonPlugin arrowSlideNavidator nextButton right icon-arrow-right",this.arrows.appendChild(n);var a=document.createElement("div");a.className="buttonPlugin arrowSlideNavidator prevButton left icon-arrow-left",this.arrows.appendChild(a),$(n).click(function(t){e.goNextSlide(),t.stopPropagation()}),$(a).click(function(t){e.goPrevSlide(),t.stopPropagation()})}switch(this.container&&t.removeElement(this.container),e._showArrowsIn){case"full":this.container=t.addLayer(),this.container.style.marginRight="0",this.container.style.marginLeft="0",this.arrows.style.marginTop="25%";break;case"master":var i=document.createElement("div");this.container=t.addElement(i,t.getMasterRect()),this.arrows.style.marginTop="23%";break;case"slave":i=document.createElement("div");this.container=t.addElement(i,t.getSlaveRect()),this.arrows.style.marginTop="35%"}this.container.appendChild(this.arrows),this.hideArrows()},getCurrentRange:function(){var e=this;return new Promise(function(t){if(e._frames.length<1)t(null);else{var n=null;paella.player.videoContainer.duration().then(function(e){return e,paella.player.videoContainer.trimming()}).then(function(e){return n=e,paella.player.videoContainer.currentTime()}).then(function(a){if(!e._frames.some(function(i,r,o){if(r+1!=o.length){var s=0==r?i:e._frames[r-1],l=e._frames[r+1],u=n.enabled?s.time-n.start:s.time,c=n.enabled?i.time-n.start:i.time,d=n.enabled?l.time-n.start:l.time;if(ca){var p={prev:u,next:d};return u<0&&(p.prev=c>0?c:0),t(p),!0}}})){var i=e._frames[e._frames.length-2].time,r=e._frames[e._frames.length-1].time;t({prev:n.enabled?i-n.start:i,next:n.enabled?r-n.start:r})}})}})},goNextSlide:function(){this.getCurrentRange().then(function(e){paella.player.videoContainer.seekToTime(e.next)})},goPrevSlide:function(){this.getCurrentRange().then(function(e){paella.player.videoContainer.seekToTime(e.prev)})},showArrows:function(){$(this.arrows).show()},hideArrows:function(){$(this.arrows).hide()},getEvents:function(){return[paella.events.controlBarDidShow,paella.events.controlBarDidHide,paella.events.setComposition]},onEvent:function(e,t){switch(e){case paella.events.controlBarDidShow:this.showArrows();break;case paella.events.controlBarDidHide:this.hideArrows();break;case paella.events.setComposition:this.createOverlay()}}},{},e)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"audioLanguages"},getIconClass:function(){return"icon-headphone"},getIndex:function(){return 2040},getMinWindowSize:function(){return 400},getName:function(){return"es.upv.paella.audioLanguage"},getDefaultToolTip:function(){return base.dictionary.translate("Set audio language")},closeOnMouseOut:function(){return!0},checkEnabled:function(e){var t=this;paella.player.videoContainer.getAudioLanguages().then(function(n){t._languages=n,e(n.length>1)})},setup:function(){var e=this;this.setLanguageLabel(),paella.events.bind(paella.events.audioLanguageChanged,function(){e.setLanguageLabel()})},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},buildContent:function(e){var t=this;this._languages.forEach(function(n){e.appendChild(t.getItemButton(n))})},getItemButton:function(e){var t=document.createElement("div"),n=paella.player.videoContainer.mainAudioPlayer().stream.language,a=paella.dictionary.translate(e);return t.className=this.getButtonItemClass(a,e==n),t.id="laguageSelectorItem_"+e,t.innerHTML=a,t.data=e,$(t).click(function(e){$(".videoAudioTrackItem").removeClass("selected"),$(".videoAudioTrackItem."+this.data).addClass("selected"),paella.player.videoContainer.setAudioLanguage(this.data)}),t},setQualityLabel:function(){var e=this;paella.player.videoContainer.getCurrentQuality().then(function(t){e.setText(t.shortLabel())})},getButtonItemClass:function(e,t){return"videoAudioTrackItem "+e+(t?" selected":"")},setLanguageLabel:function(){this.setText(paella.player.videoContainer.audioLanguage)}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.blackBoardPlugin"},getIndex:function(){return 10},getAlignment:function(){return"right"},getSubclass:function(){return"blackBoardButton2"},getDefaultToolTip:function(){return base.dictionary.translate("BlackBoard")},checkEnabled:function(e){this._blackBoardProfile="s_p_blackboard2",this._blackBoardDIV=null,this._hasImages=null,this._active=!1,this._creationTimer=500,this._zImages=null,this._videoLength=null,this._keys=null,this._currentImage=null,this._next=null,this._prev=null,this._lensDIV=null,this._lensContainer=null,this._lensWidth=null,this._lensHeight=null,this._conImg=null,this._zoom=250,this._currentZoom=null,this._maxZoom=500,this._mousePos=null,this._containerRect=null,e(!0)},getEvents:function(){return[paella.events.setProfile,paella.events.timeUpdate]},onEvent:function(e,t){switch(e){case paella.events.setProfile:if(t.profileName!=this._blackBoardProfile){this._active&&(this.destroyOverlay(),this._active=!1);break}this._hasImages||paella.player.setProfile("slide_professor"),this._hasImages&&!this._active&&(this.createOverlay(),this._active=!0);break;case paella.events.timeUpdate:this._active&&this._hasImages&&this.imageUpdate(e,t)}},setup:function(){var e=this;if(paella.player.videoContainer.sourceData[0].sources.hasOwnProperty("image"))e._hasImages=!0,e._zImages={},e._zImages=paella.player.videoContainer.sourceData[0].sources.image[0].frames,e._videoLength=paella.player.videoContainer.sourceData[0].sources.image[0].duration,e._keys=Object.keys(e._zImages),e._keys=e._keys.sort(function(e,t){return e=e.slice(6),t=t.slice(6),parseInt(e)-parseInt(t)});else if(e._hasImages=!1,paella.player.selectedProfile==e._blackBoardProfile){var t=paella.player.config.defaultProfile;paella.player.setProfile(t)}this._next=0,this._prev=0,paella.player.selectedProfile==e._blackBoardProfile&&(e.createOverlay(),e._active=!0),e._mousePos={},paella.Profiles.loadProfile(e._blackBoardProfile,function(t){e._containerRect=t.blackBoardImages})},createLens:function(){var e=this;null==e._currentZoom&&(e._currentZoom=e._zoom);var t=document.createElement("div");t.className="lensClass",e._lensDIV=t;var n=$(".conImg").offset(),a=$(".conImg").width(),i=$(".conImg").height();t.style.width=a/(e._currentZoom/100)+"px",t.style.height=i/(e._currentZoom/100)+"px",e._lensWidth=parseInt(t.style.width),e._lensHeight=parseInt(t.style.height),$(e._lensContainer).append(t),$(e._lensContainer).mousemove(function(t){var r=t.pageX-n.left,o=t.pageY-n.top;e._mousePos.x=r,e._mousePos.y=o;var s=o-e._lensHeight/2;s=(s=s<0?0:s)>i-e._lensHeight?i-e._lensHeight:s;var l=r-e._lensWidth/2;if(l=(l=l<0?0:l)>a-e._lensWidth?a-e._lensWidth:l,e._lensDIV.style.left=l+"px",e._lensDIV.style.top=s+"px",100!=e._currentZoom){var u=100*l/(a-e._lensWidth),c=100*s/(i-e._lensHeight);e._blackBoardDIV.style.backgroundPosition=u.toString()+"% "+c.toString()+"%"}else if(100==e._currentZoom){var d=100*r/a,p=100*o/i;e._blackBoardDIV.style.backgroundPosition=d.toString()+"% "+p.toString()+"%"}e._blackBoardDIV.style.backgroundSize=e._currentZoom+"%"}),$(e._lensContainer).bind("wheel mousewheel",function(t){(void 0!==t.originalEvent.wheelDelta?t.originalEvent.wheelDelta:-1*t.originalEvent.deltaY)>0&&e._currentZoom100?e.reBuildLens(-10):100==e._currentZoom&&(e._lensDIV.style.left="0px",e._lensDIV.style.top="0px"),e._blackBoardDIV.style.backgroundSize=e._currentZoom+"%"})},reBuildLens:function(e){this._currentZoom+=e;$(".conImg").offset();var t=$(".conImg").width(),n=$(".conImg").height();if(this._lensDIV.style.width=t/(this._currentZoom/100)+"px",this._lensDIV.style.height=n/(this._currentZoom/100)+"px",this._lensWidth=parseInt(this._lensDIV.style.width),this._lensHeight=parseInt(this._lensDIV.style.height),100!=this._currentZoom){var a=this._mousePos.x,i=this._mousePos.y-this._lensHeight/2;i=(i=i<0?0:i)>n-this._lensHeight?n-this._lensHeight:i;var r=a-this._lensWidth/2;r=(r=r<0?0:r)>t-this._lensWidth?t-this._lensWidth:r,this._lensDIV.style.left=r+"px",this._lensDIV.style.top=i+"px";var o=100*r/(t-this._lensWidth),s=100*i/(n-this._lensHeight);this._blackBoardDIV.style.backgroundPosition=o.toString()+"% "+s.toString()+"%"}},destroyLens:function(){this._lensDIV&&($(this._lensDIV).remove(),this._blackBoardDIV.style.backgroundSize="100%",this._blackBoardDIV.style.opacity=0)},createOverlay:function(){var e=this,t=document.createElement("div");t.className="blackBoardDiv",e._blackBoardDIV=t,e._blackBoardDIV.style.opacity=0;var n=document.createElement("div");n.className="lensContainer",e._lensContainer=n;var a=document.createElement("img");a.className="conImg",e._conImg=a,e._currentImage&&(e._conImg.src=e._currentImage,$(e._blackBoardDIV).css("background-image","url("+e._currentImage+")")),$(n).append(a),$(e._lensContainer).mouseenter(function(){e.createLens(),e._blackBoardDIV.style.opacity=1}),$(e._lensContainer).mouseleave(function(){e.destroyLens()}),setTimeout(function(){var a=paella.player.videoContainer.overlayContainer;a.addElement(t,a.getMasterRect()),a.addElement(n,e._containerRect)},e._creationTimer)},destroyOverlay:function(){this._blackBoardDIV&&$(this._blackBoardDIV).remove(),this._lensContainer&&$(this._lensContainer).remove()},imageUpdate:function(e,t){var n=this,a=Math.round(t.currentTime),i=$(n._blackBoardDIV).css("background-image");if($(n._blackBoardDIV).length>0){if(n._zImages.hasOwnProperty("frame_"+a)){if(i==n._zImages["frame_"+a])return;i=n._zImages["frame_"+a]}else{if(!(a>n._next||ai&&e0&&(t.breaks=n.breaks),e(!0)})},getEvents:function(){return[paella.events.timeUpdate]},onEvent:function(e,t){var n=this;t.videoContainer.currentTime(!0).then(function(e){n.checkBreaks(e)})},checkBreaks:function(e){for(var t,n=0;ne?this.areBreaksClickable()?this.avoidBreak(t):this.showBreaks(t):t.s.toFixed(0)==e.toFixed(0)&&this.avoidBreak(t);if(!this.areBreaksClickable())for(var a in this.visibleBreaks)"object"==$traceurRuntime.typeof(t)&&(t=this.visibleBreaks[a])&&(t.s>=e||t.e<=e)&&this.removeBreak(t)},areBreaksClickable:function(){return this.config.neverShow&&!(paella.editor.instance&&paella.editor.instance.isLoaded)},showBreaks:function(e){if(!this.visibleBreaks[e.s]){var t=e.name||paella.dictionary.translate("Break");e.elem=paella.player.videoContainer.overlayContainer.addText(t,{left:100,top:350,width:1080,height:40}),e.elem.className="textBreak",this.visibleBreaks[e.s]=e}},removeBreak:function(e){if(this.visibleBreaks[e.s]){var t=this.visibleBreaks[e.s].elem;paella.player.videoContainer.overlayContainer.removeElement(t),this.visibleBreaks[e.s]=null}},avoidBreak:function(e){var t,n=this;paella.player.videoContainer.trimEnabled()?paella.player.videoContainer.trimming().then(function(a){e.e>=a.end?(t=0,paella.player.videoContainer.pause()):t=e.e+(n.config.neverShow?.01:0)-a.start,paella.player.videoContainer.seekToTime(t)}):paella.player.videoContainer.duration(!0).then(function(a){e.e>=a?(t=0,paella.player.videoContainer.pause()):t=e.e+(n.config.neverShow?.01:0),paella.player.videoContainer.seekToTime(t)})}},{},e)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{get ext(){return["dfxp"]},getName:function(){return"es.upv.paella.captions.DFXPParserPlugin"},parse:function(e,t,n){for(var a=[],i=this,r=$(e),o=r.attr("xml:lang"),s=r.find("div"),l=0;l0?n(!1,a):n(!0)},parseTimeTextToSeg:function(e){var t=0;if(/^([0-9]*([.,][0-9]*)?)s/.test(e))t=parseFloat(RegExp.$1);else{var n=e.split(":"),a=parseInt(n[0]),i=parseInt(n[1]);t=parseInt(n[2])+60*i+60*a*60}return t}},{},e)}(paella.CaptionParserPlugIn)}),paella.addPlugin(function(){return function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{getInstanceName:function(){return"captionsPlugin"},getAlignment:function(){return"right"},getSubclass:function(){return"captionsPluginButton"},getIconClass:function(){return"icon-captions"},getName:function(){return"es.upv.paella.captionsPlugin"},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},getDefaultToolTip:function(){return base.dictionary.translate("Subtitles")},getIndex:function(){return 509},closeOnMouseOut:function(){return!1},checkEnabled:function(e){this._searchTimerTime=1500,this._searchTimer=null,this._pluginButton=null,this._open=0,this._parent=null,this._body=null,this._inner=null,this._bar=null,this._input=null,this._select=null,this._editor=null,this._activeCaptions=null,this._lastSel=null,this._browserLang=null,this._defaultBodyHeight=280,this._autoScroll=!0,this._searchOnCaptions=null,e(!0)},showUI:function(){paella.captions.getAvailableLangs().length>=1&&$traceurRuntime.superGet(this,t.prototype,"showUI").call(this)},setup:function(){var e=this;paella.captions.getAvailableLangs().length||paella.plugins.captionsPlugin.hideUI(),paella.events.bind(paella.events.captionsEnabled,function(t,n){e.onChangeSelection(n)}),paella.events.bind(paella.events.captionsDisabled,function(t,n){e.onChangeSelection(n)}),paella.events.bind(paella.events.captionAdded,function(t,n){e.onCaptionAdded(n),paella.plugins.captionsPlugin.showUI()}),paella.events.bind(paella.events.timeUpdate,function(t,n){e._searchOnCaptions&&e.updateCaptionHiglighted(n)}),paella.events.bind(paella.events.controlBarWillHide,function(t){e.cancelHideBar()}),e._activeCaptions=paella.captions.getActiveCaptions(),e._searchOnCaptions=e.config.searchOnCaptions||!1},cancelHideBar:function(){this._open>0&&paella.player.controls.cancelHideBar()},updateCaptionHiglighted:function(e){var t=this,n=null;e&&paella.player.videoContainer.trimming().then(function(a){var i=a.enabled?a.start:0,r=paella.captions.getActiveCaptions(),o=r&&r.getCaptionAtTime(e.currentTime+i),s=o&&o.id;null!=s&&((n=$(".bodyInnerContainer[sec-id='"+s+"']"))!=t._lasSel&&$(t._lasSel).removeClass("Highlight"),n&&($(n).addClass("Highlight"),t._autoScroll&&t.updateScrollFocus(s),t._lasSel=n))})},updateScrollFocus:function(e){var t=0,n=$(".bodyInnerContainer").slice(0,e);(n=n.toArray()).forEach(function(e){var n=$(e).outerHeight(!0);t+=n});var a=parseInt(t/280);$(".captionsBody").scrollTop(a*this._defaultBodyHeight)},onCaptionAdded:function(e){var t=paella.captions.getCaptions(e),n=document.createElement("option");n.text=t._lang.txt,n.value=e,this._select.add(n)},changeSelection:function(){var e=$(this._select).val();if(""==e)return $(this._body).empty(),void paella.captions.setActiveCaptions(e);paella.captions.setActiveCaptions(e),this._activeCaptions=e,this._searchOnCaptions&&this.buildBodyContent(paella.captions.getActiveCaptions()._captions,"list"),this.setButtonHideShow()},onChangeSelection:function(e){this._activeCaptions!=e&&($(this._body).empty(),void 0==e?(this._select.value="",$(this._input).prop("disabled",!0)):($(this._input).prop("disabled",!1),this._select.value=e,this._searchOnCaptions&&this.buildBodyContent(paella.captions.getActiveCaptions()._captions,"list")),this._activeCaptions=e,this.setButtonHideShow())},action:function(){switch(this._browserLang=base.dictionary.currentLanguage(),this._autoScroll=!0,this._open){case 0:this._browserLang&&void 0==paella.captions.getActiveCaptions()&&this.selectDefaultBrowserLang(this._browserLang),this._open=1,paella.keyManager.enabled=!1;break;case 1:paella.keyManager.enabled=!0,this._open=0}},buildContent:function(e){var t=this;t._parent=document.createElement("div"),t._parent.className="captionsPluginContainer",t._bar=document.createElement("div"),t._bar.className="captionsBar",t._searchOnCaptions&&(t._body=document.createElement("div"),t._body.className="captionsBody",t._parent.appendChild(t._body),$(t._body).scroll(function(){t._autoScroll=!1}),t._input=document.createElement("input"),t._input.className="captionsBarInput",t._input.type="text",t._input.id="captionsBarInput",t._input.name="captionsString",t._input.placeholder=base.dictionary.translate("Search captions"),t._bar.appendChild(t._input),$(t._input).change(function(){var e=$(t._input).val();t.doSearch(e)}),$(t._input).keyup(function(){var e=$(t._input).val();null!=t._searchTimer&&t._searchTimer.cancel(),t._searchTimer=new base.Timer(function(n){t.doSearch(e)},t._searchTimerTime)})),t._select=document.createElement("select"),t._select.className="captionsSelector";var n=document.createElement("option");n.text=base.dictionary.translate("None"),n.value="",t._select.add(n),paella.captions.getAvailableLangs().forEach(function(e){var n=document.createElement("option");n.text=e.lang.txt,n.value=e.id,t._select.add(n)}),t._bar.appendChild(t._select),t._parent.appendChild(t._bar),$(t._select).change(function(){t.changeSelection()}),t._editor=document.createElement("button"),t._editor.className="editorButton",t._editor.innerHTML="",t._bar.appendChild(t._editor),$(t._editor).prop("disabled",!0),$(t._editor).click(function(){var e=paella.captions.getActiveCaptions();paella.userTracking.log("paella:caption:edit",{id:e._captionsProvider+":"+e._id,lang:e._lang}),e.goToEdit()}),e.appendChild(t._parent)},selectDefaultBrowserLang:function(e){var t=null;paella.captions.getAvailableLangs().forEach(function(n){n.lang.code==e&&(t=n.id)}),t&&paella.captions.setActiveCaptions(t)},doSearch:function(e){var t=this,n=paella.captions.getActiveCaptions();n&&(""==e?t.buildBodyContent(paella.captions.getActiveCaptions()._captions,"list"):n.search(e,function(e,n){e||t.buildBodyContent(n,"search")}))},setButtonHideShow:function(){var e=$(".editorButton"),t=paella.captions.getActiveCaptions(),n=null;null!=t?($(this._select).width("39%"),t.canEdit(function(e,t){n=t}),n?($(e).prop("disabled",!1),$(e).show()):($(e).prop("disabled",!0),$(e).hide(),$(this._select).width("47%"))):($(e).prop("disabled",!0),$(e).hide(),$(this._select).width("47%")),this._searchOnCaptions||(n?$(this._select).width("92%"):$(this._select).width("100%"))},buildBodyContent:function(e,t){var n=this;$(n._body).empty(),e.forEach(function(e){paella.player.videoContainer.trimming().then(function(a){a.enabled&&(e.enda.end)||(n._inner=document.createElement("div"),n._inner.className="bodyInnerContainer",n._inner.innerHTML=e.content,"list"==t&&(n._inner.setAttribute("sec-begin",e.begin),n._inner.setAttribute("sec-end",e.end),n._inner.setAttribute("sec-id",e.id),n._autoScroll=!0),"search"==t&&n._inner.setAttribute("sec-begin",e.time),n._body.appendChild(n._inner),$(n._inner).hover(function(){$(this).css("background-color","rgba(250, 161, 102, 0.5)")},function(){$(this).removeAttr("style")}),$(n._inner).click(function(){var e=$(this).attr("sec-begin");paella.player.videoContainer.trimming().then(function(t){var n=t.enabled?t.start:0;paella.player.videoContainer.seekToTime(parseInt(e-n))})}))})})}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{checkEnabled:function(e){this.containerId="paella_plugin_CaptionsOnScreen",this.container=null,this.innerContainer=null,this.top=null,this.actualPos=null,this.lastEvent=null,this.controlsPlayback=null,this.captions=!1,this.captionProvider=null,e(!paella.player.isLiveStream())},setup:function(){},getEvents:function(){return[paella.events.controlBarDidHide,paella.events.resize,paella.events.controlBarDidShow,paella.events.captionsEnabled,paella.events.captionsDisabled,paella.events.timeUpdate]},onEvent:function(e,t){switch(e){case paella.events.controlBarDidHide:if(this.lastEvent==e||0==this.captions)break;this.moveCaptionsOverlay("down");break;case paella.events.resize:if(0==this.captions)break;paella.player.controls.isHidden()?this.moveCaptionsOverlay("down"):this.moveCaptionsOverlay("top");break;case paella.events.controlBarDidShow:if(this.lastEvent==e||0==this.captions)break;this.moveCaptionsOverlay("top");break;case paella.events.captionsEnabled:this.buildContent(t),this.captions=!0,paella.player.controls.isHidden()?this.moveCaptionsOverlay("down"):this.moveCaptionsOverlay("top");break;case paella.events.captionsDisabled:this.hideContent(),this.captions=!1;break;case paella.events.timeUpdate:this.captions&&this.updateCaptions(t)}this.lastEvent=e},buildContent:function(e){this.captionProvider=e,null==this.container?(this.container=document.createElement("div"),this.container.className="CaptionsOnScreen",this.container.id=this.containerId,this.innerContainer=document.createElement("div"),this.innerContainer.className="CaptionsOnScreenInner",this.container.appendChild(this.innerContainer),null==this.controlsPlayback&&(this.controlsPlayback=$("#playerContainer_controls_playback")),paella.player.videoContainer.domElement.appendChild(this.container)):$(this.container).show()},updateCaptions:function(e){var t=this;this.captions&&paella.player.videoContainer.trimming().then(function(n){var a=n.enabled?n.start:0,i=paella.captions.getActiveCaptions().getCaptionAtTime(e.currentTime+a);i?($(t.container).show(),t.innerContainer.innerHTML=i.content,t.moveCaptionsOverlay("auto")):(t.innerContainer.innerHTML="",t.hideContent())})},hideContent:function(){$(this.container).hide()},moveCaptionsOverlay:function(e){if(null==this.controlsPlayback&&(this.controlsPlayback=$("#playerContainer_controls_playback")),"auto"!=e&&void 0!=e||(e=paella.player.controls.isHidden()?"down":"top"),"down"==e){var t=this.container.offsetHeight;t-=this.innerContainer.offsetHeight+10,this.innerContainer.style.bottom=0-t+"px"}if("top"==e){var n=this.controlsPlayback.offset().top;n-=this.innerContainer.offsetHeight+10,this.innerContainer.style.bottom=0-n+"px"}},getIndex:function(){return 1050},getName:function(){return"es.upv.paella.overlayCaptionsPlugin"}},{},e)}(paella.EventDrivenPlugin)}),Class("paella.ChromaVideo",paella.VideoElementBase,{_posterFrame:null,_currentQuality:null,_autoplay:!1,_streamName:null,initialize:function(e,t,n,a,i,r,o){this.parent(e,t,"canvas",n,a,i,r),this._streamName=o||"chroma";var s=this;this._stream.sources[this._streamName]&&this._stream.sources[this._streamName].sort(function(e,t){return e.res.h-t.res.h}),this.video=null,new paella.Timer(function(e){!function(){if(s.canvasController){var e=s.canvasController.canvas.domElement;s.canvasController.reshape($(e).width(),$(e).height())}}()},500).repeat=!0},defaultProfile:function(){return"chroma"},_setVideoElem:function(e){$(this.video).bind("progress",evtCallback),$(this.video).bind("loadstart",evtCallback),$(this.video).bind("loadedmetadata",evtCallback),$(this.video).bind("canplay",evtCallback),$(this.video).bind("oncanplay",evtCallback)},_loadDeps:function(){return new Promise(function(e,t){window.$paella_bg2e?defer.resolve(window.$paella_bg2e):paella.require(paella.baseUrl+"resources/deps/bg2e.js").then(function(){window.$paella_bg2e=bg,e(window.$paella_bg2e)}).catch(function(e){console.error(e.message),t()})})},_deferredAction:function(e){var t=this;return new Promise(function(n,a){t.video?n(e()):$(t.video).bind("canplay",function(){t._ready=!0,n(e())})})},_getQualityObject:function(e,t){return{index:e,res:t.res,src:t.src,toString:function(){return this.res.w+"x"+this.res.h},shortLabel:function(){return this.res.h+"p"},compare:function(e){return this.res.w*this.res.h-e.res.w*e.res.h}}},allowZoom:function(){return!1},getVideoData:function(){var e=this,t=this;return new Promise(function(n,a){e._deferredAction(function(){n({duration:t.video.duration,currentTime:t.video.currentTime,volume:t.video.volume,paused:t.video.paused,ended:t.video.ended,res:{w:t.video.videoWidth,h:t.video.videoHeight}})})})},setPosterFrame:function(e){this._posterFrame=e},setAutoplay:function(e){this._autoplay=e,e&&this.video&&this.video.setAttribute("autoplay",e)},load:function(){var e=this;return new Promise(function(t,n){e._loadDeps().then(function(){var a=e._stream.sources[e._streamName];null===e._currentQuality&&e._videoQualityStrategy&&(e._currentQuality=e._videoQualityStrategy.getQualityIndex(a));var i=e._currentQuality0&&base.userAgent.system.iOS)return!1;for(var t in e.sources)if("chroma"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return paella.ChromaVideo._loaded=!0,++paella.videoFactories.Html5VideoFactory.s_instances,new paella.ChromaVideo(e,t,n.x,n.y,n.w,n.h)}}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{get divPublishComment(){return this._divPublishComment},set divPublishComment(e){this._divPublishComment=e},get divComments(){return this._divComments},set divComments(e){this._divComments=e},get publishCommentTextArea(){return this._publishCommentTextArea},set publishCommentTextArea(e){this._publishCommentTextArea=e},get publishCommentButtons(){return this._publishCommentButtons},set publishCommentButtons(e){this._publishCommentButtons=e},get canPublishAComment(){return this._canPublishAComment},set canPublishAComment(e){this._canPublishAComment=e},get comments(){return this._comments},set comments(e){this._comments=e},get commentsTree(){return this._commentsTree},set commentsTree(e){this._commentsTree=e},get domElement(){return this._domElement},set domElement(e){this._domElement=e},getSubclass:function(){return"showCommentsTabBar"},getName:function(){return"es.upv.paella.commentsPlugin"},getTabName:function(){return base.dictionary.translate("Comments")},checkEnabled:function(e){e(!0)},getIndex:function(){return 40},getDefaultToolTip:function(){return base.dictionary.translate("Comments")},action:function(e){this.loadContent()},buildContent:function(e){this.domElement=e,this.canPublishAComment=paella.initDelegate.initParams.accessControl.permissions.canWrite,this.loadContent()},loadContent:function(){this.divRoot=this.domElement,this.divRoot.innerHTML="",this.divPublishComment=document.createElement("div"),this.divPublishComment.className="CommentPlugin_Publish",this.divPublishComment.id="CommentPlugin_Publish",this.divComments=document.createElement("div"),this.divComments.className="CommentPlugin_Comments",this.divComments.id="CommentPlugin_Comments",this.canPublishAComment&&(this.divRoot.appendChild(this.divPublishComment),this.createPublishComment()),this.divRoot.appendChild(this.divComments),this.reloadComments()},createPublishComment:function(){var e,t,n,a,i=this,r=this.divPublishComment.id+"_entry";(e=document.createElement("div")).id=r,e.className="comments_entry",(t=document.createElement("img")).className="comments_entry_silhouette",t.style.width="48px",t.src=paella.initDelegate.initParams.accessControl.userData.avatar,t.id=r+"_silhouette",e.appendChild(t),(n=document.createElement("div")).className="comments_entry_container",n.id=r+"_textarea_container",e.appendChild(n),this.publishCommentTextArea=document.createElement("textarea"),this.publishCommentTextArea.id=r+"_textarea",this.publishCommentTextArea.onclick=function(){paella.keyManager.enabled=!1},this.publishCommentTextArea.onblur=function(){paella.keyManager.enabled=!0},n.appendChild(this.publishCommentTextArea),this.publishCommentButtons=document.createElement("div"),this.publishCommentButtons.id=r+"_buttons_area",n.appendChild(this.publishCommentButtons),(a=document.createElement("button")).id=r+"_btnAddComment",a.className="publish",a.onclick=function(){""!=i.publishCommentTextArea.value.replace(/\s/g,"")&&i.addComment()},a.innerHTML=base.dictionary.translate("Publish"),this.publishCommentButtons.appendChild(a),n.commentsTextArea=this.publishCommentTextArea,n.commentsBtnAddComment=a,n.commentsBtnAddCommentToInstant=this.btnAddCommentToInstant,this.divPublishComment.appendChild(e)},addComment:function(){var e=this,t=paella.AntiXSS.htmlEscape(e.publishCommentTextArea.value),n=new Date;this.comments.push({id:base.uuid(),userName:paella.initDelegate.initParams.accessControl.userData.name,mode:"normal",value:t,created:n});var a={allComments:this.comments};paella.data.write("comments",{id:paella.initDelegate.getId()},a,function(t,n){n&&e.loadContent()})},addReply:function(e,t){var n=this,a=document.getElementById(t),i=paella.AntiXSS.htmlEscape(a.value),r=new Date;paella.keyManager.enabled=!0,this.comments.push({id:base.uuid(),userName:paella.initDelegate.initParams.accessControl.userData.name,mode:"reply",parent:e,value:i,created:r});var o={allComments:this.comments};paella.data.write("comments",{id:paella.initDelegate.getId()},o,function(e,t){t&&n.reloadComments()})},reloadComments:function(){var e=this;e.commentsTree=[],e.comments=[],this.divComments.innerHTML="",paella.data.read("comments",{id:paella.initDelegate.getId()},function(t,n){var a,i,r;if(t&&"object"==$traceurRuntime.typeof(t)&&t.allComments&&t.allComments.length>0){e.comments=t.allComments;var o={};for(a=0;a";a+="",i.innerHTML=a}}),1==this.canPublishAComment){var p=document.createElement("div");p.className="reply_button",p.innerHTML=base.dictionary.translate("Reply"),p.id=o+"_comment_reply_button",p.onclick=function(){var t=r.createAReplyEntry(e.id);this.style.display="none",this.parentElement.parentElement.appendChild(t)},d.appendChild(p)}for(var h=0;h";n+="",r.innerHTML=n}}),n},createAReplyEntry:function(e){var t,n,a,i,r,o=this,s=this.divPublishComment.id+"_entry_"+e+"_reply";return(t=document.createElement("div")).id=s+"_entry",t.className="comments_entry",(n=document.createElement("img")).className="comments_entry_silhouette",n.style.width="48px",n.id=s+"_silhouette",n.src=paella.initDelegate.initParams.accessControl.userData.avatar,t.appendChild(n),(a=document.createElement("div")).className="comments_entry_container comments_reply_container",a.id=s+"_reply_container",t.appendChild(a),(i=document.createElement("textArea")).onclick=function(){paella.keyManager.enabled=!1},i.draggable=!1,i.id=s+"_textarea",a.appendChild(i),this.publishCommentButtons=document.createElement("div"),this.publishCommentButtons.id=s+"_buttons_area",a.appendChild(this.publishCommentButtons),(r=document.createElement("button")).id=s+"_btnAddComment",r.className="publish",r.onclick=function(){""!=i.value.replace(/\s/g,"")&&o.addReply(e,i.id)},r.innerHTML=base.dictionary.translate("Reply"),this.publishCommentButtons.appendChild(r),t}},{},e)}(paella.TabBarPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getSubclass:function(){return"showDescriptionTabBar"},getName:function(){return"es.upv.paella.descriptionPlugin"},getTabName:function(){return"Descripción"},get domElement(){return this._domElement||null},set domElement(e){this._domElement=e},buildContent:function(e){this.domElement=e,this.loadContent()},action:function(e){this.loadContent()},loadContent:function(){var e=this.domElement;e.innerHTML="Loading...",new paella.Timer(function(t){e.innerHTML="Loading done"},2e3)}},{},e)}(paella.TabBarPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{get currentUrl(){return this._currentUrl},set currentUrl(e){this._currentUrl=e},get currentMaster(){return this._currentMaster},set currentMaster(e){this._currentMaster=e},get currentSlave(){return this._currentSlave},set currentSlave(e){this._currentSlave=e},get availableMasters(){return this._availableMasters},set availableMasters(e){this._availableMasters=e},get availableSlaves(){return this._availableSlaves},set availableSlaves(e){this._availableSlaves=e},get showWidthRes(){return this._showWidthRes},set showWidthRes(e){this._showWidthRes=e},getAlignment:function(){return"right"},getSubclass:function(){return"extendedTabAdapterPlugin"},getIconClass:function(){return"icon-folder"},getIndex:function(){return 2030},getMinWindowSize:function(){return 550},getName:function(){return"es.upv.paella.extendedTabAdapterPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Extended Tab Adapter")},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},buildContent:function(e){e.appendChild(paella.extendedAdapter.bottomContainer)}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{get INTERVAL_LENGTH(){return this._INTERVAL_LENGTH},set INTERVAL_LENGTH(e){this._INTERVAL_LENGTH=e},get inPosition(){return this._inPosition},set inPosition(e){this._inPosition=e},get outPosition(){return this._outPosition},set outPosition(e){this._outPosition=e},get canvas(){return this._canvas},set canvas(e){this._canvas=e},get footPrintsTimer(){return this._footPrintsTimer},set footPrintsTimer(e){this._footPrintsTimer=e},get footPrintsData(){return this._footPrintsData},set footPrintsData(e){this._footPrintsData=e},getAlignment:function(){return"right"},getSubclass:function(){return"footPrints"},getIconClass:function(){return"icon-stats"},getIndex:function(){return 590},getDefaultToolTip:function(){return base.dictionary.translate("Show statistics")},getName:function(){return"es.upv.paella.footprintsPlugin"},getButtonType:function(){return paella.ButtonPlugin.type.timeLineButton},setup:function(){var e=this;switch(paella.events.bind(paella.events.timeUpdate,function(t){e.onTimeUpdate()}),this.config.skin){case"custom":this.fillStyle=this.config.fillStyle,this.strokeStyle=this.config.strokeStyle;break;case"dark":this.fillStyle="#727272",this.strokeStyle="#424242";break;case"light":default:this.fillStyle="#d8d8d8",this.strokeStyle="#ffffff"}},checkEnabled:function(e){e(!paella.player.isLiveStream())},buildContent:function(e){var t=document.createElement("div");t.className="footPrintsContainer",this.canvas=document.createElement("canvas"),this.canvas.id="footPrintsCanvas",this.canvas.className="footPrintsCanvas",t.appendChild(this.canvas),e.appendChild(t)},onTimeUpdate:function(){var e=this;paella.player.videoContainer.currentTime().then(function(t){var n=Math.round(t+paella.player.videoContainer.trimStart());e.inPosition<=n&&n<=e.inPosition+e.INTERVAL_LENGTH?(e.outPosition=n,e.inPosition+e.INTERVAL_LENGTH===e.outPosition&&(e.trackFootPrint(e.inPosition,e.outPosition),e.inPosition=e.outPosition)):(e.trackFootPrint(e.inPosition,e.outPosition),e.inPosition=n,e.outPosition=n)})},trackFootPrint:function(e,t){var n={in:e,out:t};paella.data.write("footprints",{id:paella.initDelegate.getId()},n)},willShowContent:function(){var e=this;this.loadFootprints(),this.footPrintsTimer=new base.Timer(function(t){e.loadFootprints()},5e3),this.footPrintsTimer.repeat=!0},didHideContent:function(){null!=this.footPrintsTimer&&(this.footPrintsTimer.cancel(),this.footPrintsTimer=null)},loadFootprints:function(){var e=this;paella.data.read("footprints",{id:paella.initDelegate.getId()},function(t,n){var a={};paella.player.videoContainer.duration().then(function(n){for(var i=Math.floor(paella.player.videoContainer.trimStart()),r=-1,o=0,s=0;si&&(i=e[t]);for(this.canvas.setAttribute("width",n),this.canvas.setAttribute("height",i),a.clearRect(0,0,this.canvas.width,this.canvas.height),a.fillStyle=this.fillStyle,a.strokeStyle=this.strokeStyle,a.lineWidth=2,a.webkitImageSmoothingEnabled=!1,a.mozImageSmoothingEnabled=!1,t=0;t0&&(t.buttons[i].className=e,i--,n>p&&(a=c-d),i==c*(n-1)-1-a&&0!=i&&(t.navButtons.left.scrollContainer.scrollLeft-=105*c,--n),this.hiResFrame&&t.removeHiResFrame(),base.userAgent.browser.IsMobileVersion||t.buttons[i].frameControl.onMouseOver(null,t.buttons[i].frameData),e=t.buttons[i].className,t.buttons[i].className="frameControlItem selected"):u.keyCode==l?i=0&&(t.buttons[i].className=e),i++,1==n&&(a=0),i==c*n-a&&(t.navButtons.left.scrollContainer.scrollLeft+=105*c,++n),this.hiResFrame&&t.removeHiResFrame(),base.userAgent.browser.IsMobileVersion||t.buttons[i].frameControl.onMouseOver(null,t.buttons[i].frameData),e=t.buttons[i].className,t.buttons[i].className="frameControlItem selected"):u.keyCode==r?(t.buttons[i].frameControl.onClick(null,t.buttons[i].frameData),e="frameControlItem current"):u.keyCode==o&&t.removeHiResFrame())})},buildContent:function(e){var t=this,n=this;this.frames=[];var a=document.createElement("div");a.className="frameControlContainer",n.contx=a;var i=document.createElement("div");i.className="frameControlContent",this.navButtons={left:document.createElement("div"),right:document.createElement("div")},this.navButtons.left.className="frameControl navButton left",this.navButtons.right.className="frameControl navButton right";var r=this.getFrame(null);e.appendChild(this.navButtons.left),e.appendChild(a),a.appendChild(i),e.appendChild(this.navButtons.right),this.navButtons.left.scrollContainer=a,$(this.navButtons.left).click(function(e){this.scrollContainer.scrollLeft-=100}),this.navButtons.right.scrollContainer=a,$(this.navButtons.right).click(function(e){this.scrollContainer.scrollLeft+=100}),i.appendChild(r);var o=$(r).outerWidth(!0);i.innerHTML="",$(window).mousemove(function(e){($(i).offset().top>e.pageY||!$(i).is(":visible")||$(i).offset().top+$(i).height()=2&&o.addElement(n,o.getSlaveRect()),o.enableBackgroundMode(),this.hiResFrame=n;break;case"master":o.addElement(n,o.getMasterRect()),o.enableBackgroundMode(),this.hiResFrame=n;break;case"slave":var s;(s=paella.initDelegate.initParams.videoLoader.streams).length>=2&&(o.addElement(n,o.getSlaveRect()),o.enableBackgroundMode(),this.hiResFrame=n)}},removeHiResFrame:function(){var e=paella.player.videoContainer.overlayContainer;this.hiResFrame&&e.removeElement(this.hiResFrame),e.disableBackgroundMode(),this._img=null},updateFrameVisibility:function(e,t,n){var a;if(e)for(a=0;aa+1&&this.frames[a+1].frameData.time>t?$(i).show():$(i).hide():r.time>n?$(i).hide():$(i).show()}else for(a=0;a',base.userAgent.browser.IsMobileVersion||$(n).mouseover(function(e){this.frameControl.onMouseOver(e,this.frameData)}),$(n).mouseout(function(e){this.frameControl.onMouseOut(e,this.frameData)}),$(n).click(function(e){this.frameControl.onClick(e,this.frameData)})}return n},onMouseOver:function(e,t){var n=paella.initDelegate.initParams.videoLoader.frameList[t.time];if(n){var a=n.url;this._img?(this._img.setAttribute("src",a),this._caption.innerHTML=n.caption||""):this.showHiResFrame(a,n.caption)}null!=this._searchTimer&&clearTimeout(this._searchTimer)},onMouseOut:function(e,t){var n=this;this._searchTimer=setTimeout(function(e){return n.removeHiResFrame()},this._searchTimerTime)},onClick:function(e,t){paella.player.videoContainer.trimming().then(function(e){var n=e.enabled?t.time-e.start:t.time;n>0?paella.player.videoContainer.seekToTime(n+1):paella.player.videoContainer.seekToTime(0)})},onTimeUpdate:function(e){for(var t=null,n=0;n0)},action:function(e){var t=base.dictionary.currentLanguage(),n=this.config&&this.config.langs||[],a=n.indexOf(t);a<0&&(a=0);var i="resources/style/help/help_"+n[a]+".html";base.userAgent.browser.IsMobileVersion?window.open(i):paella.messageBox.showFrame(i)}},{},e)}(paella.ButtonPlugin)}),Class("paella.HLSPlayer",paella.Html5Video,{initialize:function(e,t,n,a,i,r){this.parent(e,t,n,a,i,r,"hls")},_loadDeps:function(){return new Promise(function(e,t){window.$paella_hls?e(window.$paella_hls):require([paella.baseUrl+"./resources/deps/hls.min.js"],function(t){window.$paella_hls=t,e(window.$paella_hls)})})},allowZoom:function(){return!0},load:function(){var e=this;if(this._posterFrame&&this.video.setAttribute("poster",this._posterFrame),base.userAgent.system.iOS||base.userAgent.browser.Safari)return this.parent();var t=this;return new Promise(function(n,a){var i=e._stream.sources.hls;i&&i.length>0?(i=i[0],e._loadDeps().then(function(e){e.isSupported()&&(t._hls=new e,t._hls.loadSource(i.src),t._hls.attachMedia(t.video),t._hls.on(e.Events.LEVEL_SWITCHED,function(e,n){t.qualityIndex=n.level,t.setQuality(n.level)}),t._hls.on(e.Events.ERROR,function(n,a){if(a.fatal)switch(a.type){case e.ErrorTypes.NETWORK_ERROR:base.log.error("paella.HLSPlayer: Fatal network error encountered, try to recover"),t._hls.startLoad();break;case e.ErrorTypes.MEDIA_ERROR:base.log.error("paella.HLSPlayer: Fatal media error encountered, try to recover"),t._hls.recoverMediaError();break;default:base.log.error("paella.HLSPlayer: Fatal Error. Can not recover"),t._hls.destroy()}}),t._hls.on(e.Events.MANIFEST_PARSED,function(){t._deferredAction(function(){n()})}))})):a(new Error("Invalid source"))})},getQualities:function(){var e=this;if(base.userAgent.system.iOS||base.userAgent.browser.Safari)return new Promise(function(e,t){e([{index:0,res:"",src:"",toString:function(){return"auto"},shortLabel:function(){return"auto"},compare:function(e){return 0}}])});var t=this;return new Promise(function(n){e._qualities||(t._qualities=[],t._hls.levels.forEach(function(e,n){t._qualities.push(t._getQualityObject(n,{index:n,res:{w:e.width,h:e.height},bitrate:e.bitrate}))})),n(t._qualities)})},printQualityes:function(){var e=this;return new Promise(function(t,n){e.getCurrentQuality().then(function(t){return e.getNextQuality()}).then(function(e){t()})})},setQuality:function(e){if(base.userAgent.system.iOS||base.userAgent.browser.Safari)return Promise.resolve();if(null!==e){try{this.qualityIndex=e,this._hls.nextLevel=e}catch(e){}return Promise.resolve()}return Promise.resolve()},getNextQuality:function(){var e=this;return new Promise(function(t,n){var a=e._hls.nextLevel;t(e._qualities[a])})},getCurrentQuality:function(){var e=this;return base.userAgent.system.iOS||base.userAgent.browser.Safari?Promise.resolve(0):(this.getNextQuality(),new Promise(function(t,n){var a=void 0==e.qualityIndex?e._hls.currentLevel:e.qualityIndex;t(e._qualities[a])}))}}),Class("paella.videoFactories.HLSVideoFactory",{isStreamCompatible:function(e){void 0===paella.videoFactories.HLSVideoFactory.s_instances&&(paella.videoFactories.HLSVideoFactory.s_instances=0);try{if(paella.videoFactories.HLSVideoFactory.s_instances>0&&base.userAgent.system.iOS)return!1;for(var t in e.sources)if("hls"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return++paella.videoFactories.HLSVideoFactory.s_instances,new paella.HLSPlayer(e,t,n.x,n.y,n.w,n.h)}}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{isEditorVisible:function(){return null!=paella.editor.instance},getIndex:function(){return 10},getSubclass:function(){return"liveIndicator"},getAlignment:function(){return"right"},getDefaultToolTip:function(){return base.dictionary.translate("This video is a live stream")},getName:function(){return"es.upv.paella.liveStreamingIndicatorPlugin"},checkEnabled:function(e){e(paella.player.isLiveStream())},setup:function(){},action:function(e){paella.messageBox.showMessage(base.dictionary.translate("Live streaming mode: This is a live video, so, some capabilities of the player are disabled"))}},{},e)}(paella.VideoOverlayButtonPlugin)}),Class("paella.MpegDashVideo",paella.Html5Video,{_posterFrame:null,_player:null,initialize:function(e,t,n,a,i,r){this.parent(e,t,n,a,i,r)},_loadDeps:function(){return new Promise(function(e,t){window.$paella_mpd?e(window.$paella_mpd):require([paella.baseUrl+"resources/deps/dash.all.js"],function(){window.$paella_mpd=!0,e(window.$paella_mpd)})})},_getQualityObject:function(e,t,n){var a=n.length,i=Math.round(100*t/a),r=0==t?"min":t==a-1?"max":i+"%";return{index:t,res:{w:null,h:null},bitrate:e.bitrate,src:null,toString:function(){return i},shortLabel:function(){return r},compare:function(e){return this.bitrate-e.bitrate}}},load:function(){var e=this,t=this;return new Promise(function(n,a){var i=e._stream.sources.mpd;i&&i.length>0?(i=i[0],e._loadDeps().then(function(){var e=dashjs.MediaPlayer().create();e.initialize(t.video,i.src,!0),e.getDebug().setLogToBrowserConsole(!1),t._player=e,e.on(dashjs.MediaPlayer.events.STREAM_INITIALIZED,function(a,i){e.getBitrateInfoListFor("video");t._deferredAction(function(){t._firstPlay||(t._player.pause(),t._firstPlay=!0),n()})})})):a(new Error("Invalid source"))})},supportAutoplay:function(){return!0},getQualities:function(){var e=this;return new Promise(function(t){e._deferredAction(function(){e._qualities||(e._qualities=[],e._player.getBitrateInfoListFor("video").sort(function(e,t){return e.bitrate-t.bitrate}).forEach(function(t,n,a){e._qualities.push(e._getQualityObject(t,n,a))}),e.autoQualityIndex=e._qualities.length,e._qualities.push({index:e.autoQualityIndex,res:{w:null,h:null},bitrate:-1,src:null,toString:function(){return"auto"},shortLabel:function(){return"auto"},compare:function(e){return this.bitrate-e.bitrate}})),t(e._qualities)})})},setQuality:function(e){var t=this;return new Promise(function(n,a){var i=t._player.getQualityFor("video");e==t.autoQualityIndex?(t._player.setAutoSwitchQuality(!0),n()):e!=i?(t._player.setAutoSwitchQuality(!1),t._player.off(dashjs.MediaPlayer.events.METRIC_CHANGED),t._player.on(dashjs.MediaPlayer.events.METRIC_CHANGED,function(e,a){"metricchanged"==e.type&&i!=t._player.getQualityFor("video")&&(i=t._player.getQualityFor("video"),n())}),t._player.setQualityFor("video",e)):n()})},getCurrentQuality:function(){var e=this;return new Promise(function(t,n){if(e._player.getAutoSwitchQuality())t({index:e.autoQualityIndex,res:{w:null,h:null},bitrate:-1,src:null,toString:function(){return"auto"},shortLabel:function(){return"auto"},compare:function(e){return this.bitrate-e.bitrate}});else{var a=e._player.getQualityFor("video");t(e._getQualityObject(e._qualities[a],a,e._player.getBitrateInfoListFor("video")))}})},unFreeze:function(){return paella_DeferredNotImplemented()},freeze:function(){return paella_DeferredNotImplemented()},unload:function(){return this._callUnloadEvent(),paella_DeferredNotImplemented()}}),Class("paella.videoFactories.MpegDashVideoFactory",{isStreamCompatible:function(e){try{if(base.userAgent.system.iOS)return!1;for(var t in e.sources)if("mpd"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return++paella.videoFactories.Html5VideoFactory.s_instances,new paella.MpegDashVideo(e,t,n.x,n.y,n.w,n.h)}}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"showMultipleQualitiesPlugin"},getIconClass:function(){return"icon-screen"},getIndex:function(){return 2030},getMinWindowSize:function(){return 550},getName:function(){return"es.upv.paella.multipleQualitiesPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Change video quality")},closeOnMouseOut:function(){return!0},checkEnabled:function(e){var t=this;this._available=[],paella.player.videoContainer.getQualities().then(function(n){t._available=n,e(n.length>1)})},setup:function(){var e=this;this.setQualityLabel(),paella.events.bind(paella.events.qualityChanged,function(t){return e.setQualityLabel()})},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},buildContent:function(e){var t=this;this._available.forEach(function(n){n.shortLabel();e.appendChild(t.getItemButton(n))})},getItemButton:function(e){var t=this,n=document.createElement("div");return paella.player.videoContainer.getCurrentQuality().then(function(a,i){var r=e.shortLabel();n.className=t.getButtonItemClass(r,e.index==a),n.id=r,n.innerHTML=r,n.data=e,$(n).click(function(e){$(".multipleQualityItem").removeClass("selected"),$(".multipleQualityItem."+this.data.toString()).addClass("selected"),paella.player.videoContainer.setQuality(this.data.index).then(function(){paella.player.controls.hidePopUp(this.getName()),this.setQualityLabel()})})}),n},setQualityLabel:function(){var e=this;paella.player.videoContainer.getCurrentQuality().then(function(t){e.setText(t.shortLabel())})},getButtonItemClass:function(e,t){return"multipleQualityItem "+e+(t?" selected":"")}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getIndex:function(){return 551},getAlignment:function(){return"right"},getSubclass:function(){return"PIPModeButton"},getIconClass:function(){return"icon-pip"},getName:function(){return"es.upv.paella.pipModePlugin"},checkEnabled:function(e){var t=paella.player.videoContainer.masterVideo().video;t&&t.webkitSetPresentationMode?e(!0):e(!1)},getDefaultToolTip:function(){return base.dictionary.translate("Set picture-in-picture mode.")},setup:function(){},action:function(e){var t=paella.player.videoContainer.masterVideo().video;"picture-in-picture"==t.webkitPresentationMode?t.webkitSetPresentationMode("inline"):t.webkitSetPresentationMode("picture-in-picture")}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).call(this),this.playIconClass="icon-play",this.pauseIconClass="icon-pause",this.playSubclass="playButton",this.pauseSubclass="pauseButton"},{getAlignment:function(){return"left"},getSubclass:function(){return this.playSubclass},getIconClass:function(){return this.playIconClass},getName:function(){return"es.upv.paella.playPauseButtonPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Play")},getIndex:function(){return 110},checkEnabled:function(e){e(!0)},setup:function(){var e=this;paella.player.playing()&&this.changeIconClass(this.playIconClass),paella.events.bind(paella.events.play,function(t){e.changeIconClass(e.pauseIconClass),e.changeSubclass(e.pauseSubclass),e.setToolTip(paella.dictionary.translate("Pause"))}),paella.events.bind(paella.events.pause,function(t){e.changeIconClass(e.playIconClass),e.changeSubclass(e.playSubclass),e.setToolTip(paella.dictionary.translate("Play"))})},action:function(e){paella.player.videoContainer.paused().then(function(e){e?paella.player.play():paella.player.pause()})}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).call(this),this.containerId="paella_plugin_PlayButtonOnScreen",this.container=null,this.enabled=!0,this.isPlaying=!1,this.showIcon=!0,this.firstPlay=!1},{checkEnabled:function(e){e(!paella.player.isLiveStream()||base.userAgent.system.Android||base.userAgent.system.iOS||!paella.player.videoContainer.supportAutoplay())},getIndex:function(){return 1010},getName:function(){return"es.upv.paella.playButtonOnScreenPlugin"},setup:function(){var e=this;this.container=document.createElement("div"),this.container.className="playButtonOnScreen",this.container.id=this.containerId,this.container.style.width="100%",this.container.style.height="100%",paella.player.videoContainer.domElement.appendChild(this.container),$(this.container).click(function(t){e.onPlayButtonClick()});var t=document.createElement("canvas");function n(){var n=jQuery(e.container).innerWidth(),a=jQuery(e.container).innerHeight();t.width=n,t.height=a;var i=n0&&(e='',e+=" "+this.score+" "+this.count+" "+base.dictionary.translate("votes")),this.scoreContainer.header.innerHTML="\n\t\t\t
\n\t\t\t\t

"+base.dictionary.translate("Video score")+":

\n\t\t\t\t
\n\t\t\t\t\t"+e+"\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t

"+base.dictionary.translate("Vote:")+"

\n\t\t\t
\n\t\t\t"},updateRateButtons:function(){if(this.scoreContainer.rateButtons.className="rateButtons",this.buttons=[],this.canVote){this.scoreContainer.rateButtons.innerHTML="";for(var e=0;e<5;++e){var t=this.getStarButton(e+1);this.buttons.push(t),this.scoreContainer.rateButtons.appendChild(t)}}else this.scoreContainer.rateButtons.innerHTML="
"+base.dictionary.translate("Login to vote")+"
";this.updateVote()},buildContent:function(e){this._domElement=e;var t=document.createElement("div");e.appendChild(t),t.className="rateContainerHeader",this.scoreContainer.header=t,this.updateHeader();var n=document.createElement("div");this.scoreContainer.rateButtons=n,e.appendChild(n),this.updateRateButtons()},getStarButton:function(e){var t=this,n=document.createElement("i");return n.data={score:e,active:!1},n.className="starButton glyphicon glyphicon-star-empty",$(n).click(function(e){t.vote(this.data.score)}),n},vote:function(e){var t=this;this.myScore=e;var n={mean:this.score,count:this.count,myScore:e,canVote:this.canVote};paella.data.write("rate",{id:paella.initDelegate.getId()},n,function(e){paella.data.read("rate",{id:paella.initDelegate.getId()},function(e,n){e&&"object"==$traceurRuntime.typeof(e)&&(t.score=Number(e.mean).toFixed(1),t.count=e.count,t.myScore=e.myScore,t.canVote=e.canVote),t.updateHeader(),t.updateRateButtons()})})},updateVote:function(){var e=this;this.buttons.forEach(function(t,n){t.className=n"+base.dictionary.translate("Please go to {0} and install it.").replace("{0}","http://www.adobe.com/go/getflash")+"
"+base.dictionary.translate("If the problem presist, contact us.");var i=document.createElement("a");i.setAttribute("href","http://www.adobe.com/go/getflash"),i.innerHTML='Obtener Adobe Flash Player',t.appendChild(n),t.appendChild(a),t.appendChild(i),paella.messageBox.showError(t.innerHTML)}});else{var i=document.createElement("div"),r=document.createElement("h3");r.innerHTML=base.dictionary.translate("Flash player needed");var o=document.createElement("div");o.innerHTML=base.dictionary.translate("You need at least Flash player 9 installed.")+"
"+base.dictionary.translate("Please go to {0} and install it.").replace("{0}","http://www.adobe.com/go/getflash");var s=document.createElement("a");s.setAttribute("href","http://www.adobe.com/go/getflash"),s.innerHTML='Obtener Adobe Flash Player',i.appendChild(r),i.appendChild(o),i.appendChild(s),paella.messageBox.showError(i.innerHTML)}return $("#"+a.id)[0]},_deferredAction:function(e){var t=this;return new Promise(function(n,a){t.ready?n(e()):$(t.swfContainer).bind("paella:flashvideoready",function(){t._ready=!0,n(e())})})},_getQualityObject:function(e,t){return{index:e,res:t.res,src:t.src,toString:function(){return this.res.w+"x"+this.res.h},shortLabel:function(){return this.res.h+"p"},compare:function(e){return this.res.w*this.res.h-e.res.w*e.res.h}}},getVideoData:function(){var e=this,t=this;return new Promise(function(n,a){e._deferredAction(function(){var e={duration:t.flashVideo.duration(),currentTime:t.flashVideo.getCurrentTime(),volume:t.flashVideo.getVolume(),paused:t._paused,ended:t._ended,res:{w:t.flashVideo.getWidth(),h:t.flashVideo.getHeight()}};n(e)})})},setPosterFrame:function(e){if(null==this._posterFrame){this._posterFrame=e;var t=document.createElement("img");t.src=e,t.className="videoPosterFrameImage",t.alt="poster frame",this.domElement.appendChild(t),this._posterFrameElement=t}},setAutoplay:function(e){this._autoplay=e},load:function(){var e=this._stream.sources.rtmp;null===this._currentQuality&&this._videoQualityStrategy&&(this._currentQuality=this._videoQualityStrategy.getQualityIndex(e));var t=this._currentQuality0?n:0];return a=parseInt(a),this._localImages[a].url},createLoadingElement:function(e){var t=document.createElement("div");t.className="loader";t.innerHTML='',e.appendChild(t);var n=document.createElement("p");n.className="sBodyText",n.innerHTML=base.dictionary.translate("Searching")+"...",e.appendChild(n)},createNotResultsFound:function(e){var t=document.createElement("div");t.className="noResults",t.innerHTML=base.dictionary.translate("Sorry! No results found."),e.appendChild(t)},doSearch:function(e,t){var n=this;$(t).empty(),n.createLoadingElement(t),n.search(e,function(e,a){if($(t).empty(),!e)if(0==a.length)n.createNotResultsFound(t);else for(var i=0;i=.7&&$(r).addClass("greenScore"));var o=document.createElement("div");o.className="TimePicContainer";var s=document.createElement("img");s.className="sBodyPicture",s.src=n.getPreviewImage(a[i].time);var l=document.createElement("p");l.className="sBodyText",l.innerHTML=""+n.prettyTime(a[i].time)+""+a[i].content,o.appendChild(s),r.appendChild(o),r.appendChild(l),t.appendChild(r),r.setAttribute("sec",a[i].time),$(r).hover(function(){$(this).css("background-color","#faa166")},function(){$(this).removeAttr("style")}),$(r).click(function(){var e=$(this).attr("sec");paella.player.videoContainer.seekToTime(e),paella.player.play()})}})},buildContent:function(e){var t=this,n=document.createElement("div");n.className="searchPluginContainer";var a=document.createElement("div");a.className="searchBody",n.appendChild(a),t._searchBody=a;var i=document.createElement("div");i.className="searchBar",n.appendChild(i);var r=document.createElement("input");r.className="searchBarInput",r.type="text",r.id="searchBarInput",r.name="searchString",r.placeholder=base.dictionary.translate("Search"),i.appendChild(r),$(r).change(function(){var e=$(r).val();null!=t._searchTimer&&t._searchTimer.cancel(),""!=e&&t.doSearch(e,a)}),$(r).keyup(function(e){if(13!=e.keyCode){var n=$(r).val();null!=t._searchTimer&&t._searchTimer.cancel(),""!=n?t._searchTimer=new base.Timer(function(e){t.doSearch(n,a)},t._searchTimerTime):$(t._searchBody).empty()}}),$(r).focus(function(){paella.keyManager.enabled=!1}),$(r).focusout(function(){paella.keyManager.enabled=!0}),e.appendChild(n)}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"showSocialPluginButton"},getIconClass:function(){return"icon-social"},getIndex:function(){return 560},getMinWindowSize:function(){return 600},getName:function(){return"es.upv.paella.socialPlugin"},checkEnabled:function(e){e(!0)},getDefaultToolTip:function(){return base.dictionary.translate("Share this video")},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},closeOnMouseOut:function(){return!0},setup:function(){if(this.buttonItems=null,this.socialMedia=null,this.buttons=[],this.selected_button=null,"es"==base.dictionary.currentLanguage()){base.dictionary.addDictionary({"Custom size:":"Tamaño personalizado:","Choose your embed size. Copy the text and paste it in your html page.":"Elija el tamaño del video a embeber. Copie el texto y péguelo en su página html.","Width:":"Ancho:","Height:":"Alto:"})}var e=this,t=13,n=38,a=40;$(this.button).keyup(function(i){e.isPopUpOpen()&&(i.keyCode==n?e.selected_button>0&&(e.selected_button=0&&(e.buttons[e.selected_button].className="socialItemButton "+e.buttons[e.selected_button].data.mediaData),e.selected_button++,e.buttons[e.selected_button].className=e.buttons[e.selected_button].className+" selected"):i.keyCode==t&&e.onItemClick(e.buttons[e.selected_button].data.mediaData))})},buildContent:function(e){var t=this;this.buttonItems={},this.socialMedia=["facebook","twitter","embed"],this.socialMedia.forEach(function(n){var a=t.getSocialMediaItemButton(n);t.buttonItems[t.socialMedia.indexOf(n)]=a,e.appendChild(a),t.buttons.push(a)}),this.selected_button=this.buttons.length},getSocialMediaItemButton:function(e){var t=document.createElement("div");return t.className="socialItemButton "+e,t.id=e+"_button",t.data={mediaData:e,plugin:this},$(t).click(function(e){this.data.plugin.onItemClick(this.data.mediaData)}),t},onItemClick:function(e){var t=this.getVideoUrl();switch(e){case"twitter":window.open("http://twitter.com/home?status="+t);break;case"facebook":window.open("http://www.facebook.com/sharer.php?u="+t);break;case"embed":this.embedPress()}paella.player.controls.hidePopUp(this.getName())},getVideoUrl:function(){return document.location.href},embedPress:function(){var e=document.location.protocol+"//"+document.location.host,t=document.location.pathname.split("/");t.length>0&&(t[t.length-1]="embed.html");var n=paella.initDelegate.getId(),a=e+t.join("/")+"?id="+n,i="
"+("
620x349
540x304
460x259
380x214
300x169
"+base.dictionary.translate("Custom size:")+"
"+base.dictionary.translate("Width:")+"
"+base.dictionary.translate("Height:")+"
")+"
"+base.dictionary.translate("Choose your embed size. Copy the text and paste it in your html page.")+"
";paella.messageBox.showMessage(i,{closeButton:!0,width:"750px",height:"210px",onClose:function(){}});var r=$("#social_embed_width-input")[0],o=$("#social_embed_height-input")[0];r.onkeyup=function(e){var t=parseInt(r.value),n=parseInt(o.value);isNaN(t)?r.value="":t<300?$("#social_embed-textarea")[0].value="Embed width too low. The minimum value is a width of 300.":(isNaN(n)&&(n=(t/(16/9)).toFixed(),o.value=n),$("#social_embed-textarea")[0].value='')};for(var s=$(".embedSizeButton"),l=0;l'}}}}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.test.videoLoadPlugin"},checkEnabled:function(e){if(this.startTime=0,this.endTime=0,this.startTime=Date.now(),"es"==base.dictionary.currentLanguage()){base.dictionary.addDictionary({"Video loaded in {0} seconds":"Video cargado en {0} segundos"})}e(!0)},getEvents:function(){return[paella.events.loadComplete]},onEvent:function(e,t){switch(e){case paella.events.loadComplete:this.onLoadComplete()}},onLoadComplete:function(){this.endTime=Date.now();var e=(this.endTime-this.startTime)/1e3;this.showOverlayMessage(base.dictionary.translate("Video loaded in {0} seconds").replace(/\{0\}/g,e))},showOverlayMessage:function(e){var t=paella.player.videoContainer.overlayContainer,n=document.createElement("div");n.className="videoLoadTestOverlay";var a=document.createElement("div");a.className="btn",a.innerHTML="X",a.onclick=function(){t.removeElement(n)};var i=document.createElement("div");i.className="videoLoadTest",i.innerHTML=e,i.appendChild(a),n.appendChild(i),t.addElement(n,{left:40,top:50,width:430,height:80})}},{},e)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"themeChooserPlugin"},getIconClass:function(){return"icon-paintbrush"},getIndex:function(){return 2030},getMinWindowSize:function(){return 600},getName:function(){return"es.upv.paella.themeChooserPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Change theme")},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},checkEnabled:function(e){this.currentUrl=null,this.currentMaster=null,this.currentSlave=null,this.availableMasters=[],this.availableSlaves=[],paella.player.config.skin&&paella.player.config.skin.available&&paella.player.config.skin.available instanceof Array&&paella.player.config.skin.available.length>0?e(!0):e(!1)},buildContent:function(e){var t=this;paella.player.config.skin.available.forEach(function(n){var a=document.createElement("div");a.className="themebutton",a.innerHTML=n.replace("-"," ").replace("_"," "),$(a).click(function(e){paella.utils.skin.set(n),paella.player.controls.hidePopUp(t.getName())}),e.appendChild(a)})}},{},e)}(paella.ButtonPlugin)}),paella.addDataDelegate("cameraTrack",function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{read:function(e,t,n){var a=paella.player.videoLoader.getVideoUrl();a?(a+="trackhd.json",paella.utils.ajax.get({url:a},function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}e.positions.sort(function(e,t){return e.time-t.time}),n(e)},function(){return n(null)})):n(null)},write:function(e,t,n,a){},remove:function(e,t,n){}},{},e)}(paella.DataDelegate)}),function(){var e=null;function t(e,t){var n=t?1e3*(t.time-e.time):100;n>2e3&&(n=2e3);var a=this._videoData.originalWidth/this._videoData.width,i=e&&e.rect||[0,0],r=i[0]/this._videoData.originalWidth,o=(i[1]+this._videoData.originalHeight/2)/this._videoData.originalHeight;paella.player.videoContainer.masterVideo().setZoom(100*a,r*a*100,100*(o*a-1),n)}paella.addPlugin(function(){return function(n){return $traceurRuntime.createClass(function t(){$traceurRuntime.superConstructor(t).call(this),e=this,this._videoData={},this._trackData=[],this._enabled=!0},{checkEnabled:function(e){var t=this;paella.data.read("cameraTrack",{id:paella.initDelegate.getId()},function(n){n?(t._videoData.width=n.width,t._videoData.height=n.height,t._videoData.originalWidth=n.originalWidth,t._videoData.originalHeight=n.originalHeight,t._trackData=n.positions,t._enabled=!0):t._enabled=!1,e(t._enabled)})},get enabled(){return this._enabled},set enabled(e){this._enabled=e,this._enabled&&t.apply(this,[this._lastPosition])},getName:function(){return"es.upv.paella.track4kPlugin"},getEvents:function(){return[paella.events.timeupdate,paella.events.play,paella.events.seekToTime]},onEvent:function(e,t){this._trackData.length&&(e==paella.events.play||(e==paella.events.timeupdate?this.updateZoom(t.currentTime):e==paella.events.seekToTime&&this.seekTo(t.newPosition)))},updateZoom:function(e){var n=function(e){var t=null;return e=Math.round(e),this._trackData.some(function(n,a){return n.time==e&&(t=n),null!=t}),t}.apply(this,[e]),a=function(e){var t=-1;return e=Math.round(e),this._trackData.some(function(n,a){return n.time>=e&&(t=a),-1!=t}),this._trackData.length>t+1?this._trackData[t+1]:null}.apply(this,[e]);n&&this._lastPosition!=n&&this._enabled&&(this._lastPosition=n,t.apply(this,[n,a]))},seekTo:function(e){var n=function(e){var t=this._trackData[0];return e=Math.round(e),this._trackData.some(function(n,a){return n.time==e||(t=n,!1)}),t}.apply(this,[e]);n&&this._enabled&&(this._lastPosition=n,t.apply(this,[n]))}},{},n)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(t){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"videoZoomToolbar"},getIconClass:function(){return"icon-screen"},closeOnMouseOut:function(){return!0},getIndex:function(){return 2030},getMinWindowSize:function(){return paella.player.config.player&&paella.player.config.player.videoZoom&&paella.player.config.player.videoZoom.minWindowSize||600},getName:function(){return"es.upv.paella.videoZoomTrack4kPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Set video zoom")},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},checkEnabled:function(t){var n=this;paella.player.videoContainer.videoPlayers().then(function(a){var i=paella.player.config.plugins.list[n.getName()],r=i.targetStreamIndex,o=i.autoModeByDefault;n.targetPlayer=a.length>r?a[r]:null,e.enabled=o,t(paella.player.config.player.videoZoom.enabled&&n.targetPlayer&&n.targetPlayer.allowZoom())})},buildContent:function(t){var n=this,a=function(){e.enabled?n.changeIconClass("icon-mini-videocamera"):n.changeIconClass("icon-mini-zoom-in")};function i(e,t,n){var a=document.createElement("div");return a.className="videoZoomToolbarItem "+e,a.innerHTML=n||'',$(a).click(t),a}paella.events.bind(paella.events.videoZoomChanged,function(e,t){a()}),a(),t.appendChild(i("zoom-in",function(e){n.zoomIn()})),t.appendChild(i("zoom-out",function(e){n.zoomOut()})),t.appendChild(i("zoom-auto",function(e){n.zoomAuto(),paella.player.controls.hidePopUp(n.getName())},"auto"))},zoomIn:function(){e.enabled=!1,this.targetPlayer.zoomIn()},zoomOut:function(){e.enabled=!1,this.targetPlayer.zoomOut()},zoomAuto:function(){e.enabled=!0}},{},t)}(paella.ButtonPlugin)})}(),paella.plugins.translectures={},Class("paella.captions.translectures.Caption",paella.captions.Caption,{initialize:function(e,t,n,a,i,r){this.parent(e,t,n,a,r),this._captionsProvider="translecturesCaptionsProvider",this._editURL=i},canEdit:function(e){e(!1,void 0!=this._editURL&&""!=this._editURL)},goToEdit:function(){var e=this;paella.player.auth.userData().then(function(t){1==t.isAnonymous?e.askForAnonymousOrLoginEdit():e.doEdit()})},doEdit:function(){window.location.href=this._editURL},doLoginAndEdit:function(){paella.player.auth.login(this._editURL)},askForAnonymousOrLoginEdit:function(){var e=this,t=document.createElement("div");t.className="translecturesCaptionsMessageBox";var n=document.createElement("div");n.className="title",n.innerHTML=base.dictionary.translate("You are trying to modify the transcriptions, but you are not Logged in!"),t.appendChild(n);var a=document.createElement("div");a.className="authMethodsContainer",t.appendChild(a);var i=document.createElement("div");i.className="authMethod",a.appendChild(i);var r=document.createElement("a");r.href="#",r.style.color="#004488",i.appendChild(r);var o=document.createElement("img");o.src="resources/style/caption_mlangs_anonymous.png",o.alt="Anonymous",o.style.height="100px",r.appendChild(o);var s=document.createElement("p");s.innerHTML=base.dictionary.translate("Continue editing the transcriptions anonymously"),r.appendChild(s),$(r).click(function(){e.doEdit()}),(i=document.createElement("div")).className="authMethod",a.appendChild(i),(r=document.createElement("a")).href="#",r.style.color="#004488",i.appendChild(r),(o=document.createElement("img")).src="resources/style/caption_mlangs_lock.png",o.alt="Login",o.style.height="100px",r.appendChild(o),(s=document.createElement("p")).innerHTML=base.dictionary.translate("Log in and edit the transcriptions"),r.appendChild(s),$(r).click(function(){e.doLoginAndEdit()}),paella.messageBox.showElement(t)}}),Class("paella.plugins.translectures.CaptionsPlugIn",paella.EventDrivenPlugin,{getName:function(){return"es.upv.paella.translecture.captionsPlugin"},getEvents:function(){return[]},onEvent:function(e,t){},checkEnabled:function(e){var t=this,n=paella.player.videoIdentifier;if(void 0==this.config.tLServer||void 0==this.config.tLdb)base.log.warning(this.getName()+" plugin not configured!"),e(!1);else{var a=(this.config.tLServer+"/langs?db=${tLdb}&id=${videoId}").replace(/\$\{videoId\}/gi,n).replace(/\$\{tLdb\}/gi,this.config.tLdb);base.ajax.get({url:a},function(i,r,o,s){0==i.scode?(i.langs.forEach(function(e){var a,i=(t.config.tLServer+"/dfxp?format=1&pol=0&db=${tLdb}&id=${videoId}&lang=${tl.lang.code}").replace(/\$\{videoId\}/gi,n).replace(/\$\{tLdb\}/gi,t.config.tLdb).replace(/\$\{tl.lang.code\}/gi,e.code);t.config.tLEdit&&(a=t.config.tLEdit.replace(/\$\{videoId\}/gi,n).replace(/\$\{tLdb\}/gi,t.config.tLdb).replace(/\$\{tl.lang.code\}/gi,e.code));var r=e.value;switch(e.type){case 0:r+=" ("+paella.dictionary.translate("Auto")+")";break;case 1:r+=" ("+paella.dictionary.translate("Under review")+")"}var o=new paella.captions.translectures.Caption(e.code,"dfxp",i,{code:e.code,txt:r},a);paella.captions.addCaptions(o)}),e(!1)):(base.log.debug("Error getting available captions from translectures: "+a),e(!1))},function(t,n,i){base.log.debug("Error getting available captions from translectures: "+a),e(!1)})}}}),new paella.plugins.translectures.CaptionsPlugIn,paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.usertracking.elasticsearchSaverPlugin"},checkEnabled:function(e){this.type="userTrackingSaverPlugIn",this._url=this.config.url,this._index=this.config.index||"paellaplayer",this._type=this.config.type||"usertracking";var t=!0;void 0==this._url&&(t=!1,base.log.debug("No ElasticSearch URL found in config file. Disabling ElasticSearch PlugIn")),e(t)},log:function(e,t){var n=t;"object"!=$traceurRuntime.typeof(n)&&(n={value:n}),paella.player.videoContainer.currentTime().then(function(t){var a={date:new Date,video:paella.initDelegate.getId(),playing:!paella.player.videoContainer.paused(),time:parseInt(t+paella.player.videoContainer.trimStart()),event:e,params:n};paella.ajax.post({url:this._url+"/"+this._index+"/"+this._type+"/",params:JSON.stringify(a)})})}},{},e)}(paella.userTracking.SaverPlugIn)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.usertracking.GoogleAnalyticsSaverPlugin"},checkEnabled:function(e){var t,n,a,i,r,o,s=this.config.trackingID,l=this.config.domain||"auto";s?(base.log.debug("Google Analitycs Enabled"),t=window,n=document,a="script",i="__gaTracker",t.GoogleAnalyticsObject=i,t[i]=t[i]||function(){(t[i].q=t[i].q||[]).push(arguments)},t[i].l=1*new Date,r=n.createElement(a),o=n.getElementsByTagName(a)[0],r.async=1,r.src="//www.google-analytics.com/analytics.js",o.parentNode.insertBefore(r,o),__gaTracker("create",s,l),__gaTracker("send","pageview"),e(!0)):(base.log.debug("No Google Tracking ID found in config file. Disabling Google Analitycs PlugIn"),e(!1))},log:function(e,t){if(void 0===this.config.category||!0===this.config.category){var n=this.config.category||"PaellaPlayer",a=e,i="";try{i=JSON.stringify(t)}catch(e){}__gaTracker("send","event",n,a,i)}}},{},e)}(paella.userTracking.SaverPlugIn)});var _paq=_paq||[];function buildVideo360Canvas(e,t){var n=new(function(e){return $traceurRuntime.createClass(function e(t){$traceurRuntime.superConstructor(e).call(this),this.stream=t},{get video(){return this.texture?this.texture.video:null},loaded:function(){var e=this;return new Promise(function(t){var n=function(){e.video?t(e):setTimeout(n,100)};n()})},buildScene:function(){var e=this;this._root=new bg.scene.Node(this.gl,"Root node"),bg.base.Loader.RegisterPlugin(new bg.base.TextureLoaderPlugin),bg.base.Loader.RegisterPlugin(new bg.base.VideoTextureLoaderPlugin),bg.base.Loader.RegisterPlugin(new bg.base.VWGLBLoaderPlugin),bg.base.Loader.Load(this.gl,this.stream.src).then(function(t){e.texture=t;var n=bg.scene.PrimitiveFactory.Sphere(e.gl,1,50),a=new bg.scene.Node(e.gl);a.addComponent(n),n.getMaterial(0).texture=t,n.getMaterial(0).lightEmission=1,n.getMaterial(0).lightEmissionMaskInvert=!0,n.getMaterial(0).cullFace=!1,e._root.addChild(a),e.postRedisplay()});var t=new bg.scene.Node(this.gl,"Light");this._root.addChild(t),this._camera=new bg.scene.Camera;var n=new bg.scene.Node("Camera");n.addComponent(this._camera),n.addComponent(new bg.scene.Transform);var a=new bg.manipulation.OrbitCameraController;n.addComponent(a),a.maxPitch=90,a.minPitch=-90,a.maxDistance=0,a.minDistace=0,this._root.addChild(n)},init:function(){bg.Engine.Set(new bg.webgl1.Engine(this.gl)),this.buildScene(),this._renderer=bg.render.Renderer.Create(this.gl,bg.render.RenderPath.FORWARD),this._inputVisitor=new bg.scene.InputVisitor},frame:function(e){this.texture&&this.texture.update(),this._renderer.frame(this._root,e)},display:function(){this._renderer.display(this._root,this._camera)},reshape:function(e,t){this._camera.viewport=new bg.Viewport(0,0,e,t),this._camera.projection.perspective(60,this._camera.viewport.aspectRatio,.1,100)},mouseDown:function(e){this._inputVisitor.mouseDown(this._root,e)},mouseDrag:function(e){this._inputVisitor.mouseDrag(this._root,e),this.postRedisplay()},mouseWheel:function(e){this._inputVisitor.mouseWheel(this._root,e),this.postRedisplay()},touchStart:function(e){this._inputVisitor.touchStart(this._root,e)},touchMove:function(e){this._inputVisitor.touchMove(this._root,e),this.postRedisplay()},mouseUp:function(e){this._inputVisitor.mouseUp(this._root,e)},mouseMove:function(e){this._inputVisitor.mouseMove(this._root,e)},mouseOut:function(e){this._inputVisitor.mouseOut(this._root,e)},touchEnd:function(e){this._inputVisitor.touchEnd(this._root,e)}},{},e)}(bg.app.WindowController))(e),a=bg.app.MainLoop.singleton;return a.updateMode=bg.app.FrameUpdate.AUTO,a.canvas=t,a.run(n),n.loaded()}function buildVideo360ThetaCanvas(e,t){function n(e,t,n){var a,i,r=(a=((e+90)/180-1)*Math.PI,i=(.5-t/180)*Math.PI,new bg.Vector3(Math.cos(i)*Math.cos(a),Math.cos(i)*Math.sin(a),Math.sin(i))),o=function(e,t,n){var a=n;return n<-1?a=-1:n>1&&(a=1),new bg.Vector2(Math.atan2(t,e),Math.acos(a)/Math.PI)}(Math.sin(-.5*Math.PI)*r.z+Math.cos(-.5*Math.PI)*r.x,r.y,Math.cos(-.5*Math.PI)*r.z-Math.sin(-.5*Math.PI)*r.x),s=0===n?.883*o.y*Math.cos(o.x)*.5+.25:.883*(1-o.y)*Math.cos(-1*o.x+Math.PI)*.5+.75,l=0===n?.784888888888881*o.y*Math.sin(o.x)+.55555555555556:.784888888888881*(1-o.y)*Math.sin(-1*o.x+Math.PI)+.55555555555556;return new bg.Vector2(s,l)}var a=new(function(e){return $traceurRuntime.createClass(function e(t){$traceurRuntime.superConstructor(e).call(this),this.stream=t},{get video(){return this.texture?this.texture.video:null},loaded:function(){var e=this;return new Promise(function(t){var n=function(){e.video?t(e):setTimeout(n,100)};n()})},buildScene:function(){var e=this;this._root=new bg.scene.Node(this.gl,"Root node"),bg.base.Loader.RegisterPlugin(new bg.base.TextureLoaderPlugin),bg.base.Loader.RegisterPlugin(new bg.base.VideoTextureLoaderPlugin),bg.base.Loader.RegisterPlugin(new bg.base.VWGLBLoaderPlugin),bg.base.Loader.Load(this.gl,this.stream.src).then(function(t){e.texture=t;var a=function(e){var t=new bg.scene.Node(e),a=new bg.scene.Drawable;t.addComponent(a);for(var i=new bg.base.PolyList(e),r=[],o=[],s=[],l=0;l<=180;l+=5){for(var u=0;u<=360;u+=5)r.push(new bg.Vector3(Math.sin(Math.PI*l/180)*Math.sin(Math.PI*u/180)*1,1*Math.cos(Math.PI*l/180),Math.sin(Math.PI*l/180)*Math.cos(Math.PI*u/180)*1)),o.push(new bg.Vector3(0,0,-1));for(var c=0;c<=180;c+=5)s.push(n(c,l,0));for(var d=180;d<=360;d+=5)s.push(n(d,l,1))}function p(e,t,n,a,r,o,s,l,u){i.vertex.push(e.x),i.vertex.push(e.y),i.vertex.push(e.z),i.vertex.push(t.x),i.vertex.push(t.y),i.vertex.push(t.z),i.vertex.push(n.x),i.vertex.push(n.y),i.vertex.push(n.z),i.normal.push(a.x),i.normal.push(a.y),i.normal.push(a.z),i.normal.push(r.x),i.normal.push(r.y),i.normal.push(r.z),i.normal.push(o.x),i.normal.push(o.z),i.normal.push(o.z),i.texCoord0.push(s.x),i.texCoord0.push(s.y),i.texCoord0.push(l.x),i.texCoord0.push(l.y),i.texCoord0.push(u.x),i.texCoord0.push(u.y),i.index.push(i.index.length),i.index.push(i.index.length),i.index.push(i.index.length)}for(var h=0;h<36;h++)for(var m=0;m<72;m++){var f=73*h+m,g=m<36?74*h+m:74*h+m+1;s[g+0],s[g+1],s[g+74],s[g+1],s[g+75],s[g+74];var v=r[f+0],y=o[f+0],b=s[g+0],_=r[f+1],C=o[f+1],w=s[g+1],P=r[f+73],E=o[f+73],k=s[g+74],T=r[f+74],x=o[f+74],S=s[g+75];p(v,_,P,y,C,E,b,w,k),p(_,T,P,C,x,E,w,S,k)}i.build(),a.addPolyList(i);var I=bg.Matrix4.Scale(-1,1,1);return t.addComponent(new bg.scene.Transform(I)),t}(e.gl),i=a.component("bg.scene.Drawable");i.getMaterial(0).texture=t,i.getMaterial(0).lightEmission=1,i.getMaterial(0).lightEmissionMaskInvert=!0,i.getMaterial(0).cullFace=!1,e._root.addChild(a),e.postRedisplay()});var t=new bg.scene.Node(this.gl,"Light");this._root.addChild(t),this._camera=new bg.scene.Camera;var a=new bg.scene.Node("Camera");a.addComponent(this._camera),a.addComponent(new bg.scene.Transform);var i=new bg.manipulation.OrbitCameraController;a.addComponent(i),i.maxPitch=90,i.minPitch=-90,i.maxDistance=0,i.minDistace=0,this._root.addChild(a)},init:function(){bg.Engine.Set(new bg.webgl1.Engine(this.gl)),this.buildScene(),this._renderer=bg.render.Renderer.Create(this.gl,bg.render.RenderPath.FORWARD),this._inputVisitor=new bg.scene.InputVisitor},frame:function(e){this.texture&&this.texture.update(),this._renderer.frame(this._root,e)},display:function(){this._renderer.display(this._root,this._camera)},reshape:function(e,t){this._camera.viewport=new bg.Viewport(0,0,e,t),this._camera.projection.perspective(60,this._camera.viewport.aspectRatio,.1,100)},mouseDown:function(e){this._inputVisitor.mouseDown(this._root,e)},mouseDrag:function(e){this._inputVisitor.mouseDrag(this._root,e),this.postRedisplay()},mouseWheel:function(e){this._inputVisitor.mouseWheel(this._root,e),this.postRedisplay()},touchStart:function(e){this._inputVisitor.touchStart(this._root,e)},touchMove:function(e){this._inputVisitor.touchMove(this._root,e),this.postRedisplay()},mouseUp:function(e){this._inputVisitor.mouseUp(this._root,e)},mouseMove:function(e){this._inputVisitor.mouseMove(this._root,e)},mouseOut:function(e){this._inputVisitor.mouseOut(this._root,e)},touchEnd:function(e){this._inputVisitor.touchEnd(this._root,e)}},{},e)}(bg.app.WindowController))(e),i=bg.app.MainLoop.singleton;return i.updateMode=bg.app.FrameUpdate.AUTO,i.canvas=t,i.run(a),a.loaded()}function onYouTubeIframeAPIReady(){paella.youtubePlayerVars.apiReadyPromise.resolve()}paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.usertracking.piwikSaverPlugIn"},checkEnabled:function(e){this.config.tracker&&this.config.siteId?(_paq.push(["trackPageView"]),_paq.push(["enableLinkTracking"]),function(){var t=this.config.tracker;_paq.push(["setTrackerUrl",t+"/piwik.php"]),_paq.push(["setSiteId",this.config.siteId]);var n=document,a=n.createElement("script"),i=n.getElementsByTagName("script")[0];a.type="text/javascript",a.async=!0,a.defer=!0,a.src=t+"piwik.js",i.parentNode.insertBefore(a,i),e(!0)}()):e(!1)},log:function(e,t){var n=this.config.category||"PaellaPlayer",a=e,i="";try{i=JSON.stringify(t)}catch(e){}_paq.push(["trackEvent",n,a,i])}},{},e)}(paella.userTracking.SaverPlugIn)}),Class("paella.Video360",paella.VideoElementBase,{_posterFrame:null,_currentQuality:null,_autoplay:!1,_streamName:null,initialize:function(e,t,n,a,i,r,o){this.parent(e,t,"canvas",0,0,1280,720),this._streamName=o||"video360";var s=this;paella.player.videoContainer.disablePlayOnClick(),this._stream.sources[this._streamName]&&this._stream.sources[this._streamName].sort(function(e,t){return e.res.h-t.res.h}),this.video=null,new paella.Timer(function(e){s.canvasController&&s.canvasController.canvas.domElement},500).repeat=!0},defaultProfile:function(){return"chroma"},_setVideoElem:function(e){$(this.video).bind("progress",evtCallback),$(this.video).bind("loadstart",evtCallback),$(this.video).bind("loadedmetadata",evtCallback),$(this.video).bind("canplay",evtCallback),$(this.video).bind("oncanplay",evtCallback)},_loadDeps:function(){return new Promise(function(e,t){window.$paella_bg2e?defer.resolve(window.$paella_bg2e):paella.require(paella.baseUrl+"resources/deps/bg2e.js").then(function(){window.$paella_bg2e=bg,e(window.$paella_bg2e)}).catch(function(e){console.error(e.message),t()})})},_deferredAction:function(e){var t=this;return new Promise(function(n,a){t.video?n(e()):$(t.video).bind("canplay",function(){t._ready=!0,n(e())})})},_getQualityObject:function(e,t){return{index:e,res:t.res,src:t.src,toString:function(){return this.res.w+"x"+this.res.h},shortLabel:function(){return this.res.h+"p"},compare:function(e){return this.res.w*this.res.h-e.res.w*e.res.h}}},allowZoom:function(){return!1},getVideoData:function(){var e=this,t=this;return new Promise(function(n,a){e._deferredAction(function(){n({duration:t.video.duration,currentTime:t.video.currentTime,volume:t.video.volume,paused:t.video.paused,ended:t.video.ended,res:{w:t.video.videoWidth,h:t.video.videoHeight}})})})},setPosterFrame:function(e){this._posterFrame=e},setAutoplay:function(e){this._autoplay=e,e&&this.video&&this.video.setAttribute("autoplay",e)},load:function(){var e=this;return new Promise(function(t,n){e._loadDeps().then(function(){var a=e._stream.sources[e._streamName];null===e._currentQuality&&e._videoQualityStrategy&&(e._currentQuality=e._videoQualityStrategy.getQualityIndex(a));var i=e._currentQuality0&&base.userAgent.system.iOS)return!1;for(var t in e.sources)if("video360"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return paella.ChromaVideo._loaded=!0,++paella.videoFactories.Html5VideoFactory.s_instances,new paella.Video360(e,t,n.x,n.y,n.w,n.h)}}),Class("paella.Video360Theta",paella.VideoElementBase,{_posterFrame:null,_currentQuality:null,_autoplay:!1,_streamName:null,initialize:function(e,t,n,a,i,r,o){this.parent(e,t,"canvas",0,0,1280,720),this._streamName=o||"video360theta";var s=this;paella.player.videoContainer.disablePlayOnClick(),this._stream.sources[this._streamName]&&this._stream.sources[this._streamName].sort(function(e,t){return e.res.h-t.res.h}),this.video=null,new paella.Timer(function(e){s.canvasController&&s.canvasController.canvas.domElement},500).repeat=!0},defaultProfile:function(){return"chroma"},_setVideoElem:function(e){$(this.video).bind("progress",evtCallback),$(this.video).bind("loadstart",evtCallback),$(this.video).bind("loadedmetadata",evtCallback),$(this.video).bind("canplay",evtCallback),$(this.video).bind("oncanplay",evtCallback)},_loadDeps:function(){return new Promise(function(e,t){window.$paella_bg2e?defer.resolve(window.$paella_bg2e):paella.require(paella.baseUrl+"resources/deps/bg2e.js").then(function(){window.$paella_bg2e=bg,e(window.$paella_bg2e)}).catch(function(e){console.error(e.message),t()})})},_deferredAction:function(e){var t=this;return new Promise(function(n,a){t.video?n(e()):$(t.video).bind("canplay",function(){t._ready=!0,n(e())})})},_getQualityObject:function(e,t){return{index:e,res:t.res,src:t.src,toString:function(){return this.res.w+"x"+this.res.h},shortLabel:function(){return this.res.h+"p"},compare:function(e){return this.res.w*this.res.h-e.res.w*e.res.h}}},allowZoom:function(){return!1},getVideoData:function(){var e=this,t=this;return new Promise(function(n,a){e._deferredAction(function(){n({duration:t.video.duration,currentTime:t.video.currentTime,volume:t.video.volume,paused:t.video.paused,ended:t.video.ended,res:{w:t.video.videoWidth,h:t.video.videoHeight}})})})},setPosterFrame:function(e){this._posterFrame=e},setAutoplay:function(e){this._autoplay=e,e&&this.video&&this.video.setAttribute("autoplay",e)},load:function(){var e=this;return new Promise(function(t,n){e._loadDeps().then(function(){var a=e._stream.sources[e._streamName];null===e._currentQuality&&e._videoQualityStrategy&&(e._currentQuality=e._videoQualityStrategy.getQualityIndex(a));var i=e._currentQuality0&&base.userAgent.system.iOS)return!1;for(var t in e.sources)if("video360theta"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return paella.ChromaVideo._loaded=!0,++paella.videoFactories.Html5VideoFactory.s_instances,new paella.Video360Theta(e,t,n.x,n.y,n.w,n.h)}}),paella.addDataDelegate("metadata",function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{read:function(e,t,n){n(paella.player.videoLoader.getMetadata()[t],!0)},write:function(e,t,n,a){a({},!0)},remove:function(e,t,n){n({},!0)}},{},e)}(paella.DataDelegate)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getIndex:function(){return 10},getSubclass:function(){return"videoData"},getAlignment:function(){return"left"},getDefaultToolTip:function(){return""},checkEnabled:function(e){var t=paella.player.config.plugins.list["es.upv.paella.videoDataPlugin"],n=t&&t.excludeLocations||[],a=t&&t.excludeParentLocations||[],i=n.some(function(e){return RegExp(e,"i").test(location.href)});window!=window.parent&&(i=i||a.some(function(e){var t=RegExp(e,"i");try{return t.test(parent.location.href)}catch(e){return!1}})),e(!i)},setup:function(){var e=document.createElement("h1");e.innerHTML="",e.className="videoTitle",this.button.appendChild(e),paella.data.read("metadata","title",function(t){e.innerHTML=t})},action:function(e){},getName:function(){return"es.upv.paella.videoDataPlugin"}},{},e)}(paella.VideoOverlayButtonPlugin)}),paella.addPlugin(function(){var e=320,t=180;return function(n){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getIndex:function(){return 10},getSubclass:function(){return"videoZoom"},getAlignment:function(){return"right"},getDefaultToolTip:function(){return""},checkEnabled:function(e){e(!0)},setup:function(){var n=this;function a(){var e=$(".videoZoomButton"),t=$(".videoZoom");this._visible?(e.show(),t.show()):(e.hide(),t.hide())}this._thumbnails=[],this._visible=!1,paella.player.videoContainer.videoPlayers().then(function(i){i.forEach(function(i,r){i.allowZoom()&&(n._visible=i.zoomAvailable(),function(e){var t=e.parent.domElement,n=document.createElement("button");t.appendChild(n),n.className="videoZoomButton btn zoomIn",n.innerHTML='',$(n).on("mousedown",function(){paella.player.videoContainer.disablePlayOnClick(),e.zoomIn()}),$(n).on("mouseup",function(){setTimeout(function(){return paella.player.videoContainer.enablePlayOnClick()},10)}),n=document.createElement("button"),t.appendChild(n),n.className="videoZoomButton btn zoomOut",n.innerHTML='',$(n).on("mousedown",function(){paella.player.videoContainer.disablePlayOnClick(),e.zoomOut()}),$(n).on("mouseup",function(){setTimeout(function(){return paella.player.videoContainer.enablePlayOnClick()},10)})}.apply(n,[i]),i.supportsCaptureFrame().then(function(o){if(o){var s=document.createElement("div");s.className="zoom-container";var l=function(n){var a=document.createElement("canvas");return a.width=e,a.height=t,a.className="zoom-thumbnail",a.id="zoomContainer"+n,a}.apply(n,[r]),u=function(){var e=document.createElement("div");return e.className="zoom-rect",e}.apply(n);n.button.appendChild(s),s.appendChild(l),s.appendChild(u),$(s).hide(),n._thumbnails.push({player:i,thumbContainer:s,zoomRect:u,canvas:l}),a.apply(n)}}))})});var i=!1;paella.events.bind(paella.events.play,function(a){var r=function(){n._thumbnails.forEach(function(n){var a,i,r;i=(a=n).player,r=a.canvas,i.captureFrame().then(function(n){r.getContext("2d").drawImage(n.source,0,0,e,t)})}),i&&setTimeout(function(){r()},2e3)};i=!0,r()}),paella.events.bind(paella.events.pause,function(e){i=!1}),paella.events.bind(paella.events.videoZoomChanged,function(e,t){n._thumbnails.some(function(e){if(e.player==t.video){if(e.player.zoom>100){$(e.thumbContainer).show();var n=100*t.video.zoomOffset.x/t.video.zoom,a=100*t.video.zoomOffset.y/t.video.zoom,i=e.zoomRect;$(i).css({left:n+"%",top:a+"%",width:1e4/t.video.zoom+"%",height:1e4/t.video.zoom+"%"})}else $(e.thumbContainer).hide();return!0}})}),paella.events.bind(paella.events.zoomAvailabilityChanged,function(e,t){n._visible=t.available,a.apply(n)})},action:function(e){},getName:function(){return"es.upv.paella.videoZoomPlugin"}},{},n)}(paella.VideoOverlayButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"videoZoomToolbar"},getIconClass:function(){return"icon-screen"},getIndex:function(){return 2030},getMinWindowSize:function(){return paella.player.config.player&&paella.player.config.player.videoZoom&&paella.player.config.player.videoZoom.minWindowSize||600},getName:function(){return"es.upv.paella.videoZoomToolbarPlugin"},getDefaultToolTip:function(){return base.dictionary.translate("Change theme")},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},checkEnabled:function(e){var t=this;paella.player.videoContainer.videoPlayers().then(function(n){var a=paella.player.config.plugins.list["es.upv.paella.videoZoomToolbarPlugin"].targetStreamIndex;t.targetPlayer=n.length>a?n[a]:null,e(paella.player.config.player.videoZoom.enabled&&t.targetPlayer&&t.targetPlayer.allowZoom())})},buildContent:function(e){var t=this;function n(e,t){var n=document.createElement("div");return n.className="videoZoomToolbarItem "+e,n.innerHTML='',$(n).click(t),n}paella.events.bind(paella.events.videoZoomChanged,function(e,n){t.setText(Math.round(n.video.zoom)+"%")}),this.setText("100%"),e.appendChild(n("zoom-in",function(e){t.targetPlayer.zoomIn()})),e.appendChild(n("zoom-out",function(e){t.targetPlayer.zoomOut()}))}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"right"},getSubclass:function(){return"showViewModeButton"},getIconClass:function(){return"icon-presentation-mode"},getIndex:function(){return 540},getMinWindowSize:function(){return 300},getName:function(){return"es.upv.paella.viewModePlugin"},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},getDefaultToolTip:function(){return base.dictionary.translate("Change video layout")},checkEnabled:function(e){this.buttonItems=null,this.buttons=[],this.selected_button=null,this.active_profiles=null,this.active_profiles=this.config.activeProfiles,e(!paella.player.videoContainer.isMonostream)},closeOnMouseOut:function(){return!0},setup:function(){var e=this,t=13,n=38,a=40;paella.events.bind(paella.events.setProfile,function(t,n){e.onProfileChange(n.profileName)}),$(this.button).keyup(function(i){e.isPopUpOpen()&&(i.keyCode==n?e.selected_button>0&&(e.selected_button=0&&(e.buttons[e.selected_button].className="viewModeItemButton "+e.buttons[e.selected_button].data.profile),e.selected_button++,e.buttons[e.selected_button].className=e.buttons[e.selected_button].className+" selected"):i.keyCode==t&&e.onItemClick(e.buttons[e.selected_button],e.buttons[e.selected_button].data.profile,e.buttons[e.selected_button].data.profile))})},buildContent:function(e){var t=this;this.buttonItems={},paella.Profiles.loadProfileList(function(n){Object.keys(n).forEach(function(a){if(!n[a].hidden){if(t.active_profiles){var i=!1;if(t.active_profiles.forEach(function(e){e==a&&(i=!0)}),0==i)return}var r=paella.player.videoContainer.sourceData[0].sources;if(("s_p_blackboard2"!=a||0!=r.hasOwnProperty("image"))&&("chroma"!=a||r.chroma)){var o=n[a],s=t.getProfileItemButton(a,o);t.buttonItems[a]=s,e.appendChild(s),t.buttons.push(s),paella.player.selectedProfile==a&&(t.buttonItems[a].className=t.getButtonItemClass(a,!0))}}}),t.selected_button=t.buttons.length})},getProfileItemButton:function(e,t){var n=document.createElement("div");return n.className=this.getButtonItemClass(e,!1),n.id=e+"_button",n.data={profile:e,profileData:t,plugin:this},$(n).click(function(e){this.data.plugin.onItemClick(this,this.data.profile,this.data.profileData)}),n},onProfileChange:function(e){var t=this,n=this.buttonItems[e],a=this.buttonItems;Object.keys(a).forEach(function(e){t.buttonItems[e].className=t.getButtonItemClass(e,!1)}),n&&(n.className=t.getButtonItemClass(e,!0))},onItemClick:function(e,t,n){this.buttonItems[t]&&paella.player.setProfile(t),paella.player.controls.hidePopUp(this.getName())},getButtonItemClass:function(e,t){return"viewModeItemButton "+e+(t?" selected":"")}},{},e)}(paella.ButtonPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getAlignment:function(){return"left"},getSubclass:function(){return"volumeRangeButton"},getIconClass:function(){return"icon-volume-high"},getName:function(){return"es.upv.paella.volumeRangePlugin"},getButtonType:function(){return paella.ButtonPlugin.type.popUpButton},getDefaultToolTip:function(){return base.dictionary.translate("Volume")},getIndex:function(){return 120},closeOnMouseOut:function(){return!0},checkEnabled:function(e){this._tempMasterVolume=0,this._inputMaster=null,this._control_NotMyselfEvent=!0,this._storedValue=!1,e(!base.userAgent.browser.IsMobileVersion)},setup:function(){var e=this;paella.events.bind(paella.events.videoUnloaded,function(t,n){e.storeVolume()}),paella.events.bind(paella.events.singleVideoReady,function(t,n){e.loadStoredVolume(n)}),paella.events.bind(paella.events.setVolume,function(t,n){e.updateVolumeOnEvent(n)})},updateVolumeOnEvent:function(e){this._control_NotMyselfEvent?this._inputMaster=e.master:this._control_NotMyselfEvent=!0},storeVolume:function(){var e=this;paella.player.videoContainer.mainAudioPlayer().volume().then(function(t){e._tempMasterVolume=t,e._storedValue=!0})},loadStoredVolume:function(e){0==this._storedValue&&this.storeVolume(),this._tempMasterVolume&&paella.player.videoContainer.setVolume({master:this._tempMasterVolume}),this._storedValue=!1},buildContent:function(e){var t=this,n=this,a=document.createElement("div");a.className="videoRangeContainer";var i=document.createElement("div");i.className="range";var r=document.createElement("div");r.className="image master";var o=document.createElement("input");function s(){var e=$(o).val();n._control_NotMyselfEvent=!1,paella.player.videoContainer.setVolume({master:e})}n._inputMaster=o,o.type="range",o.min=0,o.max=1,o.step=.01,paella.player.videoContainer.masterVideo().volume().then(function(e){o.value=e}),$(o).bind("input",function(e){s()}),$(o).change(function(){s()}),i.appendChild(r),i.appendChild(o),a.appendChild(i),paella.events.bind(paella.events.setVolume,function(e,n){o.value=n.master,t.updateClass()}),e.appendChild(a),n.updateClass();var l=37,u=39;$(this.button).keyup(function(e){n.isPopUpOpen()&&paella.player.videoContainer.volume().then(function(t){var n=-1;e.keyCode==l?n=t-.1:e.keyCode==u&&(n=t+.1),-1!=n&&(n=n<0?0:n>1?1:n,paella.player.videoContainer.setVolume(n).then(function(e){}))})})},updateClass:function(){var e=this,t="";paella.player.videoContainer.mainAudioPlayer().volume().then(function(n){t=void 0===n?"icon-volume-mid":0==n?"icon-volume-mute":n<.33?"icon-volume-low":n<.66?"icon-volume-mid":"icon-volume-high",e.changeIconClass(t)})}},{},e)}(paella.ButtonPlugin)}),Class("paella.videoFactories.WebmVideoFactory",{webmCapable:function(){var e=document.createElement("video");return!!e.canPlayType&&""!==e.canPlayType('video/webm; codecs="vp8, vorbis"')},isStreamCompatible:function(e){try{if(!this.webmCapable())return!1;for(var t in e.sources)if("webm"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return new paella.Html5Video(e,t,n.x,n.y,n.w,n.h,"webm")}}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"es.upv.paella.windowTitlePlugin"},checkEnabled:function(e){var t=this;this._initDone=!1,paella.player.videoContainer.masterVideo().duration().then(function(e){t.loadTitle()}),e(!0)},loadTitle:function(){var e=paella.player.videoLoader.getMetadata()&&paella.player.videoLoader.getMetadata().title;document.title=e||document.title,this._initDone=!0}},{},e)}(paella.EventDrivenPlugin)}),Class("paella.YoutubeVideo",paella.VideoElementBase,{_posterFrame:null,_currentQuality:null,_autoplay:!1,_readyPromise:null,initialize:function(e,t,n,a,i,r){this.parent(e,t,"div",n,a,i,r);var o=this;this._readyPromise=$.Deferred(),Object.defineProperty(this,"video",{get:function(){return o._youtubePlayer}})},_deferredAction:function(e){var t=this;return new Promise(function(n,a){t._readyPromise.then(function(){n(e())},function(){a()})})},_getQualityObject:function(e,t){var n=0;switch(t){case"small":n=1;break;case"medium":n=2;break;case"large":n=3;break;case"hd720":n=4;break;case"hd1080":n=5;break;case"highres":n=6}return{index:e,res:{w:null,h:null},src:null,label:t,level:n,bitrate:n,toString:function(){return this.label},shortLabel:function(){return this.label},compare:function(e){return this.level-e.level}}},_onStateChanged:function(e){console.log("On state changed")},getVideoData:function(){var e=this,t=this;return new Promise(function(n,a){var i=e._stream.sources.youtube[0];e._deferredAction(function(){var e={duration:t.video.getDuration(),currentTime:t.video.getCurrentTime(),volume:t.video.getVolume(),paused:!t._playing,ended:t.video.ended,res:{w:i.res.w,h:i.res.h}};n(e)})})},setPosterFrame:function(e){this._posterFrame=e},setAutoplay:function(e){this._autoplay=e},setRect:function(e,t){this._rect=JSON.parse(JSON.stringify(e));var n=new paella.RelativeVideoSize,a={top:n.percentVSize(e.top)+"%",left:n.percentWSize(e.left)+"%",width:n.percentWSize(e.width)+"%",height:n.percentVSize(e.height)+"%",position:"absolute"};if(t){this.disableClassName();var i=this;$("#"+this.identifier).animate(a,400,function(){i.enableClassName(),paella.events.trigger(paella.events.setComposition,{video:i})}),this.enableClassNameAfter(400)}else $("#"+this.identifier).css(a),paella.events.trigger(paella.events.setComposition,{video:this})},setVisible:function(e,t){"true"==e&&t?($("#"+this.identifier).show(),$("#"+this.identifier).animate({opacity:1},300)):"true"!=e||t?"false"==e&&t?$("#"+this.identifier).animate({opacity:0},300):"false"!=e||t||$("#"+this.identifier).hide():$("#"+this.identifier).show()},setLayer:function(e){$("#"+this.identifier).css({zIndex:e})},load:function(){var e=this,t=this;return new Promise(function(n,a){e._qualityListReadyPromise=$.Deferred(),paella.youtubePlayerVars.apiReadyPromise.then(function(){var i=e._stream.sources.youtube[0];i?(e._youtubePlayer=new YT.Player(t.identifier,{height:"390",width:"640",videoId:i.id,playerVars:{controls:0,disablekb:1},events:{onReady:function(e){t._readyPromise.resolve()},onStateChanged:function(e){console.log("state changed")},onPlayerStateChange:function(e){console.log("state changed")}}}),n()):a(new Error("Could not load video: invalid quality stream index"))})})},getQualities:function(){var e=this;return new Promise(function(t,n){e._qualityListReadyPromise.then(function(n){var a=[],i=-1;e._qualities={},n.forEach(function(t){i++,e._qualities[t]=e._getQualityObject(i,t),a.push(e._qualities[t])}),t(a)})})},setQuality:function(e){var t=this;return new Promise(function(n,a){t._qualityListReadyPromise.then(function(a){for(var i in t._qualities){var r=t._qualities[i];if("object"==$traceurRuntime.typeof(r)&&r.index==e){t.video.setPlaybackQuality(r.label);break}}n()})})},getCurrentQuality:function(){var e=this;return new Promise(function(t,n){e._qualityListReadyPromise.then(function(n){t(e._qualities[e.video.getPlaybackQuality()])})})},play:function(){var e=this,t=this;return new Promise(function(n,a){t._playing=!0,t.video.playVideo(),new base.Timer(function(t){var a=e.video.getAvailableQualityLevels();a.length?(t.repeat=!1,e._qualityListReadyPromise.resolve(a),n()):t.repeat=!0},500)})},pause:function(){var e=this;return this._deferredAction(function(){e._playing=!1,e.video.pauseVideo()})},isPaused:function(){var e=this;return this._deferredAction(function(){return!e._playing})},duration:function(){var e=this;return this._deferredAction(function(){return e.video.getDuration()})},setCurrentTime:function(e){var t=this;return this._deferredAction(function(){t.video.seekTo(e)})},currentTime:function(){var e=this;return this._deferredAction(function(){return e.video.getCurrentTime()})},setVolume:function(e){var t=this;return this._deferredAction(function(){t.video.setVolume&&t.video.setVolume(100*e)})},volume:function(){var e=this;return this._deferredAction(function(){return e.video.getVolume()/100})},setPlaybackRate:function(e){var t=this;return this._deferredAction(function(){t.video.playbackRate=e})},playbackRate:function(){var e=this;return this._deferredAction(function(){return e.video.playbackRate})},goFullScreen:function(){var e=this;return this._deferredAction(function(){var t=e.video;t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitEnterFullscreen&&t.webkitEnterFullscreen()})},unFreeze:function(){var e=this;return this._deferredAction(function(){var t=document.getElementById(e.video.className+"canvas");$(t).remove()})},freeze:function(){var e=this;return this._deferredAction(function(){var t=document.createElement("canvas");t.id=e.video.className+"canvas",t.width=e.video.videoWidth,t.height=e.video.videoHeight,t.style.cssText=e.video.style.cssText,t.style.zIndex=2,t.getContext("2d").drawImage(e.video,0,0,16*Math.ceil(t.width/16),16*Math.ceil(t.height/16)),e.video.parentElement.appendChild(t)})},unload:function(){return this._callUnloadEvent(),paella_DeferredNotImplemented()},getDimensions:function(){return paella_DeferredNotImplemented()}}),Class("paella.videoFactories.YoutubeVideoFactory",{initYoutubeApi:function(){if(!this._initialized){var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),paella.youtubePlayerVars={apiReadyPromise:new $.Deferred},this._initialized=!0}},isStreamCompatible:function(e){try{for(var t in e.sources)if("youtube"==t)return!0}catch(e){}return!1},getVideoObject:function(e,t,n){return this.initYoutubeApi(),new paella.YoutubeVideo(e,t,n.x,n.y,n.w,n.h)}}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getIndex:function(){return 20},getAlignment:function(){return"right"},getSubclass:function(){return"zoomButton"},getDefaultToolTip:function(){return base.dictionary.translate("Zoom")},getEvents:function(){return[paella.events.timeUpdate,paella.events.setComposition,paella.events.loadPlugins,paella.events.play]},onEvent:function(e,t){switch(e){case paella.events.timeUpdate:this.imageUpdate(e,t);break;case paella.events.setComposition:this.compositionChanged(e,t);break;case paella.events.loadPlugins:this.loadPlugin(e,t);break;case paella.events.play:this.exitPhotoMode()}},checkEnabled:function(e){if(paella.player.videoContainer.sourceData.length<2)return this._zImages=null,this._imageNumber=null,this._isActivated=!1,this._isCreated=!1,this._keys=null,this._ant=null,this._next=null,this._videoLength=null,this._compChanged=!1,this._restartPlugin=!1,this._actualImage=null,this._zoomIncr=null,this._maxZoom=null,this._minZoom=null,this._dragMode=!1,this._mouseDownPosition=null,void e(!1);paella.player.videoContainer.sourceData[0].sources.hasOwnProperty("image")?e(!0):e(!1)},setupIcons:function(){var e=this,t=$(".zoomFrame").width(),n=document.createElement("div");n.className="arrowsLeft",n.style.display="none";var a=document.createElement("div");a.className="arrowsRight",a.style.display="none",a.style.left=t-24+"px",$(n).click(function(){e.arrowCallLeft(),event.stopPropagation()}),$(a).click(function(){e.arrowCallRight(),event.stopPropagation()});var i=document.createElement("div");i.className="iconsFrame";var r=document.createElement("button");r.className="zoomActionButton buttonZoomIn",r.style.display="none";var o=document.createElement("button");o.className="zoomActionButton buttonZoomOut",o.style.display="none";var s=document.createElement("button");s.className="zoomActionButton buttonSnapshot",s.style.display="none";var l=document.createElement("button");l.className="zoomActionButton buttonZoomOn",$(i).append(l),$(i).append(s),$(i).append(r),$(i).append(o),$(".newframe").append(i),$(".newframe").append(n),$(".newframe").append(a),$(l).click(function(){e._isActivated?(e.exitPhotoMode(),$(".zoomActionButton.buttonZoomOn").removeClass("clicked")):(e.enterPhotoMode(),$(".zoomActionButton.buttonZoomOn").addClass("clicked")),event.stopPropagation()}),$(s).click(function(){null!=e._actualImage&&window.open(e._actualImage,"_blank"),event.stopPropagation()}),$(r).click(function(){e.zoomIn(),event.stopPropagation()}),$(o).click(function(){e.zoomOut(),event.stopPropagation()})},enterPhotoMode:function(){$(".zoomFrame").show(),$(".zoomFrame").css("opacity","1"),this._isActivated=!0,$(".buttonSnapshot").show(),$(".buttonZoomOut").show(),$(".buttonZoomIn").show(),$(".arrowsRight").show(),$(".arrowsLeft").show(),paella.player.pause(),this._imageNumber<=1?$(".arrowsLeft").hide():this._isActivated&&$(".arrowsLeft").show(),this._imageNumber>=this._keys.length-2?$(".arrowsRight").hide():this._isActivated&&$(".arrowsRight").show()},exitPhotoMode:function(){$(".zoomFrame").hide(),this._isActivated=!1,$(".buttonSnapshot").hide(),$(".buttonZoomOut").hide(),$(".buttonZoomIn").hide(),$(".arrowsRight").hide(),$(".arrowsLeft").hide(),$(".zoomActionButton.buttonZoomOn").removeClass("clicked")},setup:function(){this._maxZoom=this.config.maxZoom||500,this._minZoom=this.config.minZoom||100,this._zoomIncr=this.config.zoomIncr||10,this._zImages={},this._zImages=paella.player.videoContainer.sourceData[0].sources.image[0].frames,this._videoLength=paella.player.videoContainer.sourceData[0].sources.image[0].duration,this._keys=Object.keys(this._zImages),this._keys=this._keys.sort(function(e,t){return e=e.slice(6),t=t.slice(6),parseInt(e)-parseInt(t)}),this._next=0,this._ant=0},loadPlugin:function(){0==this._isCreated&&(this.createOverlay(),this.setupIcons(),$(".zoomFrame").hide(),this._isActivated=!1,this._isCreated=!0)},imageUpdate:function(e,t){var n=Math.round(t.currentTime),a=$(".zoomFrame").css("background-image");if($(".newframe").length>0){if(this._zImages.hasOwnProperty("frame_"+n)){if(a==this._zImages["frame_"+n])return;a=this._zImages["frame_"+n]}else{if(!(n>this._next||n=this._keys.length-2?$(".arrowsRight").hide():this._isActivated&&$(".arrowsRight").show()}},returnSrc:function(e){var t=0;for(i=0;ia&&e=0){var e=this._keys[this._imageNumber-1];this._imageNumber-=1,paella.player.videoContainer.seekToTime(parseInt(e.slice(6)))}},arrowCallRight:function(){if(this._imageNumber+1<=this._keys.length){var e=this._keys[this._imageNumber+1];this._imageNumber+=1,paella.player.videoContainer.seekToTime(parseInt(e.slice(6)))}},createOverlay:function(){var e=this,t=document.createElement("div");t.className="newframe",overlayContainer=paella.player.videoContainer.overlayContainer,overlayContainer.addElement(t,overlayContainer.getMasterRect());var n=document.createElement("div");n.className="zoomFrame",t.insertBefore(n,t.firstChild),$(n).click(function(e){e.stopPropagation()}),$(n).bind("mousewheel",function(t){t.originalEvent.wheelDelta/120>0?e.zoomIn():e.zoomOut()}),$(n).mousedown(function(t){e.mouseDown(t.clientX,t.clientY)}),$(n).mouseup(function(t){e.mouseUp()}),$(n).mouseleave(function(t){e.mouseLeave()}),$(n).mousemove(function(t){e.mouseMove(t.clientX,t.clientY)})},mouseDown:function(e,t){this._dragMode=!0,this._mouseDownPosition={x:e,y:t}},mouseUp:function(){this._dragMode=!1},mouseLeave:function(){this._dragMode=!1},mouseMove:function(e,t){if(this._dragMode){$(".zoomFrame")[0];var n=this._backgroundPosition?this._backgroundPosition:{left:0,top:0},a=($(".zoomFrame").width(),$(".zoomFrame").height(),this._mouseDownPosition.x-e),i=this._mouseDownPosition.y-t,r=n.left+a,o=n.top+i;r=(r=r>=0?r:0)<=100?r:100,o=(o=o>=0?o:0)<=100?o:100,$(".zoomFrame").css("background-position",r+"% "+o+"%"),this._backgroundPosition={left:r,top:o},this._mouseDownPosition.x=e,this._mouseDownPosition.y=t}},zoomIn:function(){var e=$(".zoomFrame").css("background-size");e=e.split(" "),(e=parseInt(e[0]))this._minZoom&&$(".zoomFrame").css("background-size",e-this._zoomIncr+"% auto")},imageUpdateOnPause:function(e){var t=Math.round(e),n=$(".zoomFrame").css("background-image");if($(".newframe").length>0&&n!=this._actualImage){if(this._zImages.hasOwnProperty("frame_"+t)){if(n==this._zImages["frame_"+t])return;n=this._zImages["frame_"+t]}else this._compChanged=!1,n=this.returnSrc(t);$("#photo_01").attr("src",n).load();var a=new Image;a.onload=function(){$(".zoomFrame").css("background-image","url("+n+")")},a.src=n,this._actualImage=n}},compositionChanged:function(e,t){var n=this;$(".newframe").remove(),this._isCreated=!1,paella.player.videoContainer.getMasterVideoRect().visible&&(this.loadPlugin(),paella.player.paused()&&paella.player.videoContainer.currentTime().then(function(e){n.imageUpdateOnPause(e)})),this._compChanged=!0},getName:function(){return"es.upv.paella.zoomPlugin"}},{},e)}(paella.EventDrivenPlugin)}),paella.addPlugin(function(){return function(e){return $traceurRuntime.createClass(function e(){$traceurRuntime.superConstructor(e).apply(this,arguments)},{getName:function(){return"org.opencast.usertracking.MatomoSaverPlugIn"},checkEnabled:function(e){var t=this.config.site_id,n=this.config.server,a=this.config.heartbeat,i=this;n&&t?("/"!=n.substr(-1)&&(n+="/"),require([n+"piwik.js"],function(e){base.log.debug("Matomo Analytics Enabled"),paella.userTracking.matomotracker=Piwik.getAsyncTracker(n+"piwik.php",t),paella.userTracking.matomotracker.client_id=i.config.client_id,a&&a>0&&paella.userTracking.matomotracker.enableHeartBeatTimer(a),Piwik&&Piwik.MediaAnalytics&&Piwik.MediaAnalytics.scanForMedia(),i.registerVisit()}),e(!0)):(base.log.debug("No Matomo Site ID found in config file. Disabling Matomo Analytics PlugIn"),e(!1))},registerVisit:function(){var e,t,n,a,i;paella.opencast&&paella.opencast._episode?(e=paella.opencast._episode.dcTitle,t=paella.opencast._episode.id,i=paella.opencast._episode.dcCreator,paella.userTracking.matomotracker.setCustomVariable(5,"client",paella.userTracking.matomotracker.client_id||"Paella Opencast")):paella.userTracking.matomotracker.setCustomVariable(5,"client",paella.userTracking.matomotracker.client_id||"Paella Standalone"),paella.opencast&&paella.opencast._episode&&paella.opencast._episode.mediapackage&&(a=paella.opencast._episode.mediapackage.series,n=paella.opencast._episode.mediapackage.seriestitle),e&&paella.userTracking.matomotracker.setCustomVariable(1,"event",e+" ("+t+")","page"),n&&paella.userTracking.matomotracker.setCustomVariable(2,"series",n+" ("+a+")","page"),i&&paella.userTracking.matomotracker.setCustomVariable(3,"presenter",i,"page"),paella.userTracking.matomotracker.setCustomVariable(4,"view_mode",void 0,"page"),e&&i?(paella.userTracking.matomotracker.setDocumentTitle(e+" - "+(i||"Unknown")),paella.userTracking.matomotracker.trackPageView(e+" - "+(i||"Unknown"))):paella.userTracking.matomotracker.trackPageView()},log:function(e,t){if(void 0!==paella.userTracking.matomotracker){if(void 0===this.config.category||!0===this.config.category){var n="";try{n=JSON.stringify(t)}catch(e){}switch(e){case paella.events.play:paella.userTracking.matomotracker.trackEvent("Player.Controls","Play");break;case paella.events.pause:paella.userTracking.matomotracker.trackEvent("Player.Controls","Pause");break;case paella.events.endVideo:paella.userTracking.matomotracker.trackEvent("Player.Status","Ended");break;case paella.events.showEditor:paella.userTracking.matomotracker.trackEvent("Player.Editor","Show");break;case paella.events.hideEditor:paella.userTracking.matomotracker.trackEvent("Player.Editor","Hide");break;case paella.events.enterFullscreen:paella.userTracking.matomotracker.trackEvent("Player.View","Fullscreen");break;case paella.events.exitFullscreen:paella.userTracking.matomotracker.trackEvent("Player.View","ExitFullscreen");break;case paella.events.loadComplete:paella.userTracking.matomotracker.trackEvent("Player.Status","LoadComplete");break;case paella.events.showPopUp:paella.userTracking.matomotracker.trackEvent("Player.PopUp","Show",n);break;case paella.events.hidePopUp:paella.userTracking.matomotracker.trackEvent("Player.PopUp","Hide",n);break;case paella.events.captionsEnabled:paella.userTracking.matomotracker.trackEvent("Player.Captions","Enabled",n);break;case paella.events.captionsDisabled:paella.userTracking.matomotracker.trackEvent("Player.Captions","Disabled",n);break;case paella.events.setProfile:paella.userTracking.matomotracker.trackEvent("Player.View","Profile",n);break;case paella.events.seekTo:case paella.events.seekToTime:paella.userTracking.matomotracker.trackEvent("Player.Controls","Seek",n);break;case paella.events.setVolume:paella.userTracking.matomotracker.trackEvent("Player.Settings","Volume",n);break;case paella.events.resize:paella.userTracking.matomotracker.trackEvent("Player.View","resize",n);break;case paella.events.setPlaybackRate:paella.userTracking.matomotracker.trackEvent("Player.Controls","PlaybackRate",n)}}}else base.log.debug("Matomo Tracker is missing")}},{},e)}(paella.userTracking.SaverPlugIn)}); \ No newline at end of file diff --git a/lang/ilias_de.lang b/lang/ilias_de.lang index 3cff15f9f..01f0d00a3 100644 --- a/lang/ilias_de.lang +++ b/lang/ilias_de.lang @@ -13,6 +13,9 @@ config_curl#:#cURL config_curl_debug_level#:#Debug-Level config_curl_password#:#API-Passwort config_curl_username#:#API-Benutzername +config_streaming#:#Streaming +config_streaming_url#:#Wowza URL +config_use_streaming#:#Benutze Streaming URLs config_editor_link#:#Link zum OpenCast-Video-Editor config_editor_link_info#:#Als Platzhalter kann {event_id} verwendet werden. Bsp: https://myopencast.com/external-url/events/{event_id}/editor config_eula#:#Nutzungsvereinbarung @@ -61,6 +64,8 @@ config_audio_allowed_info#:#Wenn aktiviert, können neben Video-Dateien auch Aud config_curl_username_info#:#Benutzeraccount in OpenCast, der zur Kommunikation über die API genutzt wird (benötigt genügend Rechte in OC) config_curl_password_info#:#Passwort zum oben angegebenen Account. config_curl_debug_level_info#:#Detaillierungsgrad der Einträge im Log. +config_streaming_url_info#:#Wowza URL für adaptive streaming. Bsp: https://wowza.myopencast.com:8090/opencast-engage +config_use_streaming_info#:#Wenn aktive werden die MP4 Streams aus der API durch passende Streaming URLs ersetzt config_activate_cache_info#:#Verbessert die Ladezeiten der Videolisten durch lokales Speichern. Kann vorübergehend zu falschen (nicht aktuellen) Metadaten führen. config_use_modals_info#:#Wenn aktiviert: Beim Abspielen von Videos wird kein neues Browserfenster geöffnet, sondern der Player wird im aktuellen Fenster angezeigt. config_workflow_info#:#ID des workflows, welcher nach dem Hochladen eines Videos in OpenCast angewendet wird. diff --git a/lang/ilias_en.lang b/lang/ilias_en.lang index 7c8c169c9..0e75e28b0 100644 --- a/lang/ilias_en.lang +++ b/lang/ilias_en.lang @@ -13,6 +13,9 @@ config_curl#:#cURL config_curl_debug_level#:#Debug-Level config_curl_password#:#API-Password config_curl_username#:#API-Username +config_streaming#:#Streaming +config_streaming_url#:#Wowza URL +config_use_streaming#:#Benutze Streaming URLs config_editor_link#:#Link to OpenCast Video Editor config_editor_link_info#:#The placeholder {event_id} can be used. E.g.: https://myopencast.com/external-url/events/{event_id}/editor config_eula#:#EULA @@ -61,6 +64,8 @@ config_audio_allowed_info#:#Allows the upload of audio files. config_curl_username_info#:#User account in OpenCast which will be used to communicate over the API (needs enough permissions in OC). config_curl_password_info#:#Password for above account. config_curl_debug_level_info#:#Level of detail for log entries. +config_streaming_url_info#:#Wowza URL for adaptive streaming. E.g.: https://wowza.myopencast.com:8090/opencast-engage +config_use_streaming_info#:#If active all mp4 files will be replaced by streaming urls config_activate_cache_info#:#Improves the loading time for event lists by storing events locally. Can lead to temporarily corrupt metadata. config_use_modals_info#:#When active: the video player will not be opened in a seperate window but in a overlaying "Modal" window. config_workflow_info#:#ID of the workflow which will be executed in OpenCast after uploading an event.