function addVideoInfo(n){typeof tag!="undefined"&&(richMediaInfo={mediaType:"video",playerId:1,mediaLevel2:"20",mediaLabel:getMediaLabel(n),isEmbedded:window.location.href.contains("embed")?!0:!1,broadcastMode:getBroadcastMode(n),duration:getDuration(n)},this.tag.richMedia.add(richMediaInfo))}function sendVideoInfo(n,t){if(typeof tag!="undefined"){richMediaInfo.action=n;var i=getVideo(t);if(typeof i!="undefined"){if(n==="progress"||n==="waiting"){if(richMediaInfo.action="info",buffering&&n==="progress"&&!i.seeking)buffering=!1;else if(n==="waiting"&&buffering===!1)buffering=!0;else return;richMediaInfo.isBuffering=Number(buffering)}(buffering||i.seeking)&&richMediaInfo.action!=="info"||this.tag.richMedia.send(richMediaInfo)}}}function getVideo(n){var t=document.getElementById(n).getElementsByTagName("iframe")[0];return t?t.contentWindow.document.getElementsByTagName("video")[0]:null}function getMediaLabel(n){if(typeof n=="undefined")return"";var t=window.location.href.contains("embed")?"embed":"webcast";return t=t.concat("::",n.CategoryNamePath.join("::")),window.location!=window.parent.location&&(t=t.concat("::",encodeURIComponent(document.referrer),"::")),t.concat("::",n.Id)}function getDuration(n){if(n.Status===1||!n.LiveStopPlayingAt||!n.LiveStartPlayingAt)return 0;var t=new Date(n.LiveStartPlayingAt.match(/\d+/)[0]*1),i=new Date(n.LiveStopPlayingAt.match(/\d+/)[0]*1);return(i-t)/1e3}function getBroadcastMode(n){return typeof n.Status=="undefined"?"clip":n.Status==2?"clip":"live"}var tag,buffering,richMediaInfo,ec;typeof ATInternet!="undefined"&&(ATInternet.Utils.consentReceived(!1),tag=new ATInternet.Tracker.Tag({ignoreEmptyChapterValue:!0,sendHitWhenOptOut:!1}));buffering=!1;richMediaInfo={};ec=ec||{};ec.playerControl=function(){var n,r,u=".start-recording",f={},t=0,i,e=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,l=function(){return n},o=function(t,i){if(!n){r=t;$(".kalturaplayer").click();return}n.kBind("playerUpdatePlayhead",function(){n.kUnbind("playerUpdatePlayhead");!e;i&&n.kBind("playerUpdatePlayhead",function(t){t>=ec.webcastDetails.RecStop&&(n.kUnbind("playerUpdatePlayhead"),n.sendNotification("doStop"))})});n.sendNotification("doSeek",t);$(document).scrollTop(0)},a=function(){if(r&&i){o(r);r=undefined;return}var n=ec.contentManager.get("webcast");n.Status==2&&!e},v=function(n,t){var r=document.getElementById(n).getElementsByTagName("iframe")[0],i;r&&(i=r.contentWindow.document.getElementsByTagName("video")[0],i&&(i.addEventListener("loadedmetadata",function(){addVideoInfo(t)}),i.addEventListener("pause",function(){sendVideoInfo("pause",n)}),i.addEventListener("play",function(){sendVideoInfo("play",n)}),i.addEventListener("progress",function(){sendVideoInfo("progress",n)}),i.addEventListener("waiting",function(){sendVideoInfo("waiting",n)})))},y=function(){var r=$(u).html()!='<i class="icon-circle"><\/i> '+ec.translations.getTranslation("Record"),i=0;n?(i=parseInt(n.evaluate("{video.player.currentTime}"))-t,i<1&&(i=0)):$(".kalturaplayer").click();r&&i+t>=f.Start?($(u).html('<i class="icon-circle"><\/i> '+ec.translations.getTranslation("Record")),f.End=i,$("#recEnd").html(Math.floor(i).toString().toHHMMSS())):($(u).html('<i class="icon-circle bleep"><\/i> '+ec.translations.getTranslation("Stop")),f.Start=i,f.End=0,$("#recStart").html(Math.floor(i).toString().toHHMMSS()),$("#recEnd").html("0".toHHMMSS()),s())},s=function(){var r=$(u).html()!='<i class="icon-circle"><\/i> '+ec.translations.getTranslation("Record"),i;n&&(i=parseInt(n.evaluate("{video.player.currentTime}"))-t,i<0&&(i=0),$("#recEnd").html(Math.floor(i).toString().toHHMMSS()));r&&setTimeout(s,500)},h=function(){$(u).click(function(n){n.stopPropagation();y()})},p=function(){return f},c=function(){var u=ec.contentManager.get("webcast"),n={sourceSelector:{plugin:!0},audioSelector:{plugin:!e},autoPlay:!0,hlsjs:{plugin:!0},streamerType:u.Status!=2?"hls":"auto",wmode:"opaque","largePlayBtn.showTooltip":!0,"strings.mwe-embedplayer-play_clip":"Play video of "+Handlebars.helpers.formatAltText(u.CategoryName,u.Title,u.ScheduleStart)},o=Handlebars.commonHelpers.getEpoch(u.LiveStart),a=u.ClipSpans.length,f,y,h,d,v;if(a==0)o&&u.Status==2&&(t=Handlebars.commonHelpers.getEpoch(u.LiveStartPlayingAt),f=Handlebars.commonHelpers.getEpoch(u.LiveStopPlayingAt),t&&(t=(t-o)/1e3),f=f?(f-o)/1e3:-1,n["scrubber.plugin"]=!1,n["hlsjs.plugin"]=!0,n["scrubberAMG.plugin"]=!0,n["clippingAMG.plugin"]=!0,n["clippingAMG.segmentsPackage"]="(["+t+", "+f+"])",r&&!i&&(n["clippingAMG.playFrom"]=r));else if(a>0&&u.Status==2){o&&(t=Handlebars.commonHelpers.getEpoch(u.LiveStartPlayingAt),f=Handlebars.commonHelpers.getEpoch(u.LiveStopPlayingAt),t&&(t=(t-o)/1e3),f=f?(f-o)/1e3:-1);var c=0,l="",s=[t?t:0];for(y in u.ClipSpans){var p=Handlebars.commonHelpers.getEpoch(u.ClipSpans[c].ClipStart),w=Handlebars.commonHelpers.getEpoch(u.ClipSpans[c].ClipStop),b=(p-o)/1e3,k=(w-o)/1e3;s.push(b);s.push(k);c++;c>a-1&&s.push(f?f:-1)}h=0;for(d in s)h==0&&(l="("),l+=h%2==0?"["+s[h]:s[h]+"]",h++,l+=h>s.length-1?")":",";n["scrubber.plugin"]=!1;n["scrubberAMG.plugin"]=!0;n["clippingAMG.plugin"]=!0;n["clippingAMG.segmentsPackage"]=l}return n["hlsjs.plugin"]=!0,ec.webcastDetails.RecStart!=null&&ec.webcastDetails.RecStop&&(n["mediaProxy.mediaPlayFrom"]=t+ec.webcastDetails.RecStart,n["mediaProxy.mediaPlayTo"]=t+ec.webcastDetails.RecStop),v=window.location.href.contains("embed"),v&&(document.referrer.indexOf("eucouncildevui.streamamg.com")<0||document.referrer.indexOf("consilium.europa.eu")<0)&&(n.watermark={plugin:"true",watermarkPath:"/Content/images/logo_transparent.png",watermarkPosition:"topLeft player-watermark",padding:null,iframeHTML5Css:"/Content/responsive-embed.css"},n.referrer=document.referrer),n},w=function(){n=undefined},b=function(){$("#video-placeholder").attr("style","display: none;");$(".media-overlay-content").show();$("#playercontainer").show();$("#icon-play").click(function(){$(".kalturaplayer").click()});$(".kalturaplayer").click(function(){var s,t,h,r,l,u,f,y,o;$("#icon-play").hide();s=navigator.userAgent.indexOf("Chrome")!=-1;t=navigator.userAgent.indexOf("Safari")!=-1;s&&t&&(t=!1);h=navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)/i);r=ec.contentManager.get("webcast");i=r.Status==2&&g()&&nt()?!1:!0;r.Status==2&&t&&(i=!1);l=i?"LiveUiConfId":"OnDemandUiConfId";u=ec.webcastDetails[l];window.location.search.indexOf("uiconfid")>-1&&(f=$.parseParams(window.location.search.replace("?","")),u=f.uiconfid,i=f.hlsjs!="true");y=0;o={targetId:$(this).attr("id"),wid:"_"+$(this).attr("data-partnerid"),entry_id:$(this).attr("data-entryid"),uiconf_id:u,width:"100%",height:"100%",flashvars:c()};o.readyCallback=function(t){var i=document.getElementById(t);i.addJsListener("audioTracksReceived","onTracksReceived");i.addJsListener("audioTrackIndexChanged","onTrackSelected");i.addJsListener("durationWithoutOmitSegments",function(n){i.duration=n});i.kBind("playerPlayEnd",function(){i.sendNotification("doStop")});i.kBind("mediaReady",function(){n=i;a();typeof ATInternet!="undefined"&&v(t,r)})};$.ajax({url:"//open.http.mp.streamamg.com/p/"+$(this).attr("data-partnerid")+"/sp/"+$(this).attr("data-partnerid")+"00/embedIframeJs/uiconf_id/"+u+"/partner_id/"+$(this).attr("data-partnerid"),cache:!0,dataType:"script",success:function(){var n=ec.contentManager.get("webcast");t&&!h&&mw.setConfig("EmbedPlayer.NativeControls",!0);i?(n.Status!=2&&mw.setConfig("LeadWithHLSOnFlash",!0),e?(mw.setConfig("EmbedPlayer.EnableIpadNativeFullscreen",!0),mw.setConfig("EmbedPlayer.EnableIpadHTMLControls",!0)):mw.setConfig("KalturaSupport.LeadWithHTML5",!0)):navigator.userAgent.match(/iPad/i)&&mw.setConfig("EmbedPlayer.NativeControls",!0);mw.setConfig("hlsjs.plugin",!0);kWidget.embed(o)}})});h()},k=function(){function t(){var t=$(".webcast-agenda").width(),i,u,r;t||(t=!n&&$("#video-placeholder").length?$("#video-placeholder").width():$("#playercontainer").width());t>0&&(i=t/16*9+36,u=window.location.href.contains("embed"),u&&(t=window.innerWidth,i=window.innerHeight),r=$("#video-placeholder").is(":visible"),r||$("#video-placeholder").attr("style","height: "+i+"px; "),$("#playercontainer").attr("style","height: "+i+"px"),$(".mediaplayer").attr("style","height: "+i+"px;"),!n&&$("#video-placeholder").length&&r?$("#playercontainer").hide():$("#video-placeholder").hide())}t();$(window).resize(function(){t()});$(window).on("orientationchange",t)},d=function(){return n?parseInt(n.evaluate("{video.player.currentTime}")):0},g=function(){return window.MediaSource&&typeof window.MediaSource.isTypeSupported=="function"&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},nt=function(){var n=document.createElement("video");return n.canPlayType?!0:!1};return{initPlayer:b,uninitPlayer:w,seek:o,registerRecordClick:h,getRecordingTimes:p,getCurrentTime:d,subscribeResizeEvent:k,getFlashvars:c,getPlayer:l}}();ec=ec||{};ec.share=function(){var n,i=function(){$("#share a").click(function(){var i=$(this).data("type")!="email",r="/"+ec.languageSwitcher.getLangCode()+"/share?type="+$(this).data("type")+"&id="+n;t(r,i)})},r=function(){$("#advancedShare a").click(function(){var i=ec.playerControl.getRecordingTimes(),u=$(this).data("type")!="email",r;$(this).data("type")!="facebook"||ec.initializer.isIE89()||ec.apiConsumer.updateUrl("?recStart="+i.Start+"&recStop="+i.End);r="/"+ec.languageSwitcher.getLangCode()+"/share?type="+$(this).data("type")+"&id="+n+"&recStart="+i.Start+"&recStop="+i.End;t(r,u)})},t=function(n,t){if(t){window.open(n,"_blank","menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,dependent,width=800,height=620,left=0,top=0");return}location.href=n},u=function(){$("#advancedShare").hide();$(".tabLink").click(function(){var n=$(this).attr("href");$(".share-tab").hide();$(n).show()})},f=function(){n=ec.webcastDetails.Id;i();r();ec.initializer.isIE89()&&u()};return{init:f}}();ec=ec||{};ec.webcast=function(){var n,o=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),s=function(){var r=[],u=0;return $.each(n.PresenterTimings,function(n,f){var e=i(f.PresenterId),o=Handlebars.commonHelpers.getEpoch(f.LiveStart),s=t();r.push({Id:e.Id,AgendaPointId:f.AgendaPointId,Title:e.Title,ImageUrl:e.ImageUrl,LiveStart:o,CurrentPresenter:s==u?"current-speaker":""});u++}),r},h=function(){var t=[];return $.each(n.PollResultTimings,function(n,i){var r=c(i.PollResultId),u=Handlebars.commonHelpers.getEpoch(i.LiveStart);t.push({Id:r.Id,AgendaPointId:i.AgendaPointId,Title:r.Title,ImageUrl:r.ImageUrl,LiveStart:u,StatusId:r.StatusId})}),t},t=function(){var u,f,t,r,i;if(n.Status==2){for(u=ec.playerControl.getCurrentTime(),f=Handlebars.commonHelpers.getEpoch(n.LiveStart),t=0;t<n.PresenterTimings.length;t++)if(r=Handlebars.commonHelpers.getEpoch(n.PresenterTimings[t].LiveStart),i=t+1<n.PresenterTimings.length?Handlebars.commonHelpers.getEpoch(n.PresenterTimings[t+1].LiveStart):0,r=(r-f)/1e3,i!=0&&(i=(i-f)/1e3),r>=0&&r<u&&(i==0||u<i))return Handlebars.commonHelpers.getEpoch(n.PresenterTimings[t].LiveStart);return-1}return n.PresenterTimings.length-1},c=function(t){return $.grep(n.PollResults,function(n){return n.Id==t})[0]},i=function(t){return $.grep(n.Presenters,function(n){return n.Id==t})[0]},l=function(){var t=Handlebars.commonHelpers.getEpoch(n.LiveStart);$(".player-seek").each(function(){$(this).click(function(){var n=(parseInt($(this).data("livestart"))-t)/1e3;ec.playerControl.seek(n)})})},r=function(){$(".webcast-agenda-title").click(function(){$(".webcast-agenda-details").hide();$("#"+$(this).find(".player-seek:first").data("agendapointid")).toggle()})},u=function(n,t){$(".speakers").each(function(){$(this).closest("span").remove();$(this).data("agendapointid")==n?($(this).html(ec.translations.getTranslation("Speakers")+": "),$(this).parent().append('<span><i class="icon-play-circle speakers"><\/i> '+t+"<\/span>")):$(this).html(ec.translations.getTranslation("Speakers"))})},f=function(){var c=t(),i,e,l,s,h,r;$(".country-flags a").removeClass("current-speaker");c!=-1&&(i=$(".country-flags").find('[data-livestart="'+c+'"]'),i.addClass("current-speaker"),u(i.data("agendapointid"),i.data("presentertitle")),n.Status==2&&(e=$(i).data("agendapointid"),o&&($(".webcast-agenda .agenda-item").each(function(){var n=$(this).find(".webcast-agenda-details:first").attr("id");n==e&&(l=$(this))}),s='<div class="agenda-item"><h4 class="webcast-agenda-title content" style="cursor: auto; background: none; font-size: 100%; margin-left: -4px;">{title}<\/h4> - Speaker: {speaker} <\/div>',h=i.find("img:first").clone(),h.attr("style","height:18px;"),r=l.find("h4 a:first").html(),r=r.substr(r.indexOf("<\/i>")),s=s.replace("{title}",r).replace("{speaker}",i.data("presentertitle")),$("#current-agendapoint-holder .agenda-wrapper").html(s),$("#current-agendapoint-holder .agenda-wrapper .agenda-item").append(h),$("#current-agendapoint-holder").show()),$(".webcast-agenda-title").removeClass("active"),$("#"+e).parent().find(":first").addClass("active"),$(".webcast-agenda-details").hide(),$("#"+e).show()));setTimeout(f,1e3)},a=function(){var e=n,o,t,c;e.Presenters=s();e.PollResults=h();ec.templates.load("agendaTemplate",e);$(".poll-result").click(function(){$.colorbox({transition:"none",html:'<div style="display: block; width: 600px; min-height: 500px; overflow: visible;"><img src="'+$(this).data("imageurl")+'" /><\/div>',onComplete:function(){$("#cboxLoadedContent").unbind().click($.colorbox.close)}})});n.Status==2?(f(),l(),r()):(o=n.PresenterTimings.length-1,t=n.PresenterTimings[o],t?(c=i(t.PresenterId),u(t.AgendaPointId,c.Title),$("#"+t.AgendaPointId).show(),r()):$(".webcast-agenda-details").show())},e=function(){var n=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;n||$(".kalturaplayer").click()},v=function(t){var r=!n,i=window.location.href.contains("embed");n&&n.Status!=t.Status&&(n.Status==0&&t.Status==1&&(ec.playerControl.initPlayer(),e()),n.Status==1&&t.Status==2&&($("#not-yet-live-message").hide(),$("#live-finished-message").show(),$("#video-placeholder").attr("style",""),ec.playerControl.uninitPlayer(),$("#playercontainer").remove()));n=t;n.Status!=2&&(n.LiveUpdates=n.LiveUpdates.reverse());i||(ec.templates.load("webcastHeaderCategoryTemplate",n),ec.templates.load("webcastTopicsTemplate",n),ec.templates.load("webcastHeaderTemplate",n),ec.templates.load("liveUpdateTemplate",n),$("#webcastContent").addClass(Handlebars.commonHelpers.getClass(n,"webcasts")),ec.templates.load("navigationTemplate",{Title:n.Title,Lang:ec.languageSwitcher.getLangCode()}));a();r&&(ec.apiConsumer.loadRelatedWebcasts(),ec.templates.load("mediaplayerTemplate",n),ec.playerControl.subscribeResizeEvent(),n.Status!=2&&setInterval(ec.apiConsumer.loadWebcast,5e3),n.Status==1&&(ec.playerControl.initPlayer(),e()),n.Status==2&&($(".webcast-agenda-details").show(),n.EntryReady?(ec.playerControl.initPlayer(),$("#video-placeholder").remove()):($("#not-yet-live-message").hide(),$("#live-finished-message").show())),i||ec.share.init(),$("#socialTemplate").show())};return{init:v}}()