var winId	= $.getUrlParam("winId");
var videodata = top.$("#"+winId).panel("options").data;

$(function(){
	console.log("videodata: ",videodata);

//	var countdate = videodata.countdate;
//	var startTime = countdate + " 00:00:00";
//	var endTime = countdate + " 23:59:59";
	var curdate = $('#searchDate').val();
	var startTime = curdate + " 00:00:00";
	var endTime = curdate + " 23:59:59";
	
	(window !== top.WebRtcServer.reqPage) && top.WebRtcServer.setReqPage(window);
	//初始化视频播放控件
//	initBlock();
	
	initRecordBlock();
	barInit(startTime,endTime);
	
	// 播放录像
	webrtc_startRecord(videodata.videonum, videodata.channelnum, videodata.channelname, startTime, endTime);
	// 测试
//	webrtc_startRecord("201808091236525951", "1", "窗口高架_01", "2018-12-13 00:00:00", "2018-12-13 23:59:59");
	
	
	
	// 点击查询录像
	$('#searchVideo').click(function(){
		closeRecordvideo();
		var serdate = $('#searchDate').val();
		var start = serdate + " 00:00:00";
		var end = serdate + " 23:59:59";
/*		var start ="00:10:50";
		var end ="00:11:50";*/
		barInit(start,end);
		webrtc_startRecord(videodata.videonum, videodata.channelnum, videodata.channelname, start, end);
		
	});
	
	
});

function barInit(start, end){
	ProgressBar.init({
		startTime:new Date(start),
		endTime:new Date(end),
		totalSecond:86400
	});
}



