var videoblock;
var recordblock;
//videoblock.setFdId(v_channel[0]).setChannelId(v_channel[1]).setHideTitle(v_channel[2]).startMonitor();
//实时播放视频组件
function initBlock(){
	var uuid = $.uniqueId();
	videoblock = $.videoBlock({
		uuid : uuid,
		title : "",
		$baseContainer : $("#video"),
		$content:$("#video"),
		serverConnection : top.serverConnection,
		monid : null,
		isRunning : false,
		onRightClick : $.noop()
	});
	BlockCacher.addBlock(videoblock);
	$("#video video").attr("id",videoblock.videoId);
	//console.log(videoblock);
}
function webrtc_startVideo(){
	var sbbh = "201805031342536402";
	var tdbh = "1";
	var tdmc = "TTTTTTTTTTT";
	console.log("TTTTTTTTTTTTTTTTT");
	console.log(videoblock);
	videoblock.setFdId(sbbh).setChannelId(tdbh).setHideTitle(tdmc).startMonitor();
}
//历史视频播放组件
function initRecordBlock(){
	var uuid = $.uniqueId();
	recordblock = $.recordblock({
		uuid : uuid,
		title : "",
		$baseContainer : $("#record"),
		$content:$("#record"),
		serverConnection : top.serverConnection,
		monid : null,
		isRunning : false,
		onRightClick : $.noop()
	});
	BlockCacher.addBlock(recordblock);
	$("#record video").attr("id",recordblock.videoId);
	//console.log(recordblock);
}
function webrtc_startRecord(){
	var sbbh = "201805031342536402";
	var tdbh = "1";
	var tdmc = "TTTTTTTTTTT";
	var playbackurl = "";
	var start_occur= "";
	var end_occur = "";
	var curDate = "2018-06-13 13:13:13";
	if($('#occurTime').html()){
		//curDate = $('#occurTime').html();
	}
	//console.log(sbbh+"=回放录像时间="+curDate);
	start_occur = start_occurTime(curDate);
	end_occur = end_occurTime(curDate);	
	recordblock.setFdId(sbbh).setChannelId(tdbh).setHideTitle(tdmc).startPlayback(start_occur ,0,end_occur,playbackurl,sbbh,tdbh,0);
}
//毫秒数转换
function timeChange(time){
	return Date.parse(new Date(time.replace(/-/g,"/")))/1000;
}
//事件开始事件，输入字符串时间前10秒
function start_occurTime(time){
	var dt=new Date(time.replace(/-/g,"/"));//将传入的日期格式的字符串转换为date
	var ndt=new Date(dt.getTime()-10000);//将转换之后的时间减去十秒
	//console.log('开始时间为：',ndt);
	return Date.parse(ndt)/1000;
}
//事件开始事件，输入字符串时间后10秒
function end_occurTime(time){
	var dt=new Date(time.replace(/-/g,"/"));//将传入的日期格式的字符串转换为date
	var ndt=new Date(dt.getTime()+10000);//将转换之后的时间减去十秒
	//console.log('结束时间为：',ndt);
	return Date.parse(ndt)/1000;
}
//201805181435393902","1"
function RMap(){
	
}
RMap.init = function(){
	RMap();
}
RMap.ShowMsg = function(msg) {
	var type = "info";
    var $tip = $('#tip');
    if ($tip.length == 0) {
        $tip = $('<strong id="tip"></strong>');
        $('body').append($tip);
    }
    $tip.stop(true).prop('class', 'hint-tip alert alert-' + type).text(msg).
    fadeIn(500).delay(2000).fadeOut(500);
}