var xnum=1000;
var ynum=1;
function star()
{
	var obj = document.getElementById("dyPlay");
	//设置IP
	obj.ServerIP = "61.185.81.233";
	//设置端口
	obj.ServerPort = 8020;
	//设置设备号
	obj.SimOrNumber = "86201450050";
	//设置车牌
	obj.LicencePlate = "陕EA4971";
	//设置是否保存抓拍图片
	obj.IsCapturePictureSave = true;
	//设置是否兼容模式显示视频
	obj.IsCompatible = true;
	//设置保存路径
	obj.CapturePicturePath = "D:\\FileRecv\\";
	//设置下载录像路径
	obj.SDDownloadPath = "D:\\FileRecv\\";
	//连接服务端
	obj.StartConn();
}
var voiceStarbool = false;
function voiceStar(voiceCode,dataCode)
{
	if(voiceStarbool==true){
		//document.getElementById('videoiframe').contentWindow.closeplay();
		$("#video_main").html("");
	}else{
		document.getElementById('autoDir').style.display="none";
		xnum=15000;
		ynum=15;
		closeAlramMsg();
	}
	//document.getElementById("video").style.display="block"
	if(voiceCode.trim() != "" && dataCode.trim()!= ""){
		var str = voiceCode.trim()+" "+dataCode.trim();
		var arr = str.split(" ");
		var ip="";
		var port="";
		var num="";
		var licencePlate="";
		if(arr.length >= 4){
			for(var i=0;i<arr.length;i++){
				if(arr[i].substr(0,1)=="s"){
					ip=arr[i].substr(1,arr[i].length)
				}
				if(arr[i].substr(0,1)=="c"){
					port=arr[i].substr(1,arr[i].length)		
				}
				if(arr[i].substr(0,1)=="m"){
					num=arr[i].substr(1,arr[i].length)
				}
				if(arr[i].substr(0,1)=="u"){
					licencePlate=arr[i].substr(1,arr[i].length)
				}
			}
			//alert(ip+","+port+","+num+","+licencePlate);
			if(ip!="" && port != "" && num != "" && licencePlate !=""){
				voiceStarbool=true;
				document.getElementById("title_cp").innerHTML="视频监控 — "+licencePlate;
				document.getElementById("video").style.display="block";
				var Nums=""; 
				for(var i=0;i<6;i++) 
				{ 
					Nums+=Math.floor(Math.random()*10); 
				} 
				$("#video_main").html('<object id="dyPlay" classid="clsid:C37A731A-11E9-4fbb-913A-4C3679A42C46" style="height:425px;width:620px;font-size:13px;" > </object>');
				
				//window.open(url+"gpsonline/jsp/cmonitor/video.jsp?ip="+ip+"&port="+port+"&num="+num+"&licencePlate="+encodeURI(encodeURI(licencePlate))+"&Nums="+Nums,"videoiframe");	
				//$("#videoiframe").attr("src","");
				//$("#videoiframe").attr("src",url+"gpsonline/jsp/cmonitor/video.jsp?ip="+ip+"&port="+port+"&num="+num+"&licencePlate="+encodeURI(encodeURI(licencePlate))+"&Nums="+Nums);
				
				/*(function(){ 
					
					})(); 
				*/
					var dyPlay = document.getElementById("dyPlay");
					//设置IP
					dyPlay.ServerIP = ip;
					//设置端口
					dyPlay.ServerPort = port;
					//设置设备号
					dyPlay.SimOrNumber = num;
					//设置车牌
					dyPlay.LicencePlate = licencePlate;
					//设置是否保存抓拍图片
					dyPlay.IsCapturePictureSave = true;
					//设置是否兼容模式显示视频
					dyPlay.IsCompatible = true;
					//设置保存路径
					dyPlay.CapturePicturePath = "D:\\FileRecv\\";
					//设置下载录像路径
					dyPlay.SDDownloadPath = "D:\\FileRecv\\";
					//连接服务端
					dyPlay.StartConn();
				
				
			
			}else{
				alert("该设备数据不支持视频功能。");
			}
		}else{
			alert("该设备数据不支持视频功能。");
		}
	}else{
		alert("没有找到支持视频功能的数据。");
	}
	
}
function playclose(){
	voiceStarbool=false;
	dyPlay.DyPlayClose();
	$("#video_main").html("");
	//document.getElementById('videoiframe').contentWindow.closeplay();
	document.getElementById("video").style.display="none";
	document.getElementById('autoDir').style.display="block";
	xnum=1000;
	ynum=1;
	countDown();
	openAlramMsg();
}