//ActiveX Object Defines
var AXOBJECT_ID = "AxVideoView";
var AXOBJECT_PATH = "AxViewer/";
var AXOBJECT_NAME = "AxVideoView.cab";
var AXOBJECT_VER = "1,2,4,55";
var CLASS_ID = "0C71BDAA-5B30-4E12-A317-D225FEB9A068";
var user = SendCGICMD("/cgi-bin/view/hello");
var TEMP_USER_NAME = GetQueryVariableEx2("UserName", user);
var TEMP_PASSWORD = GetQueryVariableEx2("Password", user);
// do NOT change these two lines
//var GET_USER_NAME = "";
//var GET_PASSWORD = "";
// do NOT change these two lines
//Video Stream Defines
var RTSP_SUPPORT = "1";
var PROTOCOL_TYPE = "3"; //(set as cookie on client PC) 1->TCP, 2->UDP, 3->HTTP 4->Multicast ,default connect order TCP->UDP->HTTP
var g_szProtocolType = "3";
var MPEG4_ACCESS_NAME = "video.mp4";
var MJPEG_ACCESS_NAME = "video.mjpg";
var MULTICAST_ACCESS_NAME = "multicast.mp4";
var RECORDER_SUPPORT = "1";
var VIDEO_FMT=1;
var PLUGIN_LANG=getLanguage();
var INITMODE = "Player";
var VIEW_SIZE = "Medium";
var Buffer_Enable = getBufferEn();
var _platform = navigator.platform;
var objectID="AxViewer"; //"AxViewer", "ObjJavaCam", "jpeg"
var _browser=navigator.appName;
function Viewer()
{
//vincent debug
if(_platform.toLowerCase().indexOf("mac") >= 0)
//if(1)
{
if(INITMODE == "MotionDetect")
{return;/*AppletWidth=640;AppletHeight=360;vdoWidth=480;vdoHeight=360;*/}
else if(INITMODE == "PrivateMask")
{return;/*AppletWidth=480;AppletHeight=360;vdoWidth=480;vdoHeight=360;*/}
else
{
if(VIEW_SIZE == "Large")
{AppletWidth=640;AppletHeight=(480+58);vdoWidth=640;vdoHeight=480;}
else if(VIEW_SIZE == "Medium")
{AppletWidth=320;AppletHeight=(240+58);vdoWidth=320;vdoHeight=240;}
else
{AppletWidth=320;AppletHeight=315;}
}
objectID = "ObjJavaCam";
document.writeln('');
document.close();
}
else if(_browser.toLowerCase().indexOf("microsoft internet explorer") >= 0)
{
objectID="AxViewer";
document.open();
document.write("");
document.close();
}
else// if(_platform.toLowerCase().indexOf("iphone") >= 0)
//else if(1)
{
if(INITMODE == "MotionDetect")
{return;/*AppletWidth=640;AppletHeight=360;vdoWidth=480;vdoHeight=360;*/}
else if(INITMODE == "PrivateMask")
{return;/*AppletWidth=480;AppletHeight=360;vdoWidth=480;vdoHeight=360;*/}
else
{
document.open();
document.write("");
document.close();
refreshImg();
}
objectID = "jpeg";
}
}
function NormalViewer(width,height)
{
if(_platform.toLowerCase().indexOf("mac") >= 0)
{
if(INITMODE == "MotionDetect")
{AppletWidth=640;AppletHeight=360;vdoWidth=480;vdoHeight=360;}
else if(INITMODE == "PrivateMask")
{AppletWidth=480;AppletHeight=360;vdoWidth=480;vdoHeight=360;}
else
{
if(VIEW_SIZE == "Large")
{AppletWidth=640;AppletHeight=555;vdoWidth=640;vdoHeight=480;}
else if(VIEW_SIZE == "Medium")
{AppletWidth=320;AppletHeight=315;vdoWidth=320;vdoHeight=240;}
else
{AppletWidth=320;AppletHeight=315;}
}
objectID = "ObjJavaCam";
document.writeln('');
document.close();
}
else if(_browser.toLowerCase().indexOf("microsoft internet explorer") >= 0)
{
objectID="AxViewer";
document.open();
document.write("");
document.write("");
document.close();
}
else //if(_platform.toLowerCase().indexOf("iphone") >= 0)
//else if(1)
{
objectID = "jpeg";
if(INITMODE == "MotionDetect")
{return;/*AppletWidth=640;AppletHeight=360;vdoWidth=480;vdoHeight=360;*/}
else if(INITMODE == "PrivateMask")
{return;/*AppletWidth=480;AppletHeight=360;vdoWidth=480;vdoHeight=360;*/}
else
{
document.open();
document.write("");
document.close();
refreshImg();
}
}
}
function onAxobjUnload()
{
if(objectID == "AxViewer")
{
if(AxVideoView.InitMode)
{
setProtocol(AxVideoView.GetProtocol());
AxVideoView.AVConnect(0);
AxVideoView.VideoStart(0);
AxVideoView.AudioStart(0);
AxVideoView.TalkEnable(0);
}
}
}
// This function refreshes jpeg images
var mydate = new Date();
var newimg = new Image();
function refreshImg() {
var imgObj = document.getElementById('jpeg');
var newURL;
if (imgObj) {
newURL = "/jpg/image.jpg?" + (new Date()).getTime();
newimg.src = newURL;
newimg.onload=refreshImg;
newimg.onerror=refreshImg;
imgObj.src = newURL;
}
}