var isInitFinished=false;//是否加载完视频插件???
|
var swfwidth=0;//swf插件窗口宽度
|
var swfheight=0;
|
var PlateNum=0; //url中车牌号
|
var chnCount = 1;//通道数量
|
var maxChnCount = 1; //最大窗口数
|
var loginServer = null;
|
var isLoadLoginServer = false;
|
var jsession="";
|
var devIdno="";// 车辆对应设备号
|
var vehiIdno = ""; //车牌号
|
var isShowResidualSeconds=false; //是否显示视频播放剩余秒数
|
var radioFileLocation=1;//视频文件位置 1为终端设备,2为储存服务器 ,4为下载服务器
|
var closeSecond = 3*60;//自动关闭视频秒数
|
var stopIndex = 0;
|
var lang = new langZhCn();
|
var IsSearching=false;
|
var videoFileList = new Hashtable(); //视频文件列表
|
var host=window.location.host;
|
var ip_="";
|
var port_="6605";//平台登录验证端口号
|
var serverIp="";
|
var serverPort="";
|
var queryVehicleChannels = new Array();//Find the vehicle channel
|
var channels=null;
|
|
function langZhCn() {
|
this.loginError = "登陆失败";
|
this.jsessionError = "会话号不存在";
|
this.deviceNoExist = "找不到车辆信息";
|
this.errorVideoDevice = "这个设备不是视频设备";
|
this.vehicleNotOperate = "没有车辆或者设备操作权限";
|
this.closeTip = "秒后关闭视频";
|
this.quering="正在查询…";
|
this.VideoQueryPrompt="未查到相关录像结果!";
|
this.query="查询";
|
this.ServerQueryPrompt="相关服务器信息查询失败!";
|
this.allowed="该浏览器是否设置了允许的弹出框!";
|
this.NullVideoFileInfo = "无视频文件信息!";
|
this.optionTips = "必须选择摄像头!";
|
this.operator = "操作";
|
this.begintime = "开始时间";
|
this.endtime = "结束时间";
|
this.duration = "持续时间";
|
this.date = "日期";
|
this.realtimeVideo = "实时视频";
|
this.replayVideo = "历史视频";
|
this.channel = "通道";
|
this.download="下载";
|
this.video_playback="回放";
|
this.Normal="常规";
|
this.Alarm="报警";
|
this.Device="设备";
|
this.StorageServer="储服务器";
|
this.DownloadServer="下载服务器";
|
this.searchEnded = "搜查完毕";
|
this.errorGetVideoFile = "获取视频文件信息失败!";
|
this.deviceNotOnline= "设备不在线!";
|
this.segment = "分段";
|
this.segemenDownloadSuccess = '保存成功';
|
this.segemenDownloadFail = '下载任务已经存在';
|
|
|
this.setParam = "分段下载参数设置";
|
this.savaParam = "确认参数";
|
this.endTimeBigStartTime = "结束时间不小于开始时间";
|
this.beginInfoErro = "开始时间范围";
|
this.endInfoErro = "结束时间范围";
|
|
|
|
|
}
|
|
function langEn() {
|
this.loginError = "Login failed";
|
this.jsessionError = "Jsession error";
|
this.deviceNoExist = "Can't not find vehicles";
|
this.vehicleNotOperate = "No vehicle or device operating authority";
|
this.errorVideoDevice = "This device is not video device";
|
this.closeTip = " seconds later close video"
|
this.quering="quering...";
|
this.VideoQueryPrompt="Related video results were not found!";
|
this.query="query";
|
this.ServerQueryPrompt="Related server information query failed!";
|
this.allowed="Does this browser set the allowed pop up box!";
|
this.NullVideoFileInfo = "No video file information!";
|
this.optionTips = "Select one camara at least!";
|
this.operator = "operator";
|
this.begintime = "start";
|
this.endtime = "ended";
|
this.duration = "duration";
|
this.date = "Date";
|
this.realtimeVideo = "Realtime Video";
|
this.replayVideo = "Replay Video";
|
this.channel = "channel";
|
this.download="Download";
|
this.video_playback = "PlayBack";
|
this.Normal="Normal";
|
this.Alarm="Alarm";
|
this.Device="Device";
|
this.StorageServer="StorageServer";
|
this.DownloadServer="DownloadServer";
|
this.searchEnded = "Search ended";
|
this.errorGetVideoFile = "Failed to obtain video file information!";
|
this.deviceNotOnline= "The device isn't online!";
|
this.segment = "Segment";
|
this.segemenDownloadSuccess = 'Save success';
|
this.segemenDownloadFail = 'Download task already exists';
|
this.setParam = "Download Parameters";
|
this.savaParam = "Save";
|
this.endTimeBigStartTime = "End time is not less than the start time";
|
this.beginInfoErro = "Start time range";
|
this.endInfoErro = "End time range";
|
|
|
}
|
|
|
$(document).ready(function () {
|
var host = window.location.host;
|
ip_ = host.split(":")[0];
|
if(!ip_|| ip_ == 'localhost') {
|
ip_ = '127.0.0.1';
|
}
|
if (getUrlParameter("lang") == "en") {
|
lang = new langEn();
|
}
|
|
// alert("host1:"+host1+"\n href1:"+href1+"\n pathname1:"+pathname1+"\n documentURL1:"+documentURL1+"\n search1:"+search1);
|
//加载搜索栏信息
|
$("#closeTip").hide();
|
$("#time").val(dateCurrentDateString());//(datatime.getFullYear()+"-"+(datatime.getMonth()+1)+"-"+datatime.getDate()
|
$("#time").click(function(){WdatePicker({lang:"zh",dateFmt:'yyyy-MM-dd'}); });//去HH:mm:ss
|
$("#query").val(lang.query);
|
$('#labelTime').text(lang.date);
|
$('#current').next().text(lang.realtimeVideo);
|
$('#history').next().text(lang.replayVideo);
|
$('#labelChn').text(lang.channel);
|
$("#query").click(function(){
|
videoFileList.clear();
|
getChns();
|
Search();
|
});
|
|
//加载页面
|
loadPage();
|
//配置车辆信息
|
$('#videoTitle').val(vehiIdno);
|
});
|
|
function loadPage(){
|
setPanelWidth();
|
//加载报表
|
loadTable();
|
//载入视频插件
|
initPlayer();
|
//获取车牌号
|
vehiIdno=decodeURIComponent(getUrlParameter("PlateNum"));
|
if(!vehiIdno ) {//为空
|
alert(lang.deviceNoExist);
|
return;
|
}
|
// callcackFn();
|
login();
|
}
|
|
//加载报表
|
function loadTable(){
|
$('#videoInfoTable').flexigrid({
|
// url:'TestAction_loadEmployees.action',
|
dataType:'json',
|
colModel:[
|
{display: lang.operator, name : 'operator', width : 100, sortable : false, align: 'center' , hide : false},
|
{display: lang.fileIndex, name : 'fileIndex', width : 40, sortable : false, align: 'center' , hide : true},
|
{display: lang.fileTime, name : 'fileTime', width : 150, sortable : false, align: 'center' , hide : true},
|
{display: lang.Type, name : 'type', width : 80, sortable : false, align: 'center' , hide : true},
|
{display: lang.spanDevice, name : 'vehiIdno', width : 100, sortable : false, align: 'center' , hide : true},
|
/*{display: lang.vehiChn, name : 'vehiChn', width : 70, sortable : false, align: 'center' , hide : true},*/
|
{display: lang.loc, name : 'loc', width : 80, sortable : false, align: 'center' , hide : true},
|
{display: lang.fileSize, name : 'fileSize', width : 80, sortable : false, align: 'center' , hide : true},
|
{display: lang.file ,name: 'file', width : 380,sortable : false, align: 'center' , hide : true},
|
{display: 'svr' ,name: 'svr',hide : true},
|
{display: 'devIdno' ,name: 'devIdno',hide : true },
|
{display: 'len' ,name: 'len',hide : true},
|
{display: 'chnMask' ,name: 'chnMask',hide : true},
|
// {display: 'beg' ,name: 'beg',hide : true},
|
// {display: 'end' ,name: 'end',hide : true},
|
{display: lang.begintime, name : 'beg', width : 100, sortable : false, align: 'center', hide: false},
|
{display: lang.endtime, name : 'end', width : 100, sortable : false, align: 'center', hide: false},
|
{display: lang.duration, name : 'duration', width : 100, sortable : false, align: 'center', hide: false},//结束-开始
|
{display: lang.channel, name: 'vehiChn', width : 63 , sortable : false, align:'center', hide:false}//摄像头=通道+1;
|
],
|
|
usepager: false,
|
autoload: false,
|
useRp: false,
|
singleSelect: true,
|
clickRowCenter: true,
|
onDoubleClick: function(obj,event) {
|
doubleClickVideoReplay(obj,event);
|
},
|
rp: 15,
|
showTableToggleBtn: false,
|
showToggleBtn: false,
|
width: 'auto',
|
height: 'auto',
|
resizable: false,
|
|
});
|
|
loadReportTableWidth(fixFun);
|
|
//配置
|
$("#videoInfoTable").flexSetFillCellFun(function(p, row, idx, index) {
|
return fillVideoFileTable(p, row, idx, index);
|
});
|
}
|
|
/*
|
* Fill in the video file list
|
*/
|
function fillVideoFileTable(p, row, idx, index) {
|
var name = p.colModel[idx].name;
|
var ret = "";
|
if(name == 'fileIndex') {
|
ret = row.id + 1;
|
} else if(name == 'fileTime') {
|
var fileRealDate = getFileTime(row.year, row.mon, row.day);
|
var relBeg = row.beg;
|
var relEnd = row.end;
|
var beginDate = fileRealDate +' '+ second2ShortHourEx(row.beg);
|
var endDate = fileRealDate +' '+ second2ShortHourEx(row.end);
|
var timeTitle = row.beginDate + ' - ' + second2ShortHourEx(row.end);
|
ret=timeTitle;
|
} else if(name == 'vehiIdno') {
|
ret = row.vehiIdno;
|
}else if(name == 'type') {
|
if(row.type=="0"){
|
ret=lang.Normal;
|
}else{
|
ret=lang.Alarm;
|
}
|
}else if(name == 'vehiChn') {
|
ret = row.chnName;
|
}else if(name == 'loc') {
|
if(row.loc == 1) {
|
ret = lang.Device;
|
}else if(row.loc == 2) {
|
ret = lang.StorageServer;
|
}else if(row.loc == 4) {
|
ret = lang.DownloadServer;
|
}
|
} else if(name == 'fileSize') {
|
ret = (row.len/1024/1024).toFixed(2) + 'MB' ;
|
} else if(name == 'file') {
|
ret = row.file;
|
}
|
else if(name == 'operator') {
|
ret = '<a class="downLoad" href="javascript:downloadVideoFile('+row['id']+');" title="'+lang.download+'"></a>';
|
ret += '<a class="segDownLoad" href="javascript:doSegementDownloadServer('+row['id']+');" title="'+lang.segment+lang.download+'"></a>';
|
ret += '<a class="playback" href="javascript:videoFileReplay(this,'+row['id']+');" title="'+lang.video_playback+'"></a>';
|
return ret;
|
}
|
else if(name == 'svr'){
|
ret=row.svr;
|
}else if(name == 'devIdno'){
|
ret=row.devIdno;
|
}else if(name == 'len'){
|
ret=row.len;
|
}else if(name == 'chnMask'){
|
ret=row.chnMask;
|
}else if(name == 'end'){
|
ret=second2ShortHourEx(row.end);
|
}else if(name == 'beg'){
|
ret=second2ShortHourEx(row.beg);
|
}else if(name == 'duration'){
|
ret=second2ShortHourEx(row.end-row.beg);
|
}
|
|
return ret;
|
};
|
|
function fixFun(){
|
var width = $(window).width();
|
var height = $(window).height();
|
//不能少于1024
|
if(width < 1024) {
|
width = 1024;
|
}
|
|
if(getTop($('.queryGraph-render').get(0)) == 0 || getTop($("#container").get(0)) != 0) {
|
height = height - getTop($('.flexigrid .bDiv').get(0)) - $('.flexigrid .pDiv').height() - 10-24;//
|
}
|
if(getTop($('.queryGraph-render').get(0)) != 0) {
|
height = height - getTop($('.flexigrid .bDiv').get(0)) - $('.flexigrid .pDiv').height() - 10-24;
|
}
|
height = height < 0 ? 0 : height;
|
$('.flexigrid .bDiv').height(height);
|
}
|
|
|
|
//如果传入了用户名和密码,则继续加载信息
|
function login() {
|
var account = getUrlParameter("account");
|
var password = getUrlParameter("password");
|
var param = [];
|
param.push({name: 'account', value: account});
|
param.push({name: 'password', value: password});
|
|
doAjaxSubmit('StandardApiAction_login.action', param, function(json, action, success) {
|
if(success) {
|
//获取到会话号
|
jsession = json.jsession;
|
// //取得会话号则搜索车牌的对应设备号
|
loadDeviceInfo();
|
|
}else {
|
alert(lang.loginError);
|
}
|
});
|
}
|
|
//如果传入设备号,则直接判断设备号;
|
//如果没传入设备号,则判断传入的车牌号
|
//根据设备号或者车牌号获取设备信息,并判断是否有效和是否视频设备
|
//获取设备通道
|
//实时视频用
|
function loadDeviceInfo() {
|
var param = [];
|
param.push({name: 'jsession', value: jsession});
|
param.push({name: 'vehiIdno', value: vehiIdno});
|
this.doAjaxSubmit('StandardApiAction_getVideoDevice.action', param, function(json, action, success) {
|
if(success) {
|
//不是视频设备
|
if(!json.isVideoDevice) {
|
alert(lang.errorVideoDevice);
|
}else {
|
devIdno = json.devIdno;
|
chnCount = json.chnCount;
|
//加载通道选择框
|
loadChannels();
|
}
|
}else {
|
//没有操作权限
|
if(json) {
|
if(json.result == 5) {
|
alert(lang.jsessionError);
|
}else if(json.result == 8) {
|
alert(lang.vehicleNotOperate);
|
}else {
|
alert(lang.deviceNoExist);
|
}
|
}else {
|
alert(lang.deviceNoExist);
|
}
|
}
|
});
|
}
|
|
|
function loadChannels(){
|
for(var i=0;i<chnCount;i++){
|
if(i==5){
|
$('#channels').append('<input id="channel'+(i+1)+'" type="checkbox" name="channel" value="'+i+'" checked/>'
|
+'<span id="labelChannel'+(i+1)+'" class="labelChannel">'+(i+1)+'</span></br>');
|
}else{
|
$('#channels').append('<input id="channel'+(i+1)+'" type="checkbox" name="channel" value="'+i+'" checked/>'
|
+'<span id="labelChannel'+(i+1)+'" class="labelChannel">'+(i+1)+'</span>');
|
}
|
}
|
}
|
|
//
|
function loadAgain(){
|
setPanelWidth();
|
loadReportTableWidth(fixFun);
|
}
|
|
function Search(){
|
if(IsSearching==true){
|
return;
|
}
|
if(getChns().length<1){
|
alert(lang.optionTips);
|
return;
|
}
|
IsSearching=true;
|
$("#query").val(lang.quering);
|
var number=vehiIdno;
|
var id=devIdno;
|
var radioFileType=2;//文件类型 2表示录像。
|
var radioVideoType= -1;//录像类型 0表示常规,1表示报警,-1表示所有。
|
var beginstr =$("#time").val()+" "+"00:00:00";
|
var str=beginstr.split(" ");
|
var begstr = beginstr.replace(/-/g,"/");
|
var begdate = new Date(begstr);
|
var date=str[0].split("-");
|
var y = date[0].toString(); // year
|
var m = date[1].toString(); // month
|
var d = date[2].toString(); // day
|
var endstr =$("#time").val()+" "+"23:59:59";
|
endstr = endstr.split(" ");
|
var beg=shortHour2Second(str[1].toString());
|
var end=shortHour2Second(endstr[1].toString());
|
var param = [];
|
param.push({name: 'MediaType', value: 2});
|
param.push({name: 'DownType', value: 2});
|
param.push({name: 'jsession', value: jsession});
|
if(radioFileLocation != 1) {
|
param.push({name: 'DevIDNO', value: number.toString()});
|
}else {
|
param.push({name: 'DevIDNO', value: id.toString()});
|
}
|
/*param.push({name:'DevIDNO',value:devIdno});*/
|
param.push({name: 'Location', value:Number(radioFileLocation)});
|
|
$.ajax({
|
type:'POST',
|
url:'http://'+ ip_ +':' + port_+'/3/1/callback=getData',
|
data:param,
|
cache:false,
|
dataType: 'jsonp',
|
success: getData = function (data) {
|
if(data.result == 0){
|
serverIp=data.server.clientIp;
|
serverPort=data.server.clientPort;
|
|
var param2 = [];
|
param2.push({name: 'DownType', value: 2});
|
param2.push({name: 'jsession', value: jsession});
|
if(radioFileLocation != 1) {
|
param2.push({name: 'DevIDNO', value: number.toString()});
|
}else {
|
param2.push({name: 'DevIDNO', value: id.toString()});
|
}
|
param2.push({name: 'LOC', value: Number(radioFileLocation)});
|
param2.push({name: 'CHN', value: -1});
|
param2.push({name: 'YEAR', value: Number(y)});
|
param2.push({name: 'MON', value: Number(m)});
|
param2.push({name: 'DAY', value: Number(d)});
|
param2.push({name: 'RECTYPE', value: Number(radioVideoType)});
|
param2.push({name: 'FILEATTR', value: Number(radioFileType)});
|
param2.push({name: 'BEG', value:beg});
|
param2.push({name: 'END', value:end});
|
$.ajax({
|
type:'POST',
|
url:'http://'+serverIp+':'+serverPort+'/3/5/callback=getData',
|
data:param2,
|
cache:false,
|
dataType: 'jsonp',
|
success: getData = function (json) {
|
$("#videoInfoTable tr").remove();
|
if(data.result == 0){
|
addVideoFileInfo(json);
|
}else{
|
alert(lang.VideoQueryPrompt);
|
}
|
IsSearching=false;
|
$("#query").val(lang.query);
|
}
|
});
|
}else{
|
alert(lang.ServerQueryPrompt);
|
IsSearching=false;
|
$("#query").val(lang.query);
|
}
|
}
|
});
|
}
|
|
function getChns(){
|
channels=new Array();
|
$("input:checkbox[name='channel']:checked").each(function(){
|
channels.push($(this).val());
|
});
|
return channels;
|
}
|
|
|
/**
|
* Add video file information
|
**/
|
function addVideoFileInfo(json) {
|
//Adding list to search
|
var files = new Array();
|
if(json.files != null && json.files.length > 0) {
|
//File list sort, according to the start time from small to large
|
json.files.sort(function(a,b){return a.beg > b.beg ? 1 : -1});
|
//Add to video file list
|
var index = 0;
|
for (var i = 0; i < json.files.length; i++) {
|
//The vehicle does not contain this channel, then the information is removed.
|
var isAdd = true;
|
//Can download the task of the whole file download
|
//Multiple channel files, can only be downloaded
|
//ChnMask>0 according to the position to determine the number of channels CHN is also a number of channels
|
if(json.files[i].chnMask > 0) {
|
json.files[i].maskChns = getMaskChnArray(json.files[i].chnMask).maskChns;
|
json.files[i].chnName = getMaskChnArray(json.files[i].chnMask).maskChnNames;
|
json.files[i].isSegment = true;//Whether can only be downloaded
|
if(json.files[i].maskChns == '') {
|
isAdd = false;
|
}
|
}else {
|
//chn == 98 All channels
|
if(json.files[i].chn == 98) {
|
json.files[i].chnName = getAllChnName();
|
json.files[i].isSegment = true;
|
if(json.files[i].chnName == '') {
|
isAdd = false;
|
}
|
}else {
|
json.files[i].chnName = getChnName(json.files[i].chn);
|
if(json.files[i].chnName == '') {
|
isAdd = false;
|
}
|
}
|
}
|
if(isAdd) {
|
json.files[i].id = index;
|
if(json.files[i].type == 1) {
|
json.files[i].color = "#FF0000";
|
}
|
json.files[i].vehiIdno = vehiIdno;
|
//Handling files across days
|
processFileDay(json.files[i]);
|
json.files[i].isDirect = true;
|
|
|
for(var j=0;j<channels.length;j++){
|
if(json.files[i].chn == channels[j]){
|
videoFileList.put(index, json.files[i]);
|
files.push(json.files[i]);
|
index++;
|
}
|
|
}
|
}
|
}
|
if(files.length > 0) {
|
//Add to video file list
|
$("#videoInfoTable").flexAppendRowJson(files, false);
|
$.dialog.tips(lang.searchEnded, 1);
|
|
}
|
}
|
if(json.result == 0) {
|
if(files.length <= 0) {
|
$.dialog.tips(lang.NullVideoFileInfo, 2);
|
}
|
}else if(json.result == 23){
|
$.dialog.tips(lang.deviceNotOnline, 2);//设备不在线
|
}else {
|
var mess = '';
|
if((typeof showDialogErrorMessage) == 'function') {
|
mess = showDialogErrorMessage(json.result, json.cmsserver);
|
}
|
if(mess != null && mess == '') {
|
$.dialog.tips(lang.errorGetVideoFile, 2);
|
}
|
}
|
}
|
|
//Deal with file information, cross day
|
function processFileDay(data) {
|
//File across the day before the day of the day or the day after the time
|
//To judge the day before the cross, if the date is the day before
|
|
var beginstr =$("#time").val()+" "+"00:00:00";
|
beginstr = beginstr.replace(/-/g,"/");
|
var begindate = new Date(beginstr);
|
data.yearMonthDay = dateFormat2DateString(begindate);
|
var day = Number(data.yearMonthDay.substring(8, 10));
|
var fileDay = Number(data.day);
|
var fileRealDate = getFileTime(data.year, data.mon, data.day);
|
if(!dateCompareStrDateRange(data.yearMonthDay, fileRealDate, 1) || !dateCompareStrDateRange(fileRealDate, data.yearMonthDay, 1)) {
|
loadTimeLine = false;
|
data.relBeg = data.beg;
|
data.relEnd = data.end;
|
data.beginDate = fileRealDate +' '+ second2ShortHourEx(data.beg);
|
data.endDate = fileRealDate +' '+ second2ShortHourEx(data.end);
|
data.timeTitle = data.beginDate + ' - ' + second2ShortHourEx(data.end);
|
}else {
|
loadTimeLine = true;
|
//The day before
|
if(fileDay < day || (day == 1 && fileDay <= 31 && fileDay >=28 )) {
|
data.relBeg = 0;
|
data.relEnd = Number(data.end) - 86400;
|
data.beginDate = fileRealDate +' '+ second2ShortHourEx(data.beg);
|
data.endDate = dateFormat2DateString(dateGetNextMulDay(dateStrLongTime2Date(data.beginDate), 1)) +' '+ second2ShortHourEx(data.relEnd);
|
data.timeTitle = data.beginDate + ' - ' + data.endDate;
|
}else if(fileDay == day && Number(data.end) > 86400) {
|
//ay after day
|
data.relBeg = data.beg;
|
data.relEnd = 86399;
|
data.beginDate = fileRealDate +' '+ second2ShortHourEx(data.beg);
|
data.endDate = dateFormat2DateString(dateGetNextMulDay(dateStrLongTime2Date(data.beginDate), 1)) +' '+ second2ShortHourEx(Number(data.end) - 86400);
|
data.timeTitle = data.beginDate + ' - ' + data.endDate;
|
}else {
|
data.relBeg = data.beg;
|
data.relEnd = data.end;
|
data.beginDate = fileRealDate +' '+ second2ShortHourEx(data.beg);
|
data.endDate = fileRealDate +' '+ second2ShortHourEx(data.end);
|
data.timeTitle = data.beginDate + ' - ' + second2ShortHourEx(data.end);
|
}
|
}
|
}
|
|
//get file time
|
function getFileTime(year, mon, day) {
|
var retTime = "";
|
retTime += Number(year)+2000;
|
retTime += "-";
|
if(mon < 10) {
|
retTime += "0"+mon;
|
}else {
|
retTime += mon;
|
}
|
retTime += "-";
|
if(day < 10) {
|
retTime += "0"+day;
|
}else {
|
retTime += day;
|
}
|
return retTime;
|
}
|
|
//Gets the name of the channel, comma separated
|
function getMaskChnArray(chnMask) {
|
var chns = [];
|
var chnNames = [];
|
if(queryVehicleChannels) {
|
for (var i = 0; i < queryVehicleChannels.length; i++) {
|
if((chnMask>>queryVehicleChannels[i].index)&1 > 0 && queryVehicleChannels[i].devType == 1) {
|
|
chns.push(queryVehicleChannels[i].index);
|
chnNames.push(queryVehicleChannels[i].name);
|
}
|
}
|
}
|
var data = {};
|
data.maskChns = chns.toString();
|
data.maskChnNames = chnNames.toString();
|
return data;
|
}
|
|
//获取所有通道名,逗号分隔
|
function getAllChnName() {
|
var chnNames = [];
|
if(this.queryVehicleChannels) {
|
for (var i = 0; i < this.queryVehicleChannels.length; i++) {
|
if(this.queryVehicleChannels[i].devType == 1) {
|
chnNames.push(this.queryVehicleChannels[i].name);
|
}
|
}
|
}
|
return chnNames.toString();
|
}
|
|
//Get the channel name
|
function getChnName(chn) {
|
return "CH"+(++chn);
|
}
|
|
//初始化视频插件
|
function initPlayer() {
|
//视频插件初始化参数
|
var params = {
|
allowFullscreen: "true",
|
allowScriptAccess: "always",
|
bgcolor: "#FFFFFF",
|
wmode: "transparent"
|
};
|
//初始化flash
|
swfobject.embedSWF("player.swf", "cmsv6flash", swfwidth, swfheight, "11.0.0", null, null, params, null);
|
initFlash();
|
}
|
|
//设置flash窗口数量
|
function loadFlashWindowNum(num) {
|
if (num == 1) {
|
swfobject.getObjectById('cmsv6flash').setWindowNum(1);
|
} else if (num == 2) {
|
swfobject.getObjectById('cmsv6flash').setWindowNum(2);
|
} else if (num == 3) {
|
swfobject.getObjectById('cmsv6flash').setWindowNum(3);
|
} else {
|
swfobject.getObjectById('cmsv6flash').setWindowNum(4);
|
}
|
}
|
|
//视频插件是否加载完成
|
function initFlash() {
|
|
if (swfobject.getObjectById("cmsv6flash") == null ||
|
typeof swfobject.getObjectById("cmsv6flash").setWindowNum == "undefined" ) {
|
setTimeout(initFlash, 50);
|
} else {
|
//设置视频插件的语言
|
if (getUrlParameter("lang") == "en") {
|
swfobject.getObjectById('cmsv6flash').setLanguage("en.xml");
|
} else {
|
swfobject.getObjectById('cmsv6flash').setLanguage("cn.xml");
|
}
|
//先将全部窗口创建好
|
swfobject.getObjectById("cmsv6flash").setWindowNum(1);
|
//再配置当前的窗口数目
|
loadFlashWindowNum(1);
|
isInitFinished = true;
|
|
}
|
}
|
|
//获取URL参数信息
|
function getUrlParameter(name){
|
if(location.search==''){
|
return '';
|
}
|
|
var o={};
|
var search=location.search.replace(/\?/,'');//只替换第一个问号,如果参数中带有问号,当作普通文本
|
var s=search.split('&');
|
for(var i=0;i<s.length;i++){
|
o[s[i].split('=')[0]]=s[i].split('=')[1];
|
}
|
return o[name]==undefined?'':o[name];
|
}
|
|
|
//视频播放
|
//双击后播放当前行视频
|
function doubleClickVideoReplay(obj,event){
|
var rowId = $.trim($(obj).attr('data-id'));
|
QueryServer(rowId,'replay');
|
}
|
|
//Breakpoint download video file
|
function downloadVideoFile(id) {
|
if(id != null) {
|
if(!confirm(lang.allowed)){
|
return;
|
}
|
//Search and download the video file server information, after the successful download video file information
|
QueryServer(id,'down');
|
}
|
}
|
|
//Replay
|
function videoFileReplay(obj, id) {
|
QueryServer(id,'replay');
|
}
|
|
|
//Query related server information
|
function QueryServer(id,type) {
|
//从报表获取数据
|
var fileInfo = videoFileList.get(Number(id));
|
var FILESVR=fileInfo.svr;
|
var FILELOC=fileInfo.loc;
|
var param = [];
|
param.push({name: 'MediaType', value: 2});
|
param.push({name: 'DownType', value: 3});
|
param.push({name: 'jsession', value: jsession});
|
param.push({name: 'DevIDNO', value: vehiIdno});
|
|
// param.push({name:'DevIDNO',value:devIdno});
|
param.push({name: 'Location', value:Number(radioFileLocation)});
|
param.push({name:'FileSvrID',value:Number(FILESVR)});
|
$.ajax({
|
type:'POST',
|
url:'http://'+ ip_ +':' + port_+'/3/1/callback=getData',
|
data:param,
|
cache:false,
|
dataType: 'jsonp',
|
success: getData = function (data) {
|
if(data.result == 0){
|
if(type=='down'){
|
doDownloadVideoFileInfo( devIdno, id, data.server);
|
}
|
else if(type=='replay'){
|
doReplayVehicleServer(id,devIdno,FILELOC,FILESVR,data.server);
|
}
|
}else{
|
alert(lang.ServerQueryPrompt);
|
}
|
}
|
});
|
}
|
|
//Download video file information
|
function doDownloadVideoFileInfo(Idno,id, dwServer) {
|
var devIdno = Idno;
|
var len = $("#row"+id+" .len div").text();
|
var file = $("#row"+id+" .file div").text();
|
var url = "http://" + dwServer.clientIp +':'+ dwServer.clientPort + "/3/5?DownType=3";
|
url += "&DevIDNO="+ devIdno;
|
url += "&FLENGTH="+ len;
|
url += "&FOFFSET=0";
|
url += "&MTYPE=1";
|
url += "&FPATH="+ file;
|
var paths = file.split('/');
|
if (paths.length == 1) {
|
paths = file.split('\\');
|
}
|
url += "&SAVENAME="+ encodeURI(paths[paths.length - 1]);
|
window.open(url, "_blank");
|
}
|
|
//Access to video file playback server information
|
function doReplayVehicleServer(id,Idno,loc,svr,dwServer){
|
var beg=videoFileList.get(Number(id)).beg;
|
var end=videoFileList.get(Number(id)).end;
|
var DValue=0;
|
var chnStr=$("#row"+id+" .vehiChn div").text();
|
var chn=chnStr.substring(2,chnStr.length)-1;
|
var filename =$("#row"+id+" .file div").text();
|
var lastindex=filename.lastIndexOf('/');
|
var title=filename.substring(lastindex+1,filename.length);
|
//Real time database access
|
var url='http://'+dwServer.clientIp +':'+ dwServer.clientPort+'/3/5?DownType=5&DevIDNO='+Idno+'&FILELOC='+loc+'&FILESVR='+svr+'&FILECHN='+chn+'&FILEBEG='+beg+'&FILEEND='+end+'&PLAYIFRM=0&PLAYFILE='+filename+'&PLAYBEG=0&PLAYEND='+DValue+'&PLAYCHN=0';
|
startPlayback(url,title);
|
}
|
|
|
var beginDateTime = null;
|
var endDateTime = null;
|
|
function doSegementDownloadServer(id){
|
beginDateTime = videoFileList.get(Number(id)).beginDate;
|
endDateTime = videoFileList.get(Number(id)).endDate;
|
$.dialog({id:'selectTime', title: lang.setParam,content: 'url:selectTime.html?id='+id,
|
width:'450px',height:'200px', min:false, max:false, lock:true});
|
}
|
|
|
function downloadTask(id){
|
|
$.dialog({id:'selectTime'}).close();
|
var beg = videoFileList.get(Number(id)).beginDate;//文件日期
|
var end = videoFileList.get(Number(id)).endDate;//
|
var type = videoFileList.get(Number(id)).type;//类型 1报警 0正常
|
//从videoFileList获取数据
|
var Fph = videoFileList.get(Number(id)).file;
|
var Len = videoFileList.get(Number(id)).len;
|
var Chn = videoFileList.get(Number(id)).chn;
|
var param = [];
|
param.push({name: 'jsession', value: jsession});
|
param.push({name: 'did', value: devIdno});
|
param.push({name: 'fbtm', value: beginDateTime});
|
param.push({name: 'fetm', value: endDateTime});
|
param.push({name: 'sbtm', value: beg});
|
param.push({name: 'setm', value:end});
|
param.push({name: 'lab', value:'downloadExample'});
|
param.push({name: 'fph', value: Fph});//录像文件路径 35
|
param.push({name: 'vtp', value: type});//设备回传 1 报警类型 0 正常
|
param.push({name: 'len', value: Len});//文件大小 35
|
param.push({name: 'chn', value: Chn});
|
param.push({name: 'dtp', value:2});
|
|
/*http://localhost:8080/StandardApiAction_addDownloadTask.action?
|
jsession=cf6b70a3-c82b-4392-8ab6-bbddce336222
|
&did=500000 //设备号 *
|
&fbtm=2015-12-25 00:00:00 //文件开始时间 3135
|
&fetm=2015-12-30 23:59:59 //文件结束时间 3135
|
&sbtm=2015-12-25 00:00:00 //源文件开始时间
|
&setm=2015-12-30 23:59:59 //源文件结束时间
|
&lab=downloadExample //录像文件标签
|
&fph=/mnt/hgfs/record/H20121123-112931P3A1P0.avi //录像文件路径 35
|
&vtp=1 //录像类型0表示常规,1表示报警。 0
|
&len=5000 //文件大小 35
|
&chn=1 //录像通道 35
|
&dtp=1 //下载方式1表示全文件下载,2表示分段下载。 2*/
|
$.ajax({
|
type:'POST',
|
url:'http://'+host+'/StandardApiAction_addDownloadTask.action',
|
data:param,
|
cache:false,
|
dataType: 'jsonp',
|
success: getData = function (data) {
|
if(data.result == 0){
|
$.dialog.tips(lang.segemenDownloadSuccess, 1);
|
}else{
|
alert(lang.segemenDownloadFail);
|
}
|
}
|
});
|
|
|
}
|
|
|
|
|
//提交ajax
|
function doAjaxSubmit(action, params, callback) {
|
$.ajax({
|
type: 'POST',
|
url: action,
|
data: params,
|
cache:false,/*禁用浏览器缓存*/
|
dataType: 'json',
|
success: function (json) {
|
if(json.result == 0){
|
callback.call(this, json, action, true);
|
} else {
|
callback.call(this, json, action, false);
|
}
|
},
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
try {
|
if (p.onError) p.onError(XMLHttpRequest, textStatus, errorThrown);
|
} catch (e) {}
|
callback.call(this, null, action, false);
|
}
|
});
|
}
|
|
|
function setPanelWidth(){
|
// var _width = document.body.clientWidth;
|
// var _height = document.body.clientHeight;
|
|
var _width =min($(window).innerWidth(),document.body.clientWidth,document.documentElement.clientWidth);
|
var _height =min($(window).innerHeight(),document.body.clientHeight,document.documentElement.clientHeight) - 39;
|
$("#videoInfo").width(520);
|
$("#selection").width(520);
|
if(_width < 980){
|
$('body').width(980);
|
swfwidth=980-$("#videoInfo").width()-35;
|
}else{
|
var w=_width-10;
|
$('body').width(_width-10);
|
swfwidth=_width-10-$("#videoInfo").width()-35;
|
}
|
// swfwidth=_width-$("#videoInfo").width()-35;
|
swfheight=_height-39;
|
$("#cmsv6flash").width(swfwidth);
|
$("#cmsv6flash").height(swfheight);
|
$("#videoInfo").height(swfheight);
|
}
|
function min(a,b,c){
|
var i=a;
|
if(a>b){
|
i=b;
|
}else if(i>c){
|
i=c
|
}
|
return c;
|
}
|
/**
|
* Start remote playback
|
**/
|
function startPlayback(url,title) {
|
if (!isInitFinished){
|
return;
|
} else {
|
|
setWindowTitle(title);
|
//Window index
|
var index = 0;
|
//Stop before playback
|
swfobject.getObjectById('cmsv6flash').stopVideo(index);
|
//Start playback
|
swfobject.getObjectById("cmsv6flash").startVod(index, url);
|
|
}
|
}
|
/**
|
*Set window title
|
**/
|
function setWindowTitle(title) {
|
if (!isInitFinished){
|
return;
|
} else {
|
//窗口下标
|
var index = 0;
|
swfobject.getObjectById("cmsv6flash").setVideoInfo(index, title);
|
}
|
}
|