function setProgress(percent) { $('input[type="range"]').val(percent).change(); } function doAction(func) { if (func.indexOf("video") != -1) { if (func.indexOf("start") != -1) { $("#video_btn_start").addClass("hidden"); $("#video_btn_stop").removeClass("hidden"); if ($("#full_video_btn_start").length > 0) { $("#full_video_btn_start").addClass("hidden"); $("#full_video_btn_stop").removeClass("hidden"); } } if (func.indexOf("stop") != -1) { $("#video_btn_start").removeClass("hidden"); $("#video_btn_stop").addClass("hidden"); if ($("#full_video_btn_start").length > 0) { $("#full_video_btn_stop").addClass("hidden"); $("#full_video_btn_start").removeClass("hidden"); } } callFunc(func, ''); } else { callFunc(func, ''); } } function setVideoPos() { var pos = $("#video_pos").val(); if ($("#full_video_pos").length > 0) { pos = $("#full_video_pos").val(); } if (/^(\+|-)?\d+($|\.\d+$)/.test(pos)) { slider_current_value = pos; callFunc("video_pos", pos); } } function queryVideoLists(videoIds) { console.log(videoIds); if (CLIENTVERSION == 1 && ISCLIENT) { callFunc("showvideoview", "false"); layer.msg('该软件版本太低,请升级!', { offset: 'r', time: 5000, //20s后自动关闭 }); return; } if (videoIds != null) { s1 = $.checkTask.start_time.replace(/-/g, "/"); var startTime = new Date(s1).getTime() / 1000; s1 = $.checkTask.end_time.replace(/-/g, "/"); var endTime = new Date(s1).getTime() / 1000; VideoGetByIds(videoIds, function(data) { var video_type = 1; if(data[0].user_name != "undefined" && data[0].user_name != null){ video_type = 2; } if(video_type == 2){ curVideo = data.channel; } var cammercode = new Array(); var username = new Array(); var userpwd = new Array(); var v_ip = new Array(); var v_port = new Array(); if(video_type == 2){ for(var index in data){ var videoObj = data[index]; cammercode.push(videoObj.channel); username.push(videoObj.user_name); userpwd.push(videoObj.user_pwd); v_ip.push(videoObj.ip); v_port.push(videoObj.port); } videoIds = cammercode.toString(); }else{ v_port.push(0); } if (data != null && typeof(data) != "undefined") { var pp = { "videoIds": videoIds, "cindex": 1, "starttime": startTime, "endtime": endTime, "cammercode": cammercode.toString(), // "username": username.toString(), // "userpwd": userpwd.toString(), // "v_ip": v_ip.toString(), "video_type":video_type, // "v_port": v_port.toString(), "videos": [] }; data.forEach(came => { pp.videos.push({ "videoId": came.device_id, "cametype": came.cameratype, "filetype": came.playtype, "cammercode": came.channel, "username": came.user_name, "userpwd": came.user_pwd, "v_ip": came.ip, "video_type":video_type, "v_port": came.port }); }); console.log(pp); callFunc("findvideolist", JSON.stringify(pp)); } else { callFunc("showvideoview", "false"); layer.msg('该处暂无视屏!', { offset: 'c', time: 2000, //20s后自动关闭 }); } }, function(error) {}); } } function queryVideoList() { var videos = $.checkTask.video_id.split(','); if (curVideo) { s1 = $.checkTask.start_time.replace(/-/g, "/"); var startTime = new Date(s1).getTime() / 1000; s1 = $.checkTask.end_time.replace(/-/g, "/"); var endTime = new Date(s1).getTime() / 1000; //获取当前的index var index = 0; for (var i = 0; i < videos.length; i++) { if (parseInt(videos[i]) == parseInt(curVideo)) { index = i; break; } } debugger //获取摄像头信息 VideoGetById(curVideo, function(data) { console.log(data); if (data != null && typeof(data) != "undefined") { var video_type = 1; var str = curVideo + '|' + startTime + '|' + endTime + '|' + data.cameratype + '|' + data.playtype + '|' + index; if(typeof(data.user_name) != "undefined" && typeof(data.user_name) != null){ video_type = 2; } if(video_type == 2){ curVideo = data.channel; } var pp = { "videoIds": curVideo, "cindex": 10, starttime: startTime, "endtime": endTime, "cammercode": data.channel, "username": data.user_name, "userpwd": data.user_pwd, "v_ip": data.ip, "video_type":video_type, "v_port": data.port, "videos": [{ "videoId": curVideo, "cametype": data.cameratype, "filetype": data.playtype, "cammercode": data.channel, "username": data.user_name, "userpwd": data.user_pwd, "v_ip": data.ip, "video_type":video_type, "v_port": data.port }] }; if (CLIENTVERSION == 1) { callFunc("findvideolist", str); } else { callFunc("findvideolist", JSON.stringify(pp)); } } else { callFunc("showvideoview", "false"); layer.msg('该处暂无视屏!', { offset: 'c', time: 2000, //20s后自动关闭 }); } }, function(error) { }); // alert(curVideo); } else { } } function playVideo(id) { callFunc("playvideo", id); } var maxVV; function setProcessValue(maxValue) { //alert(maxValue); // console.log(max); maxVV = maxValue; $("#ex1").slider({ step: 5, min: 0, max: maxValue }); if ($("#full_ex1").length > 0) { $("#full_ex1").slider({ step: 5, min: 0, max: maxValue }); } } var slider_current_value = 0; function setCurrentProcessValue(value) { // alert("ddd"+value); // console.log(value); var vv = maxVV * (value / 100) slider_current_value = parseInt(vv); $("#ex1").slider('setValue', parseInt(vv)); if ($("#full_ex1").length > 0) { $("#full_ex1").slider('setValue', parseInt(vv)); } } function setVideoProcess(value) { // console.log(value); var vv = value * 100 / maxVV; if (!isNaN(vv) && parseInt(vv).toString() != "NaN") { callFunc("setcurrenplayttime", parseInt(vv)); } else { } } function callFunc(func, param) { var event = document.createEvent('MessageEvent'); var origin = window.location.protocol + '//' + window.location.host; event.initMessageEvent(func, true, true, param, origin, 1234, window, null); document.dispatchEvent(event); } function playNext(index) { $("#video_list").val(index); }