var OpenFileDlgType = 0;
//当前下载的文件名称
var downloadFileName="";

//插件加载完毕后,会执行初始化化操作
$(function () {

	WebVideoCtrl.insertPluginObject("divPlugin",500,300);
	//初始化插件
	WebVideoCtrl.initPlugin(function () {
			//设置视频窗口的显示[1:1x1;2:2*2;3:3*3;4:4*4]
			var num = 1;
			//设置窗口分割数
			WebVideoCtrl.setSplitNum(num);
			//设置双击可全屏功能
			WebVideoCtrl.enablePreviewDBClickFullSreen(true);
		}
	);
	//alert("模板解析事件");
	$.ajax({
		type : "GET",
		url : "/skboot/sys/video/getVideoIntegrateInfo",
		success : function(obj) {
			var result = obj.result;
			var ip = result.ip;
			var port = result.port;
			var username = result.username;
			var password = result.password;
			//调用登陆逻辑
			autoLogin(ip,port,username,password,0);
		}
	});

});
//自动登录
function autoLogin(ip,port,username,password,protocol)
{
	//判断当前设备是否已经登录
	var ret = WebVideoCtrl.login(ip,port,username,password,0);
	if(ret!=0)
	{
		alert("视频服务登录异常: "+ret);
		return;
	}
}
function showVideo(channelNum){
	var channelVal = $("#channelNum").val();
	WebVideoCtrl.connectRealVideo(channelVal,1);
}