You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
142 lines
4.4 KiB
142 lines
4.4 KiB
2 years ago
|
var video_id;
|
||
|
var direction;
|
||
|
var video_info;
|
||
|
|
||
|
function successfunc(data){
|
||
|
// 回调成功,初始化播放器
|
||
|
if(isOK(data)){
|
||
|
video_id = data.data.id;
|
||
|
|
||
|
video_info = data.data;
|
||
|
|
||
|
$("#myPlayer").attr("src","https://open.ys7.com/ezopen/h5/iframe_se?url=ezopen://open.ys7.com/"+data.data.device_serial+"/"+
|
||
|
data.data.channel+".hd.live&autoplay=0&audio=1&accessToken="+token+"&templete=2");
|
||
|
|
||
|
/* 获取播放器元素 */
|
||
|
// 改成海康播放器
|
||
|
var player = new EZUIPlayer('myPlayer');
|
||
|
player.on('error', function(){
|
||
|
console.log('error');
|
||
|
});
|
||
|
player.on('play', function(){
|
||
|
console.log('play');
|
||
|
});
|
||
|
player.on('pause', function(){
|
||
|
console.log('pause');
|
||
|
});
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$(document).ready(function() {
|
||
|
$(".operate_btn").click(function(){
|
||
|
if(video_id == undefined || video_id == 'undefined'){
|
||
|
tip("获取视频信息失败!");
|
||
|
}else{
|
||
|
//操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距
|
||
|
direction = $(this).attr("tag");
|
||
|
var data = {
|
||
|
"direction":direction,
|
||
|
"id":video_id,
|
||
|
"speed":"1"
|
||
|
}
|
||
|
commonAjax("POST",localUrl+"/ptz/start.json", data,function(data){
|
||
|
// if(isOK(data)){
|
||
|
// tip(data.statusMsg);
|
||
|
// }
|
||
|
});
|
||
|
}
|
||
|
})
|
||
|
$(".stop_btn").click(function () {
|
||
|
if(video_id == undefined || video_id == 'undefined'){
|
||
|
tip("获取视频信息失败!");
|
||
|
}else{
|
||
|
//操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距
|
||
|
var data = {
|
||
|
"id":video_id,
|
||
|
"direction":direction
|
||
|
}
|
||
|
commonAjax("POST",localUrl+"/ptz/stop.json", data,function(data){
|
||
|
});
|
||
|
}
|
||
|
})
|
||
|
|
||
|
//设备抓拍
|
||
|
$(".device_capture").click(function(){
|
||
|
var data = {
|
||
|
"id":video_id
|
||
|
}
|
||
|
commonAjax("POST",localUrl+"/device/capture.json", data,function(data){
|
||
|
if(isOK(data)){
|
||
|
showTip("抓拍成功,图片已保存");
|
||
|
}else{
|
||
|
tip(data.statusMsg);
|
||
|
}
|
||
|
});
|
||
|
})
|
||
|
|
||
|
$(".device_capture_img,.delete_capture").mouseover(function(){
|
||
|
var tag = $(this).attr("tag");
|
||
|
$(".delete_capture").hide();
|
||
|
$(".delete_capture[tag="+tag+"]").show();
|
||
|
})
|
||
|
$(".device_capture_img,.delete_capture").mouseout(function(){
|
||
|
$(".delete_capture").hide();
|
||
|
})
|
||
|
//删除抓拍图片
|
||
|
$(".delete_capture").click(function(){
|
||
|
var id = $(this).attr("tag");
|
||
|
lcomfirm('是否删除当前图片?',function(){
|
||
|
commonAjax("DELETE",localUrl+"/video/file.json?id="+id, "",function(data){
|
||
|
if(isOK(data)){
|
||
|
tip("已删除");
|
||
|
setTimeout(function(){
|
||
|
location.reload();
|
||
|
},1000)
|
||
|
}else{
|
||
|
tip(data.statusMsg);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
})
|
||
|
//查看历史
|
||
|
$(".view_old_video").click(function(){
|
||
|
var start = $("input[type-name='start_time']").val().replaceAll(" ","").replaceAll("-","").replaceAll(":","");
|
||
|
var end = $("input[type-name='end_time']").val().replaceAll(" ","").replaceAll("-","").replaceAll(":","");
|
||
|
$("#myPlayer").attr("src","https://open.ys7.com/ezopen/h5/iframe_se?url=ezopen://open.ys7.com/"+video_info.device_serial+"/"+video_info.channel+".hd.rec&begin="+start+"&end="+end+"&autoplay=0&audio=1&accessToken="+token+"&templete=2");
|
||
|
})
|
||
|
//返回直播
|
||
|
$(".video_view_news").click(function(){
|
||
|
var start = $("input[type-name='start_time']").val().replaceAll(" ","").replaceAll("-","").replaceAll(":","");
|
||
|
var end = $("input[type-name='end_time']").val().replaceAll(" ","").replaceAll("-","").replaceAll(":","");
|
||
|
$("#myPlayer").attr("src","https://open.ys7.com/ezopen/h5/iframe_se?url=ezopen://open.ys7.com/"+video_info.device_serial+"/"+video_info.channel+".hd.live&autoplay=0&audio=1&accessToken="+token+"&templete=2");
|
||
|
})
|
||
|
//开启视频加密
|
||
|
$(".encrypt_on").click(function(){
|
||
|
lcomfirm('是否开启视频加密?',function(){
|
||
|
var data = {id:video_id}
|
||
|
commonAjax("POST",localUrl+"/encrypt/on.json", data,function(data){
|
||
|
if(isOK(data)){
|
||
|
tip("视频加密已开启");
|
||
|
}else{
|
||
|
tip(data.statusMsg);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
})
|
||
|
//关闭视频加密
|
||
|
$(".encrypt_off").click(function(){
|
||
|
lcomfirm('是否开启视频加密?',function(){
|
||
|
var data = {id:video_id}
|
||
|
commonAjax("POST",localUrl+"/encrypt/off.json", data,function(data){
|
||
|
if(isOK(data)){
|
||
|
tip("视频加密已关闭");
|
||
|
}else{
|
||
|
tip(data.statusMsg);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
})
|
||
|
})
|
||
|
|