
/* - stb_amino.js - */
// http://www.vario.tv/portal_javascripts/stb_amino.js?original=1
var RMT_MENU=1073742148;var RMT_PGUP=1073742157;var RMT_PGDN=1073742158;var RMT_PGBCK=1073742143;var RMT_PGFWD=1073742140;var RMT_GUIDE=1073742147;var RMT_INFO=1073742146;var RMT_EXIT=1073742146;var RMT_0=48;var RMT_1=49;var RMT_2=50;var RMT_3=51;var RMT_4=52;var RMT_5=53;var RMT_6=54;var RMT_7=55;var RMT_8=56;var RMT_9=57;var RMT_TOOLS=1073742144;var RMT_ENTER=1073741828;var RMT_LEFT=1073741840;var RMT_RIGHT=1073741841;var RMT_UP=1073741838;var RMT_DOWN=1073741839;var RMT_CHUP=1073742124;var RMT_CHDN=1073742126;var RMT_GREEN=1073742145;var RMT_RED=1073742144;var RMT_REWIND=1073742134;var RMT_FFWD=1073742132;var RMT_PAUSE=1073742136;var RMT_REFRESH=1073742138;var RMT_PLAY=1073742131;var RMT_STOP=1073742133;var RMT_LAST_CH=1073741827;
function STB_Initialize(box){}
function STB_GetManufacturer(box){var sn=ASTB.GetSystemManufacturer();return sn}
function STB_GetModel(box){var sn=ASTB.GetSystemModel();return sn}
function STB_GetSerialNumber(box){var sn=ASTB.GetSerialNumber();return sn}
function STB_GetVersion(box){var version=ASTB.GetSoftwareVersion()+" | "+ASTB.GetHardwareVersion();return version}
function STB_GetMACAddress(box){return top.ASTB.GetMacAddress()}
function STB_MapSpecialKeys(box,menuKey){top.ASTB.SetKeyFunction(menuKey,1);top.ASTB.SaveKeyFunctions()}
function STB_GetEvent(box,e){return e.which}
function STB_StopEventPropagation(box,e){}
function STB_ClearEventHandler(box){top.AVMedia.onEvent=""}
function STB_GetProtocol(box){var p=top.AVMedia.GetProtocol();if(p==null) p='';return p}
function STB_GetRTSPPosition(box){return top.AVMedia.GetPosition()}
function STB_SetRTSPPosition(box,pos){top.AVMedia.SetPosition(pos)}
function STB_SetFullScreenMode(box,width,height){top.VideoDisplay.SetPIG(0)}
function STB_StartRTSP(box,url,offset){top.AVMedia.Play('type=VOD;servertype=MediaBase;src='+url+';unloadvideo=yes;');if(offset>0) top.STB_SetRTSPPosition(box,offset)}
function STB_StartMusicStream(box,url,offset){top.STB_TeardownRTSP(box);top.AVMedia.Play('servertype=MediaBase;src='+url+';type=mp3;')}
function STB_RTSPPlay(box,position){top.AVMedia.Continue()}
function STB_RTSPStop(box){top.AVMedia.Stop()}
function STB_TeardownRTSP(box){top.AVMedia.Kill()}
function STB_TeardownIGMP(box){top.AVMedia.Kill()}
function STB_RTSPPause(box){top.AVMedia.Pause()}
function STB_RTSPRewind(box,rate){top.AVMedia.SetSpeed(-rate)}
function STB_RTSPFastForward(box,rate){top.AVMedia.SetSpeed(rate)}
function STB_HideBrowser(box){top.VideoDisplay.IgnoreUpdates(1)}
function STB_ShowBrowser(box){top.VideoDisplay.IgnoreUpdates(0)}
function STB_HandleEOS(box){top.AVMedia.onEvent="top.STB_HandleAminoEOS()"}
function STB_HandleAminoEOS(){if(top.AVMedia.Event==8||top.AVMedia.Event==11){top.content_frame.OnMovieEnd()}}
function STB_HandleRTSPFailOver(box){top.AVMedia.onEvent="top.STB_HandleAminoRTSPFailOver()"}
function STB_HandleAminoRTSPFailOver(){if(top.AVMedia.Event==8||top.AVMedia.Event==11){top.content_frame.OnMovieEnd()}
else if(top.AVMedia.Event==1||top.AVMedia.Event==2||top.AVMedia.Event==3||top.AVMedia.Event==4||top.AVMedia.Event==9||top.AVMedia.Event==12){top.content_frame.OnFailure()}}
function STB_HandleAminoForRTSPAutoLoop(url,screenWidth,screenHeight){if(top.AVMedia.Event==8){top.VideoDisplay.SetPIG(1,2,screenWidth-480,screenHeight-50);top.AVMedia.Play('type=VOD;servertype=MediaBase;src='+url)}}
function STB_HandleAminoForRTSPAutoLoopFlash(url,x,y){if(top.AVMedia.Event==8){top.VideoDisplay.SetPIG(1,2,x,y);top.AVMedia.Play('type=VOD;servertype=MediaBase;src='+url)}}
function STB_ShowRandomPreview(box,url,mediaPass,screenWidth,screenHeight){top.VideoDisplay.SetPIG(1,2,screenWidth-480,screenHeight-50);if(mediaPass!="")
top.STB_StartSecureMediaRTSP(box,url,mediaPass,0);else
top.STB_StartRTSP(box,url,0);AVMedia.onEvent="top.STB_HandleAminoForRTSPAutoLoop('" + url + "', "+screenWidth+", "+screenHeight+");"}
function STB_ShowRandomPreviewFlash(box,url,mediaPass,screenWidth,screenHeight){top.AVMedia.Kill();var x=screenWidth-290;var y=screenHeight-130;top.VideoDisplay.SetPIG(1,2,x,y);if(mediaPass!="")
top.STB_StartSecureMediaRTSP(box,url,mediaPass,0);else
top.STB_StartRTSP(box,url,0);AVMedia.onEvent="top.STB_HandleAminoForRTSPAutoLoopFlash('" + url + "', "+x+", "+y+");"}
function STB_ShowMulticastInEPG(box,url,screenWidth,screenHeight,multicastFlag){top.AVMedia.Kill();top.VideoDisplay.SetPIG(1,2,0,screenHeight+50);top.AVMedia.Play('src='+url)}
function STB_ShowScaledTV(box,url,X,Y,multicastFlag){top.VideoDisplay.SetPIG(1,2,X-270,Y-100);top.AVMedia.Play('src='+url)}
function STB_JoinIGMP(box,url,multicastFlag){top.AVMedia.Play('src='+url)}
function STB_HandleKeyAction(box,action,d){d.onkeypress=action}
function STB_SetAlphaLevel(box,alpha){top.VideoDisplay.SetAlphaLevel(alpha)}
var currentPIDIndex=0;
function STB_SwitchToNextAudio(box,dir){var list=top.AVMedia.GetAudioPIDs();var n=list.pids;if(n<=1) return;if(dir==0){currentPIDIndex++;if(currentPIDIndex>n) currentPIDIndex=1}
else if(dir==1){currentPIDIndex--;if(currentPIDIndex<=0) currentPIDIndex=n}
var pid=list[currentPIDIndex].AudioPID;var lang=list[currentPIDIndex].AudioLanguage;top.AVMedia.SetAudioPID(pid);top.AudioControl.SetAudioMix("right")}
function STB_CreateListener(box,mcastIP,mcastPort){var handle=-1;top.AminoGeneric.onEvent13=Callback;return handle}
function STB_GetCallbackData(box,msg,handle){return msg}
var sm_url="";var sm_offset=0;
function e_Amino_SM_Play(url){setTimeout("top.STB_StartRTSP('Amino', sm_url, sm_offset);",100)}
function STB_StartSecureMediaRTSP(box,url,mediaPass,offset){var SM=22;sm_url=url;sm_offset=offset;top.AminoGeneric.onEvent22=top.e_Amino_SM_Play;var msg="cmd=pmp&mp="+encodeURIComponent(mediaPass)+"&";top.AminoGeneric.Call(SM,msg)}
function STB_SecureMediaRegister(box,mac,url){var SM=22;try{var msg="cmd=check_status";r=top.AminoGeneric.Call(SM,msg);if(r=="yes"||r=="ok"||r=="success"||r=="YES"||r=="OK"||r=="SUCCESS") return true;msg="cmd=register&sn="+mac+"&ainfo="+mac+"&surl="+url;r=top.AminoGeneric.Call(SM,msg);if(r!="yes"&&r!="ok"&&r!="success"&&r!="YES"&&r!="OK"&&r!="SUCCESS"){alert("SecureMedia Registration Failed!!\r\n"+r);return false}
else{msg="cmd=start&huid="+mac;top.AminoGeneric.Call(SM,msg)}}
catch(e){}
return true}
function STB_IsPVRSupported(box){var retVal=false;var sm=top.ASTB.GetSystemModel();if(sm.indexOf('500')>=0) retVal=true;return retVal}
function STB_StartPVR(box,name,offset){if(!top.STB_IsPVRSupported(box)) return;var list=top.STB_ListRecordings(box);var n=list.Assets;for(i=1;i<=n;i++){if(list[i].Name==name){top.AVMedia.Play(list[i].URL);if(offset>0) top.STB_SetPVRPosition(box,offset);return}}}
function STB_PVRPlay(box,position){if(!top.STB_IsPVRSupported(box)) return;top.AVMedia.Continue();if(position!=-1) top.STB_SetPVRPosition(box,position)}
function STB_PVRStop(box){if(!top.STB_IsPVRSupported(box)) return;top.AVMedia.Stop()}
function STB_PVRPause(box){if(!top.STB_IsPVRSupported(box)) return;top.AVMedia.Pause()}
function STB_PVRRewind(box,rate){if(!top.STB_IsPVRSupported(box)) return;top.AVMedia.SetSpeed(-rate)}
function STB_PVRFastForward(box,rate){if(!top.STB_IsPVRSupported(box)) return;top.AVMedia.SetSpeed(rate)}
function STB_GetPVRPosition(box){if(!top.STB_IsPVRSupported(box)) return;return top.AVMedia.GetPosition()}
function STB_SetPVRPosition(box,pos){if(!top.STB_IsPVRSupported(box)) return;top.AVMedia.SetPosition(pos)}
function STB_StartRecording(box,name,ip,port,duration){if(!top.STB_IsPVRSupported(box)) return;var url="src=igmp://"+ip+":"+port;top.PVR.Record(url,name);top.PVR.Record(url,name)}
function STB_StopRecording(box,name){if(!top.STB_IsPVRSupported(box)) return;top.PVR.StopRecording()}
function STB_DeleteRecording(box,name){if(!top.STB_IsPVRSupported(box)) return;top.PVR.DeleteAsset(name)}
function STB_ListRecordings(box){if(!top.STB_IsPVRSupported(box)) return;return top.PVR.ListAssets()}
function STB_ShowMousePointer(box){top.ASTB.SetMouseState(true)}
function STB_HideMousePointer(box){top.ASTB.SetMouseState(false)}
function STB_ShowToolbar(box){top.Browser.SetToolbarState(1)}
function STB_HideToolbar(box){top.Browser.SetToolbarState(0)}
function STB_SetChromaKey(box,color){top.VideoDisplay.SetChromaKey(color)}
function STB_IsIgnoreUpdatesSupported(box){var retVal=true;var sm=top.ASTB.GetSystemModel();if(sm.indexOf('124')>=0) retVal=false;return retVal}

