var PLAYER=PLAYER||{};
PLAYER.Playlist=function(b,f,c,g,e,p,q,d,r,t,u,l,v,w,x,y){function z(c){a.vimeoStatus.text("paused")}function A(b){a.vimeoStatus.text("finished");a.videoAdPlayed=!1;a.VIDEO.gaVideoEnded();"Right playlist"==c.playlist||"Bottom playlist"==c.playlist||"Off"==c.playlist?(a.videoid=parseInt(a.videoid)+1,a.videos_array.length==a.videoid&&(a.videoid=0),"Play next video"==c.onFinish?(a.VIDEO.shuffleBtnEnabled&&(a.VIDEO.generateRandomNumber(),a.videoid=a.VIDEO.rand),a.VIDEO.setPlaylistItem(a.videoid),a.VIDEO.playVideoById(a.videoid)):
"Restart video"==c.onFinish?a.vimeoPlayer.api("play"):"Stop video"==c.onFinish&&""!=c.posterImgOnVideoFinish&&a.VIDEO.showPoster2()):"Restart video"==c.onFinish&&a.vimeoPlayer.api("play")}function B(b,e){a.vimeo_time=Math.floor(b.seconds);a.vimeo_duration=Math.floor(b.duration);a.vimeoStatus.text(b.seconds+"s played");0==a.vimeo_time&&"yes"==a.videos_array[a.videoid].prerollAD&&(a.VIDEO.videoAdStarted=!0,a.videoAdPlayed?a.vimeoPlayer.api("play"):(a.vimeoPlayer.api("pause"),d.canPlayType&&d.canPlayType("video/mp4").replace(/no/,
"")&&(this.canPlay=!0,a.video_pathAD=a.videos_array[a.videoid].preroll_mp4),a.VIDEO.loadAD(a.video_pathAD,"prerollActive"),a.VIDEO.openAD()));a.tim=setInterval(function(){if("HTML5"!=c.videos[a.videoid].videoType&&"HTML5 (self-hosted)"!=c.videoType){if(a.VIDEO.secondsFormat(a.vimeo_time)==a.videos_array[a.videoid].midrollAD_displayTime){if(a.VIDEO.midrollPlayed)return;a.VIDEO.midrollPlayed=!0;"yes"==a.videos_array[a.videoid].midrollAD&&(d.canPlayType&&d.canPlayType("video/mp4").replace(/no/,"")&&
(a.canPlay=!0,a.video_pathAD=a.videos_array[a.videoid].midroll_mp4),a.vimeoPlayer.api("pause"),a.VIDEO.loadAD(a.video_pathAD,"midrollActive"),a.VIDEO.openAD())}a.VIDEO.secondsFormat(a.vimeo_time)>=a.VIDEO.secondsFormat(a.vimeo_duration-1)&&0<a.vimeo_duration&&!a.VIDEO.postrollPlayed&&(a.VIDEO.postrollPlayed=!0,"yes"==a.videos_array[a.videoid].postrollAD&&(d.canPlayType&&d.canPlayType("video/mp4").replace(/no/,"")&&(a.canPlay=!0,a.video_pathAD=a.videos_array[a.videoid].postroll_mp4),a.vimeoPlayer.api("pause"),
a.VIDEO.loadAD(a.video_pathAD,"postrollActive"),a.VIDEO.openAD()))}},50);"yes"==a.videos_array[a.videoid].popupAdShow&&a.VIDEO.enablePopup()}function C(c){a.VIDEO.hideMutedBox()}function h(){a.vimeoIframe=b(a.vimeoWrapper).find("#"+a.options.instanceName);a.vimeoPlayer=$f(a.vimeoIframe[0]);a.vimeoStatus=b(".status");a.vimeoPlayer.addEvent("ready",function(){a.vimeoPlayer.addEvent("pause",z);a.vimeoPlayer.addEvent("finish",A);a.vimeoPlayer.addEvent("playProgress",B);a.vimeoPlayer.addEvent("volumechange",
C);l&&"AD 5 sec + Pieces After Effects project"!=a.options.videos[0].title&&"Pieces After Effects project"!=a.options.videos[0].title&&"AD 5 sec + Space Odyssey After Effects Project"!=a.options.videos[0].title&&"AD 5 sec Swimwear Spring Summer"!=a.options.videos[0].title&&"i Create"!=a.options.videos[0].title&&"Swimwear Spring Summer"!=a.options.videos[0].title&&"PLuFX50GllfgP_mecAi4LV7cYva-WLVnaM"!=a.options.youtubePlaylistID&&"Google drive video example"!=a.options.videos[0].title&&"Dropbox video example"!=
a.options.videos[0].title&&"Livestream HLS m3u8 video example"!=a.options.videos[0].title&&"Openload video example"!=a.options.videos[0].title&&"Youtube 360 VR video"!=a.options.videos[0].title&&"Subtitles video example"!=a.options.videos[0].title&&(a.VIDEO.pw(),a.vimeoWrapper.css({zIndex:0}),b("iframe#"+a.options.instanceName).attr("src",""))})}var a=this;this.VIDEO=f;this.element=e;this.youtube_array=x;if(""!=c.youtubePlaylistID||""!=c.youtubeChannelID)c.videos=a.youtube_array;this.canPlay=r;this.CLICK_EV=
t;this.params=u;this.isMobile=y;this.preloader=p;this.preloaderAD=q;this.options=c;this.mainContainer=g;this.videoid="VIDEOID";this.adStartTime="ADSTARTTIME";this.videoAdPlayed=!1;this.rand=Math.floor(Math.random()*c.videos.length);this.ytQuality=c.youtubeQuality;this.youtubeSTARTED=!1;this.deviceAgent=v;this.agentID=w;this.YTAPI_onPlayerReady=!1;this.vimeo_time;this.vimeo_duration;this.touchmove=this.scrollingIsOn=!1;this.playlist=b("<div />");this.playlistContent=b("<div />");this.playlistContentOverlay=
b("<div />").addClass("elite_vp_playlistContentOverlay").hide();this.playlistBar=b("<div />");this.playlistBar.addClass("elite_vp_bg elite_vp_elite_vp_"+this.options.instanceTheme);this.playlist.append(this.playlistBar);this.playlist.append(this.playlistContentOverlay);this.playlistBarInside=b("<div />");this.playlistBarInside.addClass("elite_vp_playlistBarInside");this.playlistBar.append(this.playlistBarInside);this.lastBtnIcon=b("<span />").attr("aria-hidden","true").addClass("fa-elite").addClass("elite-icon-general").addClass("elite_vp_controlsColor elite_vp_"+
this.options.instanceTheme).addClass("fa-elite-step-forward").attr("id","elite_vp_lastBtn");this.firstBtnIcon=b("<span />").attr("aria-hidden","true").addClass("fa-elite").addClass("elite-icon-general").addClass("elite_vp_controlsColor elite_vp_"+this.options.instanceTheme).addClass("fa-elite-step-backward").attr("id","elite_vp_firstBtn");this.nextBtnIcon=b("<span />").attr("aria-hidden","true").addClass("fa-elite").addClass("elite-icon-general").addClass("elite_vp_controlsColor elite_vp_"+this.options.instanceTheme).addClass("fa-elite-forward").attr("id",
"elite_vp_nextBtn");this.previousBtnIcon=b("<span />").attr("aria-hidden","true").addClass("fa-elite").addClass("elite-icon-general").addClass("elite_vp_controlsColor elite_vp_"+this.options.instanceTheme).addClass("fa-elite-backward").attr("id","elite_vp_previousBtn");this.shuffleBtnIcon=b("<span />").attr("aria-hidden","true").attr("id","elite_vp_shuffleBtn").addClass("fa-elite").addClass("elite-icon-general").addClass("elite_vp_controlsColor elite_vp_"+this.options.instanceTheme).addClass("fa-elite-random").addClass("elite_vp_playerElement");
this.lastBtn=b("<div />").addClass("elite_vp_playlistBarBtn").addClass("elite_vp_playerElement");this.lastBtn.append(this.lastBtnIcon);this.firstBtn=b("<div />").addClass("elite_vp_playlistBarBtn").addClass("elite_vp_playerElement");this.firstBtn.append(this.firstBtnIcon);this.nextBtn=b("<div />").addClass("elite_vp_playlistBarBtn").addClass("elite_vp_playerElement");this.nextBtn.append(this.nextBtnIcon);this.previousBtn=b("<div />").addClass("elite_vp_playlistBarBtn").addClass("elite_vp_playerElement");
this.previousBtn.append(this.previousBtnIcon);this.shuffleBtn=b("<div />").addClass("elite_vp_playlistBarBtn").addClass("elite_vp_playerElement");this.shuffleBtn.append(this.shuffleBtnIcon);this.playlistBarInside.append(this.firstBtn);this.playlistBarInside.append(this.previousBtn);this.playlistBarInside.append(this.shuffleBtn);this.playlistBarInside.append(this.nextBtn);this.playlistBarInside.append(this.lastBtn);switch(this.options.playlist){case "Right playlist":this.playlist.attr("id","elite_vp_playlist");
this.playlist.addClass("elite_vp_playlist elite_vp_"+this.options.instanceTheme);this.playlistContent.attr("id",a.options.instanceName+"elite_vp_playlistContent");this.playlistBar.addClass("elite_vp_playlistBar");break;case "Bottom playlist":this.playlist.attr("id","elite_vp_playlist_bottom"),this.playlist.addClass("elite_vp_playlist elite_vp_"+this.options.instanceTheme),this.playlistContent.attr("id",a.options.instanceName+"elite_vp_playlistContent_bottom"),this.playlistBar.addClass("elite_vp_playlistBar_bottom")}a.videos_array=
[];a.item_array=[];this.vimeoWrapper=b("<div></div>");this.vimeoWrapper.attr("id","elite_vp_vimeoWrapper");a.element&&a.element.append(a.vimeoWrapper);b(this.vimeoWrapper).html('<iframe id="'+a.options.instanceName+'" src="" width="100%" height="100%" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>');var m=0;this.onPlayerReady=function(b){a.YTAPI_onPlayerReady=!0;if("youtube"==c.videos[0].videoType||"YouTube"==c.videoType)a.VIDEO.playButtonScreen.hide(),b=window.navigator.userAgent,
b.indexOf("MSIE "),b.indexOf("Trident/"),"Yes"==c.loadRandomVideoOnStart?a.VIDEO.youtubePlayer.cueVideoById(a.videos_array[a.rand].youtubeID):a.VIDEO.youtubePlayer.cueVideoById(a.videos_array[a.videoid].youtubeID),a.VIDEO.youtubePlayer.setPlaybackQuality(a.ytQuality),c.autoplay&&(a.isMobile.any()||a.VIDEO.getViewportStatus()&&a.VIDEO.youtubePlayer.playVideo()),a.VIDEO.resizeAll(),l&&"AD 5 sec + Pieces After Effects project"!=a.options.videos[0].title&&"Pieces After Effects project"!=a.options.videos[0].title&&
"AD 5 sec + Space Odyssey After Effects Project"!=a.options.videos[0].title&&"AD 5 sec Swimwear Spring Summer"!=a.options.videos[0].title&&"i Create"!=a.options.videos[0].title&&"Swimwear Spring Summer"!=a.options.videos[0].title&&"PLuFX50GllfgP_mecAi4LV7cYva-WLVnaM"!=a.options.youtubePlaylistID&&"Google drive video example"!=a.options.videos[0].title&&"Dropbox video example"!=a.options.videos[0].title&&"Livestream HLS m3u8 video example"!=a.options.videos[0].title&&"Openload video example"!=a.options.videos[0].title&&
"Youtube 360 VR video"!=a.options.videos[0].title&&"Subtitles video example"!=a.options.videos[0].title&&(a.VIDEO.pw(),void 0!=a.VIDEO.youtubePlayer&&(a.VIDEO.youtubePlayer.stopVideo(),a.VIDEO.youtubePlayer.clearVideo(),a.VIDEO.youtubePlayer.setSize(1,1))),a.popupTimer=setInterval(function(){"yes"==a.videos_array[a.videoid].popupAdShow&&a.VIDEO.enablePopup()},1E3)};this.onPlayerStateChange=function(b){var n=Math.floor(a.VIDEO.youtubePlayer.getCurrentTime());a.VIDEO.calculateYoutubeTotalTime(a.VIDEO.youtubePlayer.getDuration());
1===b.data&&0==n&&(a.youtubeSTARTED=!0);1===b.data?(a.isMobile.any()&&a.VIDEO.playButtonScreen.addClass("elite_vp_playButtonScreenHide"),e.removeClass("vp_paused"),e.addClass("elite_vp_playing"),f.change("elite_vp_playing"),a.VIDEO.play(),a._timer=setInterval(function(){if("HTML5"!=c.videos[a.videoid].videoType&&"HTML5 (self-hosted)"!=c.videoType){a.progressWidth=a.VIDEO.youtubePlayer.getCurrentTime()/a.VIDEO.youtubePlayer.getDuration()*a.VIDEO.videoTrack.width();a.VIDEO.videoTrackProgress.css("width",
a.progressWidth);a.progressIdleWidth=a.VIDEO.youtubePlayer.getCurrentTime()/a.VIDEO.youtubePlayer.getDuration()*a.VIDEO.progressIdleTrack.width();a.VIDEO.progressIdle.css("width",a.progressIdleWidth);a.VIDEO.calculateYoutubeElapsedTime(a.VIDEO.youtubePlayer.getCurrentTime());a.buffered=a.VIDEO.youtubePlayer.getVideoLoadedFraction();a.downloadWidth=a.buffered*a.VIDEO.videoTrack.width();a.VIDEO.videoTrackDownload.css("width",a.downloadWidth);a.progressIdleDownloadWidth=a.buffered*a.VIDEO.progressIdleTrack.width();
a.VIDEO.progressIdleDownload.css("width",a.progressIdleDownloadWidth);if(a.VIDEO.secondsFormat(a.VIDEO.youtubePlayer.getCurrentTime())==a.videos_array[a.videoid].midrollAD_displayTime){if(a.VIDEO.midrollPlayed)return;a.VIDEO.midrollPlayed=!0;"yes"==a.videos_array[a.videoid].midrollAD&&(d.canPlayType&&d.canPlayType("video/mp4").replace(/no/,"")&&(a.canPlay=!0,a.video_pathAD=a.videos_array[a.videoid].midroll_mp4),a.VIDEO.youtubePlayer.pauseVideo(),a.VIDEO.loadAD(a.video_pathAD,"midrollActive"),a.VIDEO.openAD())}a.VIDEO.secondsFormat(a.VIDEO.youtubePlayer.getCurrentTime())>=
a.VIDEO.secondsFormat(a.VIDEO.youtubePlayer.getDuration()-1)&&0<a.VIDEO.youtubePlayer.getDuration()&&!a.VIDEO.postrollPlayed&&(a.VIDEO.postrollPlayed=!0,"yes"==a.videos_array[a.videoid].postrollAD&&(d.canPlayType&&d.canPlayType("video/mp4").replace(/no/,"")&&(a.canPlay=!0,a.video_pathAD=a.videos_array[a.videoid].postroll_mp4),a.VIDEO.youtubePlayer.pauseVideo(),a.VIDEO.loadAD(a.video_pathAD,"postrollActive"),a.VIDEO.openAD()))}},50)):2===b.data?(clearInterval(a._timer),e.addClass("vp_paused"),e.removeClass("elite_vp_playing"),
f.change("vp_paused"),a.VIDEO.pause()):0===b.data?(a.VIDEO.gaVideoEnded(),a.VIDEO.midrollPlayed=!1,a.VIDEO.postrollPlayed=!1,a.videoAdPlayed=!1,a.videoid=parseInt(a.videoid)+1,a.videos_array.length==a.videoid&&(a.videoid=0),"Play next video"==c.onFinish?(a.VIDEO.shuffleBtnEnabled&&(a.VIDEO.generateRandomNumber(),a.videoid=a.VIDEO.rand),a.VIDEO.setPlaylistItem(a.videoid),a.VIDEO.playVideoById(a.videoid)):"Restart video"==c.onFinish?void 0!=a.VIDEO.youtubePlayer&&(a.VIDEO.youtubePlayer.seekTo(0),a.VIDEO.youtubePlayer.playVideo()):
"Stop video"==c.onFinish&&(a.VIDEO.youtubePlayer.seekTo(0),a.VIDEO.youtubePlayer.pauseVideo(),a.VIDEO.youtubePlayer.stopVideo(),""!=c.posterImgOnVideoFinish&&(a.VIDEO.resetPlayer(),a.VIDEO.youtubePlayer.seekTo(0),a.VIDEO.youtubePlayer.pauseVideo(),a.VIDEO.showPoster2()))):5===b.data&&(a.VIDEO.resetPlayer(),a.VIDEO.playButtonScreen.hide());if(1===b.data&&0==n&&("yes"==a.videos_array[a.videoid].prerollAD||a.options.showGlobalPrerollAds))a.VIDEO.videoAdStarted=!0,a.videoAdPlayed?a.VIDEO.youtubePlayer.playVideo():
(a.VIDEO.youtubePlayer.pauseVideo(),d.canPlayType&&d.canPlayType("video/mp4").replace(/no/,"")&&(this.canPlay=!0,a.video_pathAD=c.showGlobalPrerollAds?a.VIDEO.globalPrerollAds_arr[a.VIDEO.getGlobalPrerollRandomNumber()]:a.videos_array[a.videoid].preroll_mp4),a.VIDEO.loadAD(a.video_pathAD,"prerollActive"),a.VIDEO.openAD());else if(b.data==YT.PlayerState.PLAYING||b.data==YT.PlayerState.CUED)a.youtubePLAYING=!0};var k=-1;b(c.videos).each(function(){k+=1;var d={id:k,title:this.title,videoType:this.videoType,
youtubeID:this.youtubeID,vimeoID:this.vimeoID,video_path_mp4HD:this.mp4HD,video_path_mp4SD:this.mp4SD,ccUrl:this.ccUrl,enable_mp4_download:this.enable_mp4_download,imageUrl:this.imageUrl,imageTimer:this.imageTimer,prerollAD:this.prerollAD,prerollGotoLink:this.prerollGotoLink,preroll_mp4:this.preroll_mp4,prerollSkipTimer:this.prerollSkipTimer,midrollAD:this.midrollAD,midrollAD_displayTime:this.midrollAD_displayTime,midrollGotoLink:this.midrollGotoLink,midroll_mp4:this.midroll_mp4,midrollSkipTimer:this.midrollSkipTimer,
postrollAD:this.postrollAD,postrollGotoLink:this.postrollGotoLink,postroll_mp4:this.postroll_mp4,postrollSkipTimer:this.postrollSkipTimer,popupImg:this.popupImg,popupAdShow:this.popupAdShow,popupAdStartTime:this.popupAdStartTime,popupAdEndTime:this.popupAdEndTime,popupAdGoToLink:this.popupAdGoToLink,description:this.description,thumbnail_image:this.thumbImg,info_text:this.info};a.videos_array.push(d);a.nowPlayingThumbnail=b("<div />");a.nowPlayingThumbnail.addClass("elite_vp_nowPlayingThumbnail");
a.nowPlayingThumbnail.text(a.options.nowPlayingTooltipTxt);a.nowPlayingThumbnail.hide();a.itemLeft=b("<div />");a.itemLeft.addClass("elite_vp_itemLeft");a.i=document.createElement("img");a.i.onload=function(){a.thumbImageW=this.width;a.thumbImageH=this.height};a.i.src=d.thumbnail_image;if("youtube"==c.videos[k].videoType||"YouTube"==c.videoType)if("auto"==d.thumbnail_image||""==d.thumbnail_image)a.i.src="http://img.youtube.com/vi/"+c.videos[k].youtubeID+"/1.jpg";a.itemLeft.append(a.i);a.itemLeft.append(a.nowPlayingThumbnail);
b(a.i).addClass("elite_vp_thumbnail_image elite_vp_themeColorThumbBorder");var e='<div class="elite_vp_itemRight"><div class="elite_vp_title elite_vp_themeColorText">'+d.title+'</div><div class="elite_vp_description elite_vp_controlsColor elite_vp_'+a.options.instanceTheme+'"> '+d.description+"</div></div>",f='<div class="elite_vp_itemRight_bottom"><div class="elite_vp_title elite_vp_themeColorText">'+d.title+'</div><div class="elite_vp_description elite_vp_controlsColor elite_vp_'+a.options.instanceTheme+
'"> '+d.description+"</div></div>";switch(c.playlist){case "Right playlist":a.item=b("<div />");a.item.addClass("elite_vp_item").css("top",String(m)+"px");a.item_array.push(a.item);a.item.addClass("elite_vp_itemUnselected elite_vp_"+a.options.instanceTheme);a.item.append(a.itemLeft);a.item.append(e);m+=80;break;case "Bottom playlist":a.item=b("<div />"),a.item.addClass("elite_vp_item").css("left","0px"),a.item_array.push(a.item),a.item.addClass("elite_vp_itemUnselected elite_vp_"+a.options.instanceTheme),
a.item.css("display","inline-flex"),a.item.append(a.itemLeft),a.item.append(f)}a.playlistContent.append(a.item);void 0!=a.item&&a.item.bind(a.CLICK_EV,function(){a.touchmove||a.scrollingIsOn&&a.isMobile.any()||(a.preloader&&a.preloader.stop().animate({opacity:1},0,function(){b(this).show()}),a.videoid=d.id,a.VIDEO.setPlaylistItem(a.videoid),a.VIDEO.resetPlayer(),a.VIDEO.resetPlayerAD(),a.VIDEO.resizeAll(),h(),a.VIDEO.playVideoById(a.videoid),a.youtubeSTARTED=!1,l&&"AD 5 sec + Pieces After Effects project"!=
a.options.videos[0].title&&"Pieces After Effects project"!=a.options.videos[0].title&&"AD 5 sec + Space Odyssey After Effects Project"!=a.options.videos[0].title&&"AD 5 sec Swimwear Spring Summer"!=a.options.videos[0].title&&"i Create"!=a.options.videos[0].title&&"Swimwear Spring Summer"!=a.options.videos[0].title&&"PLuFX50GllfgP_mecAi4LV7cYva-WLVnaM"!=a.options.youtubePlaylistID&&"Google drive video example"!=a.options.videos[0].title&&"Dropbox video example"!=a.options.videos[0].title&&"Livestream HLS m3u8 video example"!=
a.options.videos[0].title&&"Openload video example"!=a.options.videos[0].title&&"Youtube 360 VR video"!=a.options.videos[0].title&&"Subtitles video example"!=a.options.videos[0].title&&a.VIDEO.pw())})});a.videoid="Yes"==c.loadRandomVideoOnStart?a.rand:0;a.params.id&&(a.videoid=a.rand=parseInt(a.params.id));switch(a.options.playlist){case "Right playlist":"Yes"==c.loadRandomVideoOnStart?(b(a.item_array[a.rand]).removeClass("elite_vp_itemUnselected elite_vp_"+this.options.instanceTheme).addClass("elite_vp_itemSelected elite_vp_"+
this.options.instanceTheme),a.item_array[a.rand].find(".elite_vp_thumbnail_image").removeClass("elite_vp_thumbnail_image").addClass("elite_vp_thumbnail_imageSelected"),a.VIDEO.playedVideos.push(a.rand)):(b(a.item_array[a.videoid]).removeClass("elite_vp_itemUnselected elite_vp_"+this.options.instanceTheme).addClass("elite_vp_itemSelected elite_vp_"+this.options.instanceTheme),a.item_array[a.videoid].find(".elite_vp_thumbnail_image").removeClass("elite_vp_thumbnail_image").addClass("elite_vp_thumbnail_imageSelected"),
a.VIDEO.playedVideos.push(a.videoid));break;case "Bottom playlist":"Yes"==c.loadRandomVideoOnStart?(b(a.item_array[a.rand]).removeClass("elite_vp_itemUnselected_bottom elite_vp_"+this.options.instanceTheme).addClass("elite_vp_itemSelected_bottom elite_vp_"+this.options.instanceTheme),a.item_array[a.rand].find(".elite_vp_thumbnail_image").removeClass("elite_vp_thumbnail_image").addClass("elite_vp_thumbnail_imageSelected"),a.VIDEO.playedVideos.push(a.rand)):(b(a.item_array[a.videoid]).removeClass("elite_vp_itemUnselected_bottom elite_vp_"+
this.options.instanceTheme).addClass("elite_vp_itemSelected_bottom elite_vp_"+this.options.instanceTheme),a.item_array[a.videoid].find(".elite_vp_thumbnail_image").removeClass("elite_vp_thumbnail_image").addClass("elite_vp_thumbnail_imageSelected"),a.VIDEO.playedVideos.push(a.videoid))}b(a.playlistContent).mCustomScrollbar("scrollTo",a.item_array[a.videoid]);if("youtube"==c.videos[a.videoid].videoType||"YouTube"==c.videoType)a.VIDEO.imageWrapper.css({zIndex:0}),a.VIDEO.imageWrapper.css({visibility:"none"}),
a.VIDEO.hideVideoElements(),a.preloader.stop().animate({opacity:0},0,function(){b(this).hide()}),a.VIDEO.ytWrapper.css({zIndex:501}),a.VIDEO.ytWrapper.css({visibility:"visible"}),a.vimeoWrapper.css({zIndex:0});else if("HTML5"==c.videos[a.videoid].videoType||"HTML5 (self-hosted)"==c.videoType){a.VIDEO.imageWrapper.css({zIndex:0});a.VIDEO.imageWrapper.css({visibility:"none"});a.VIDEO.ytWrapper.css({zIndex:0});a.VIDEO.ytWrapper.css({visibility:"hidden"});a.vimeoWrapper.css({zIndex:0});if(d.canPlayType&&
d.canPlayType("video/mp4").replace(/no/,""))if(this.canPlay=!0,"Yes"==c.loadRandomVideoOnStart){switch(c.HTML5VideoQuality){case "HD":a.video_path=a.videos_array[a.rand].video_path_mp4HD;break;case "SD":a.video_path=a.videos_array[a.rand].video_path_mp4SD}a.video_pathAD=a.videos_array[a.rand].preroll_mp4}else if("No"==c.loadRandomVideoOnStart){switch(c.HTML5VideoQuality){case "HD":a.video_path=a.videos_array[a.videoid].video_path_mp4HD;break;case "SD":a.video_path=a.videos_array[a.videoid].video_path_mp4SD}a.video_pathAD=
a.videos_array[a.videoid].preroll_mp4}a.VIDEO.load(a.video_path,"0")}else if("vimeo"==c.videos[a.videoid].videoType||"Vimeo"==c.videoType)a.VIDEO.imageWrapper.css({zIndex:0}),a.VIDEO.imageWrapper.css({visibility:"none"}),a.VIDEO.hideCustomControls(),a.VIDEO.hideVideoElements(),a.preloader.stop().animate({opacity:0},700,function(){b(this).hide()}),a.vimeoWrapper.css({zIndex:501}),a.isMobile.any()?"Yes"==c.loadRandomVideoOnStart?b(a.vimeoWrapper).find("#"+a.options.instanceName).attr("src","https://player.vimeo.com/video/"+
a.videos_array[a.rand].vimeoID+"?autoplay=0?api=1&player_id="+a.options.instanceName+"&color="+c.vimeoColor):b(a.vimeoWrapper).find("#"+a.options.instanceName).attr("src","https://player.vimeo.com/video/"+a.videos_array[a.videoid].vimeoID+"?autoplay=0?api=1&player_id="+a.options.instanceName+"&color="+c.vimeoColor):c.autoplay?"Yes"==c.loadRandomVideoOnStart?b(a.vimeoWrapper).find("#"+a.options.instanceName).attr("src","https://player.vimeo.com/video/"+a.videos_array[a.rand].vimeoID+"?autoplay=1?api=1&player_id="+
a.options.instanceName+"&color="+c.vimeoColor+"&muted=1"):b(a.vimeoWrapper).find("#"+a.options.instanceName).attr("src","https://player.vimeo.com/video/"+a.videos_array[a.videoid].vimeoID+"?autoplay=1?api=1&player_id="+a.options.instanceName+"&color="+c.vimeoColor+"&muted=1"):"Yes"==c.loadRandomVideoOnStart?b(a.vimeoWrapper).find("#"+a.options.instanceName).attr("src","https://player.vimeo.com/video/"+a.videos_array[a.rand].vimeoID+"?autoplay=0?api=1&player_id="+a.options.instanceName+"&color="+c.vimeoColor):
b(a.vimeoWrapper).find("#"+a.options.instanceName).attr("src","https://player.vimeo.com/video/"+a.videos_array[a.videoid].vimeoID+"?autoplay=0?api=1&player_id="+a.options.instanceName+"&color="+c.vimeoColor),h();else if("image"==c.videos[a.videoid].videoType||"Image"==c.videoType)a.VIDEO.hideCustomControls(),a.VIDEO.hideVideoElements(),a.VIDEO.ytWrapper.css({zIndex:0}),a.VIDEO.ytWrapper.css({visibility:"hidden"}),a.vimeoWrapper.css({zIndex:0}),a.vimeoWrapper.css({visibility:"hidden"}),a.VIDEO.imageWrapper.css({zIndex:502}),
a.VIDEO.imageWrapper.css({visibility:"visible"}),a.VIDEO.imageDisplayed.src=a.videos_array[0].imageUrl,b(a.VIDEO.imageDisplayed).on("load",function(){c.autoplay&&a.VIDEO.setImageTimer()});a.nextBtn.bind(a.CLICK_EV,function(){a.VIDEO.shuffleBtnEnabled?(a.VIDEO.generateRandomNumber(),a.videoid=a.VIDEO.rand):(a.videoid+=1,a.videoid>=c.videos.length&&(a.videoid=0));a.VIDEO.setPlaylistItem(a.videoid);a.VIDEO.playVideoById(a.videoid);h()});a.previousBtn.bind(a.CLICK_EV,function(){a.VIDEO.shuffleBtnEnabled?
(a.VIDEO.generateRandomNumber(),a.videoid=a.VIDEO.rand):(--a.videoid,0>a.videoid&&(a.videoid=c.videos.length-1));a.VIDEO.setPlaylistItem(a.videoid);a.VIDEO.playVideoById(a.videoid);h()});a.shuffleBtn.bind(a.CLICK_EV,function(){a.VIDEO.toggleShuffleBtn()});a.lastBtn.bind(a.CLICK_EV,function(){b(a.playlistContent).mCustomScrollbar("scrollTo","last")});a.firstBtn.bind(a.CLICK_EV,function(){b(a.playlistContent).mCustomScrollbar("scrollTo","first")});a.totalWidth=c.videoPlayerWidth;a.totalHeight=c.videoPlayerHeight;
"Right playlist"!=c.playlist&&"Bottom playlist"!=c.playlist||!a.element||(g.append(a.playlist),a.playlist.append(a.playlistContent));this.playlistW=this.playlist.width();this.playlistH=this.playlist.height();"Right playlist"==c.playlist?(a.playlistContent.css("height",String(m)+"px"),a.playerWidth=a.totalWidth-a.playlist.width(),a.playerHeight=a.totalHeight-a.playlist.height(),a.playlist.css({height:"100%",top:0}),a.playlistContent.height(g.height()-50),b(a.playlistContent).mCustomScrollbar({axis:"y",
theme:a.options.playlistScrollType,scrollButtons:{enable:!0},snapOffset:50,callbacks:{onScrollStart:function(){a.isMobile.any()&&setTimeout(function(){a.playlistContentOverlay.show();a.scrollingIsOn=!0},50)},onScroll:function(){a.isMobile.any()&&(a.playlistContentOverlay.hide(),a.scrollingIsOn=!1,a.touchmove=!1)},whileScrolling:function(){}}})):"Bottom playlist"==c.playlist&&(a.playlistContent.css("width","0px"),a.playerWidth=a.totalWidth,a.playerHeight=a.totalHeight-a.playlist.height(),a.playlist.css({left:0,
width:"100%",bottom:0}),a.playlistContent.width(g.width()),b(a.playlistContent).mCustomScrollbar({axis:"x",theme:a.options.playlistScrollType,scrollButtons:{enable:!0},callbacks:{onScrollStart:function(){a.isMobile.any()&&setTimeout(function(){a.playlistContentOverlay.show();a.scrollingIsOn=!0},50)},onScroll:function(){a.isMobile.any()&&(a.playlistContentOverlay.hide(),a.scrollingIsOn=!1,a.touchmove=!1)},whileScrolling:function(){}},advanced:{autoExpandHorizontalScroll:!0},setHeight:"auto",setWidth:"auto"}));
b(a.playlistContent).mCustomScrollbar("scrollTo",a.item_array[a.videoid]);b("body").bind("touchmove",function(b){a.touchmove=!0})};PLAYER.Playlist.prototype={};PLAYER.Playlist.prototype.hidePlaylist=function(){this.playlist.hide()};PLAYER.Playlist.prototype.showPlaylist=function(){this.playlist.show()};
PLAYER.Playlist.prototype.resizePlaylist=function(b,f){switch(this.options.playlist){case "Right playlist":this.playlist.css({right:0,height:"100%"});this.playlistContent.css({top:0,height:this.mainContainer.height()-50});this.playlistContent.height(this.mainContainer.height()-this.playlistBar.height());break;case "Bottom playlist":this.playlist.css({left:0,width:"100%",bottom:0}),this.playlistContent.height(this.playlist.height()-this.playlistBar.height())}this.playlistBarInside.css({left:this.playlistBar.width()/
2-this.playlistBarInside.width()/2})};PLAYER.Playlist.prototype.playYoutube=function(b){void 0!=this.VIDEO.youtubePlayer&&(this.VIDEO.youtubePlayer.cueVideoById(this.videos_array[b].youtubeID),this.VIDEO.youtubePlayer.setPlaybackQuality(this.ytQuality),this.preloader.hide(),this.VIDEO.ytWrapper.css({zIndex:501}),this.VIDEO.ytWrapper.css({visibility:"visible"}),this.VIDEO.youtubePlayer.playVideo());this.VIDEO.resizeAll()};
PLAYER.Playlist.prototype.playVimeo=function(b){this.preloader.hide();this.vimeoWrapper.css({zIndex:501});this.isMobile.any()?$(self.vimeoWrapper).find("#"+self.options.instanceName).attr("src","https://player.vimeo.com/video/"+this.videos_array[b].vimeoID+"?autoplay=0?api=1&player_id="+self.options.instanceName+"&color="+this.options.vimeoColor):$(self.vimeoWrapper).find("#"+self.options.instanceName).attr("src","https://player.vimeo.com/video/"+this.videos_array[b].vimeoID+"?autoplay=1?api=1&player_id="+
self.options.instanceName+"&color="+this.options.vimeoColor)};