Mediasite.namespace("MediaPlayer"),Mediasite.namespace("MediaPlayer.Views"),Mediasite.MediaPlayer.ModelFlash=function(n){function nowUnloading(){bt=!0}function resetLiveMedia(){y=!0,o=0;var n=f.id,i=makeJsBridgeFunctionGlobalName(n);it=t.GetVolume(),ft=t.IsMuted(),a=e.CreateMediaElement(n,i),nt=e.Wrapper,f=a.get(0)}function isLive(){return!!c}function reconnectOnLiveMediaOpenFailure(){resetLiveMedia()}function convertState(n){switch(n.toLowerCase()){case"buffering":return Mediasite.Player.MediaState.Buffering;case"closed":return Mediasite.Player.MediaState.Closed;case"error":return Mediasite.Player.MediaState.Error;case"opening":return Mediasite.Player.MediaState.Opening;case"paused":return Mediasite.Player.MediaState.Paused;case"playing":return Mediasite.Player.MediaState.Playing;case"stopped":return Mediasite.Player.MediaState.Stopped;default:return Mediasite.Player.MediaState.Undefined}}function notifyMediaLoaded(){var t=getStrobeApi(),n;t&&(n=makeMediaInfo(t),e.UpdateMediaInfo(n),i.fire(r.MediaLoaded,n))}function makeMediaInfo(i){var u=0,r;return i.getVideoHeight()>0&&i.getVideoWidth()>0&&(u=i.getVideoWidth()/i.getVideoHeight()),r={AspectRatio:u,Duration:t.GetDuration(),AudioOnly:i.getVideoHeight()===0,CanChangeSpeed:!1,CanFullScreen:!1,CurrentLanguageIndex:t.GetCurrentAudioLanguageIndex(),Languages:t.GetAudioLanguages(),StreamType:n.streamType,IsMainStream:n.isMainStream}}function getStrobeApi(){return f&&f.jsBridgeInitialized?f:!1}function notifyPlayerStateChange(n){i.fire(r.PositionChanged,t.GetPosition()),p.setMediaState(n),i.fire(r.StateChanged,n)}function jsBridge(n,t,i){var r={onJavaScriptBridgeCreated:handle_onJavaScriptBridgeCreated,loadstart:handle_loadstart,emptied:handle_emptied,complete:handle_complete,durationchange:handle_durationchange,progress:handle_progress,timeupdate:handle_timeupdate,waiting:handle_waiting,play:handle_play,pause:handle_pause,seeking:handle_seeking,seeked:handle_seeked,loadedmetadata:handle_loadedmetadata};typeof r[t]=="function"&&r[t](i)}function handle_onJavaScriptBridgeCreated(){toConsole("onJavaScriptBridgeCreated called");var i=f;i.jsBridgeInitialized=!0,i.setSrc(v),k.Info("Media element source set",v,"of type",ct,"on server type",ht),!0&&p.setAllowedReconnectAttempts(at),t.SetVolume(it),ft&&t.Mute()}function handle_loadedmetadata(n){var t,u;(toConsole("loadedmetadata "+n.videoWidth+"x"+n.videoHeight),t=getStrobeApi(),t)&&(rt=!0,u=n.videoWidth/n.videoHeight,y?(t.play2(),y=!1,notifyMediaLoaded()):(st=!0,e.MediaLoadStart(),i.fire(r.MediaLoadStart),notifyMediaLoaded()))}function handle_loadstart(n){toConsole("loadstart "+n.currentSrc);var t=getStrobeApi();!t}function handle_emptied(n){toConsole("emptied ended: "+n.ended);var i=!!c,t=getEffectiveState()==Mediasite.Player.MediaState.MediaEnded;rt&&(t||(i?setEffectiveState(Mediasite.Player.MediaState.Stopped):setEffectiveState(Mediasite.Player.MediaState.MediaEnded)))}function handle_complete(){toConsole("complete"),i.fire(r.PositionChanged,t.GetPosition()),s=0,i.fire(r.PositionChanged,0),setEffectiveState(Mediasite.Player.MediaState.MediaEnded)}function handle_durationchange(){}function handle_progress(){}function handle_timeupdate(n){l&&l.IsReady()&&l.TimeUpdateCalled(n.currentTime),i.fire(r.PositionChanged,t.GetPosition())}function handle_waiting(){(toConsole("waiting"),getEffectiveState()!=Mediasite.Player.MediaState.MediaEnded)&&setEffectiveState(Mediasite.Player.MediaState.Buffering)}function handle_play(){toConsole("handle_play");var i=getStrobeApi();i&&(setEffectiveState(Mediasite.Player.MediaState.Playing),o++,o!=1||isNaN(h)||t.SetPosition(h))}function getEffectiveState(){return tt}function setEffectiveState(n){toConsole("SET EFFECTIVE STATE TO "+n),tt=n,notifyPlayerStateChange(n)}function handle_pause(){toConsole("pause blah");var t=getStrobeApi();t&&getEffectiveState()!=Mediasite.Player.MediaState.MediaEnded&&(c||setEffectiveState(Mediasite.Player.MediaState.Paused))}function handle_seeking(){return toConsole("seeking"),!1}function handle_seeked(){toConsole("seeked")}function onMediaPlaybackError(n,t,u,f){if(toConsole("%% onMediaPlaybackError %% playerId: "+n+", code: "+t+", message: "+u+", detail: "+f),a.css("visibility","hidden"),p.HandleLiveMediaOpenFailure(reconnectOnLiveMediaOpenFailure)){toConsole("ERROR will be handled by liveMediaOpenReconnector");return}var e;switch(t){default:e=Mediasite.Player.Localization.MediaPlayer.GeneralError+" ("+t+" - "+u+")"}i.fire(r.MediaError,e)}function globalMediaPlaybackErrorFunction(n,t,i,r){var u=getMediaPlaybackErrorFunction(n);toConsole("onMediaPlaybackError function found"),u(n,t,i,r)}function setMediaPlaybackErrorFunction(n,t){if(typeof n!="string")throw{name:"Invalid Argument",message:"playerId must be a string."};if(typeof t!="function")throw{name:"Invalid Argument",message:"func must be a function."};window.strobeMediaErrorFunctions=window.strobeMediaErrorFunctions||{},window.strobeMediaErrorFunctions[n]=t,window.onMediaPlaybackError=window.onMediaPlaybackError||globalMediaPlaybackErrorFunction}function getMediaPlaybackErrorFunction(n){return window.strobeMediaErrorFunctions&&window.strobeMediaErrorFunctions[n]}function makeJsBridgeFunctionGlobalName(n){if(typeof n!="string")throw{name:"Invalid Argument",message:"elementId must be a string."};return window.strobeJsBridgeFunctions=window.strobeJsBridgeFunctions||{},window.strobeJsBridgeFunctions[n]=jsBridge,"window.strobeJsBridgeFunctions."+n}function makeUniqueSwfObjectId(){return"swf_"+getUniqueString()}function getUniqueString(){return""+ +new Date}function cueNextSource(){var n=w.shift();v=n.Location,ht=n.ServerType,ct=n.MimeType}function getNextPlaybackRate(n,i){var f,r,e;return n=n!==!1,i=i!==!1,f=Math.round(t.GetPlaybackRate()*100)/100,r=u.extend([],d),r.length==0&&(r=[1]),e=n?1:-1,r.sort(function(n,t){return e*(n-t)}),i&&0>=e*(r[r.length-1]-f)?f=r[0]:u.each(r,function(n,t){if(0>=e*(t-f)&&00&&cueNextSource(),typeof v=="undefined"){i.fire(r.MediaError,Mediasite.Player.Localization.MediaPlayer.NoCompatibleMediaError),k.Error("Media - no compatible media source");return}s=makeUniqueSwfObjectId(),c=makeJsBridgeFunctionGlobalName(s),n.mediaSource=v,e=u.extend({},new Mediasite.MediaPlayer.BaseView,new ut(n)),a=e.CreateMediaElement(s,c),nt=e.Wrapper,f=a.get(0),l=new et(getStrobeApi,k),setMediaPlaybackErrorFunction(s,onMediaPlaybackError),u(window).unload(function(){a.remove()})},this.GetMediaWrapper=function(){return nt},this.SupportsPlayAsVideo=function(){return!1},this.AddEventHandler=function(n,t){i.addHandler(n,t)},this.UpdateOptions=function(n){it=n.Volume},this.LiveStatusChange=function(n){var i=Mediasite.Player.PresentationStatus;dt=n==i.Live||n==i.LivePaused||n==i.OpenForLive||n==i.ScheduledForLive,p.setLiveStatus(n),n===Mediasite.Player.PresentationStatus.LiveEnded&&(t.Stop(),setEffectiveState(Mediasite.Player.MediaState.MediaEnded))},this.InactivityExceeded=function(){ot=!0},this.SetPosition=function(n){var u=getStrobeApi();if(u){if(o<1){h=Math.min(t.GetDuration(),Math.max(0,n)),i.fire(r.PositionChanged,h);return}n>=0&&n0?n.pause():t.Stop())},this.Play=function(){toConsole("Play called");var n=getStrobeApi();if(n){if(ot===!0)window.location.reload();else if(toConsole("PLAYCOUNT = "+o),isLive()&&o>0&&n.wasStopped)resetLiveMedia();else try{n.play2()}catch(t){}l&&l.Reset()}},this.Stop=function(){toConsole("Stop called");var n=getStrobeApi();if(n)try{n.wasStopped=!0,n.stop2()}catch(t){}},this.GetPosition=function(){var i=getStrobeApi(),t,n;if(i){if(o<1&&!isNaN(h))return h;try{return(t=i.getCurrentTime()*1e3+g,s>0&&(n=t-s,gt.2?this.SetVolume((n.getVolume()-.2)*100):this.SetVolume(0)))},this.ToggleMute=function(){b||(t.IsMuted()?t.UnMute():t.Mute())},this.Mute=function(){var n=getStrobeApi();n&&(n.setMuted(!0),t.IsMuted()&&i.fire(r.VolumeChanged,0))},this.UnMute=function(){var n=getStrobeApi();n&&(b||(n.setMuted(!1),t.GetVolume()===0?this.SetVolume(50):i.fire(r.VolumeChanged,Math.round(t.GetVolume()))))},this.IsMuted=function(){var n=getStrobeApi();if(n)return n.getMuted()},this.TogglePlayPause=function(){var n=getStrobeApi();n&&(toConsole("TogglePlayPause "+n.getState()),convertState(n.getState())===Mediasite.Player.MediaState.Playing?t.Pause():t.Play())},this.SetPlaybackRate=function(){return},this.GetPlaybackRate=function(){return 1},this.GetCurrentAudioLanguageIndex=function(){return 1},this.GetAudioLanguages=function(){return[]},this.SetAudioLanguage=function(){},this.SetLiveStartTime=function(n){c=n},this.RetrieveBookmark=function(n){lt=n},ut=function(n){function makeFlashVars(t){function pushFlashParamsIntoVarList(n){var t;for(t in n)n.hasOwnProperty(t)&&u.push(t+"="+n[t])}var o={autoPlay:!0,plugin_AdaptiveStreamingPlugin:encodeURIComponent(getSSPluginPath()),AdaptiveStreamingPlugin_retryLive:!0,AdaptiveStreamingPlugin_retryInterval:45,controlBarMode:"none",playButtonOverlay:!1,bufferingOverlay:!1,javascriptCallbackFunction:t},u=[],r,i;if(pushFlashParamsIntoVarList(o),r={streamType:n.streamType,pluginMimeType:n.pluginMimeType,streamUrl:n.mediaSource,mediaPlayerType:n.mediaPlayerType},i=n.getConvivaConfiguration(r),i.isEnabled){var s=new Mediasite.Player.ConvivaConfiguration.FlashVarsGenerator(i),f=s.getFlashVars(),e={plugin_Conviva:encodeURIComponent(getClientBinPath()+Mediasite.Player.Configurations.conviva.pluginPath)};pushFlashParamsIntoVarList(e),pushFlashParamsIntoVarList(f)}return u.join("&")}function addUnpausingVideoObject(){document.getElementById(f)||(t=makeFakeVideoObject(f),t.setAttribute("style","position:absolute; top:0; left:0; z-index:-999; width:100%; height:100%; opacity:0.01"),window.document.body.appendChild(t),window.setTimeout(removeUnpausingVideoObject,e))}function removeUnpausingVideoObject(){t&&window.document.body.removeChild(t)}function makeGeneralVideoObject(n,t,i){var r,f=getSwfPath();return isIELessThanNine()?(f+="?ie8-uniquify="+n,r=u('').get(0)):isIELessThanEleven()?r=u('').get(0):(r=document.createElement("object"),r.setAttribute("type","application/x-shockwave-flash"),r.setAttribute("data",f)),r.setAttribute("id",n),r.setAttribute("name",n),r.setAttribute("width","100%"),r.setAttribute("height","100%"),addParam(r,"flashvars",t),addParam(r,"allowFullScreen","false"),addParam(r,"wmode",i),addParam(r,"SCALE","exactfit"),r}function makeFakeVideoObject(n){var t,i;return t=makeGeneralVideoObject(n,"","direct"),t.setAttribute("style","position:absolute; top:0; left:0; z-index:-999; width:100%; height:100%; opacity:0.01"),t}function makeVideoObject(n,t){var i,u,r;return i=makeGeneralVideoObject(n,makeFlashVars(t),getWmodeValue()),i.setAttribute("class","MediaElement"),i}function addParam(n,t,i){var r=document.createElement("param");r.setAttribute("name",t),r.setAttribute("value",i),n.appendChild(r)}function isIELessThanEleven(){return parseInt(Mediasite.BrowserDetect.InternetExplorer())<11}function isIELessThanNine(){return parseInt(Mediasite.BrowserDetect.InternetExplorer())<9}function getWmodeValue(){var n=!!Mediasite.BrowserDetect.Firefox();return n||isIELessThanEleven()?"opaque":"direct"}function getSwfPath(){var n=r?"StrobeMediaPlayback.2.0.swf":"Javascript/ClientBin/StrobeMediaPlayback.2.0.swf";return getClientBinPath()+n}function getSSPluginPath(){var n=r?"MSAdaptiveStreamingPlugin-v1.0.12-osmf2.0.swf":"Javascript/ClientBin/MSAdaptiveStreamingPlugin-v1.0.12-osmf2.0.swf";return getClientBinPath()+n}function getClientBinPath(){var t,i="",n=u('script[src*="/Javascript"]').attr("src");return n&&(t=n.lastIndexOf("/Javascript"),i=n.substring(0,t)+"/"),i}var o,s,r=n&&n.isStandAlone?n.isStandAlone:!1,t,f,e,i;this.Wrapper=undefined,f="big_shy_swf",e=1e4,this.CreateMediaElement=function(t,r){var e;n.mediaContainer.find(".MediaWrapper").remove(),e=u('
').appendTo(n.mediaContainer),this.Wrapper=e;var o=u(n.backgroundElement.selector),s=o.css("background-color",o.css("background-color")).css("background-color"),f=makeVideoObject(t,r);return n.height&&n.width&&u(f).css({height:n.height,width:n.width}),e.append(f),i&&i.destroy&&i.destroy(),i=Mediasite.MediaPlayer.UserActivation.Create(this,n),Mediasite.BrowserDetect.Chrome()&&addUnpausingVideoObject(),u(f)},this.UpdateMediaInfo=function(n){n.AudioOnly&&o.css("height","0px")},this.SetIsStandAlone=function(n){r=n}},et=function(n){var u=1,i,r=!0;this.Reset=function(){r=!0,i=null},this.IsReady=function(){return r},this.TimeUpdateCalled=function(t){var f,e;i?t-i>u&&(f=n(),f&&(e=f.getState(),e=="playing"?r=!1:(e=="paused"||e=="buffering")&&(f.pause(),f.play2(),r=!1))):i=t}}},Mediasite.MediaPlayer.UserActivation.Register({mediaPlayerType:Mediasite.Player.MediaPlayerType.Flash,usable:function(){return Mediasite.BrowserDetect.Chrome()},constructor:function(n){function onLoadCheck(){isAvailable()?(r.Debug("Media element appears loaded"),markUsable(!0)):(enableUserActivation(),clearInterval(f),f=setInterval(onLoadCheck,c))}function enableUserActivation(){if(!u){u=!0,Mediasite.MediaPlayer.UserActivation.ShowPrompt({top:"50px"},onShowMessage);$(i).parent().on("click",stopPropagation);r.Debug("Showing click-me prompt")}}function onShowMessage(n){e=!0,r.Debug("Making media element clickable"),css=$.extend({},Mediasite.MediaPlayer.UserActivation.MediaElementCss,{position:"fixed"}),o=i.parentNode,$(i).appendTo(n).css(css)}function reset(){var t,n;if(clearTimeout(s),clearInterval(f),u&&e){u=!1,$(i).appendTo(o),Mediasite.MediaPlayer.UserActivation.RemovePrompt(),t={};for(n in css)css.hasOwnProperty(n)&&(t[n]="");$(i).css(t),r.Debug("Removed 'click-me'")}}function markUsable(n){n===void 0&&(n=!1),i.usable=n,n&&reset()}function isAvailable(){var n=!1;try{n=i&&i.getState&&typeof i.getState()=="string"}catch(t){}return n}function stopPropagation(n){n.stopPropagation()}var r=Mediasite.Logging.LoggerFactory("MediaPlayer UserActivation",{separator:" - "}),h=2e3,c=500,l="CTA-z-index",i=$(n).find("object")[0],s,f,a=0,u=!1,e=!1,o;markUsable(!1),s=setTimeout(function(){r.Debug("Checking if media element is available (first attempt)"),onLoadCheck()},h)}})