index.html 4.11 KB
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.png">
    <title>AI视频分析平台</title>
    <script src="<%= BASE_URL %>js/kinetic-v5.1.0.min.js"></script>
    <script src="<%= BASE_URL %>js/ObjTree.js"></script>
    <script src="<%= BASE_URL %>js/jquery.min.js"></script>
    <script src="<%= BASE_URL %>js/keymaster.js"></script>
  </head>
  <body id="theme-name">
    <noscript>
      <strong></strong>
    </noscript>
    <div id="app"></div>
  </body>
  <script>
    function connectCamera(szDeviceIp, szUser, szPass, camType) {
      var i = 0;
      camType = 'ball'
      switch (camType) {
        case "0":
          //console.log("");
          break;
        case "-1":
          // console.log("未找到目标相机");
          break;
        case "rifle":
          //console.log("枪机无云台操作");
          break;
        case "ball":
          i = VionVideo.PtzRegistDev(szDeviceIp, szUser, szPass);
          if (i == 1) {
            console.log('云台连接成功')
            return true;
          } else {
            //showMessagerInfo("连接云台失败");
            return false;
          }
          break;
        default:
          i = VionVideo.PtzRegistDev(szDeviceIp, szUser, szPass);
          if (i == 1) {
            return true;
          } else {
            //showMessagerInfo("连接云台失败");
            return false;
          }
          break;
      }
    }
  
  </script>
  <script language="javascript" event="VideoCoreEvent(EventType,nParam1,nParam2,szParam3)" for="VionVideo">
    if (EventType == 1) {
      if (nParam2 != 0) {
        //alert("播放失败!");
      } else {
  
      }
    }
    //播放窗口改变事件调用云台控制事件
    else if (EventType == 3) {
      var curVideoIndex = VionVideo.GetCurSelWnd();
      console.log('当前窗口' + curVideoIndex)
      var videoInfo = JSON.parse(localStorage.getItem('video' + curVideoIndex));
      console.log('相机信息' + videoInfo);
      ve.videovid = videoInfo;
      //根据树信息返回地址IP 用户名 密码
      if (videoInfo) {
        var szDeviceIp = videoInfo.vchan_prop.ip,
          szUser = videoInfo.vchan_prop.user_name,
          szPass = videoInfo.vchan_prop.password;
        var camType = '';
        if (videoInfo.vchan_prop.is_demo) {
          camType = 'ball'
        }
       var state =  connectCamera(szDeviceIp, szUser, szPass, camType);
       console.log(state);
      }
  
    } else if (EventType == 4) {
      //openManualCapture(szParam3);
    } else if (EventType == 2) {
      //setCamIcon(szParam3, 1);
    } else if (EventType == 12) {
      jianPanKongzhi(nParam1);
  
    } else if (EventType == 10) {
      videoEventHandle.Screenshot(szParam3);
      //alert("wwww");
    }
    //ocx播放窗格切换
    else if (EventType == 8) {
  
      //根据拼接定义获取当前窗格数
      var tmpArr = szParam3.split(':');
      if (tmpArr.length > 0) {
        var windowSum = tmpArr[0];
        //alert("切换窗格数:" + windowSum);
        var ownDefine = tmpArr.length > 1 ? tmpArr[1] : "";
        //需要使用子码流播放
        if (windowSum >= subNum) {
          //alert("当前应使用子码流播放");
          //从主码流切换至子码流
          if (realVideoNum < subNum) {
            //alert("从主码流切换至子码流");
            realVideoNum = windowSum;
            reSetHasPlayVideos(windowSum, ownDefine, 'SUB');
          } else {
            realVideoNum = windowSum;
          }
        }
        //需要使用主码流播放
        else {
          //alert("当前应使用主码流播放");
          //从子码流切换至主码流
          if (realVideoNum >= subNum) {
            //alert("从子码流切换至主码流");
            realVideoNum = windowSum;
            reSetHasPlayVideos(windowSum, ownDefine, 'MAIN');
          } else {
            realVideoNum = windowSum;
          }
        }
      }
    }
  
  </script>
</html>