安琪酵母(西藏)益生菌信息采集中心智能实验室
longyvfengyun
2023-08-22 0355135113176bbbf0b0dd84b7894269179a704a
src/views/video/components/js/hkVideo/hkModule.js
@@ -7,7 +7,7 @@
const hkModule = ()=>{
  const {isCollapse} = slideMenu();
  const divPlugin = ref(null);
  const iWndowType = ref(1);
  const iWndowType = ref(3);
  const gIWndIndex = ref(0);
  const videoInitPlugin = (cbComplete)=>{
    let iRet = WebVideoCtrl.I_CheckPluginInstall();
@@ -20,7 +20,7 @@
  const initPlugin = (cbComplete)=>{
    WebVideoCtrl.I_InitPlugin({
      bWndFull: false, //是否支持单窗口双击全屏
      bWndFull: true, //是否支持单窗口双击全屏
      iWndowType: iWndowType.value,
      bDebugMode:true,
      cbSelWnd: function (xmlDoc){
@@ -39,15 +39,24 @@
    });
  }
  const clickLogin = (data)=>{
    console.log(data);
  const clickLogin = (data, iWndIndex)=>{
    WebVideoCtrl.I_Login(data.ip, 1, data.port, data.username, data.password, {
      timeout: 3000,
      success: function () {
        console.log("开始预览");  //不能删除
        setTimeout(()=>{
          initPlay(data.ip, data.port);
        }, 1000);
        // 模拟通道
        WebVideoCtrl.I_GetAnalogChannelInfo(data.ip, {
          success: function (xmlDoc) {
            setTimeout(()=>{
              initPlay(data.ip, data.port, iWndIndex);
            }, 1000);
          },
          error: function (oError) {
            setTimeout(()=>{
              initPlay(data.ip, data.port, iWndIndex);
            }, 1000);
          }
        });
      },
      error: function () {
        console.log("login error");
@@ -64,24 +73,26 @@
    });
  };
  const initPlay = (ip, port)=>{
    let oWndInfo = WebVideoCtrl.I_GetWindowStatus(0);
  const initPlay = (ip, port, iWndIndex)=>{
    let oWndInfo = WebVideoCtrl.I_GetWindowStatus(iWndIndex);
    if (oWndInfo != null) {// 已经在播放了,先停止
      WebVideoCtrl.I_Stop({
        iWndIndex,
        success: function () {
          startRealPlay(ip, port);
          startRealPlay(ip, port, iWndIndex);
        }
      });
    } else {
      startRealPlay(ip, port);
      startRealPlay(ip, port, iWndIndex);
    }
  }
  const startRealPlay = (ip, port)=>{
  const startRealPlay = (ip, port, iWndIndex)=>{
    WebVideoCtrl.I_StartRealPlay(ip, {
      iStreamType: 1,
      iChannelID: 1,
      iWndIndex,
      bZeroChannel: false,
      success: function () {
        console.log("开始预览成功!");
@@ -102,10 +113,9 @@
  watch(
    isCollapse,
    (newVal)=>{
      //changeWndNum(newVal[0]);
      setTimeout(()=>{
        WebVideoCtrl.I_My_Resize();
      }, 0);
      }, 300);
    },
  );