| | |
| | | setTimeout(()=>{ |
| | | cbComplete(); |
| | | }, 500); |
| | | |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | const clickLogin = (data, iWndIndex)=>{ |
| | | WebVideoCtrl.I_GetDevicePort(data.ip).then(res=>{ |
| | | console.log(res); |
| | | }).catch(error=>{ |
| | | if(error.errorCode == 2000) { |
| | | login(data, iWndIndex); |
| | | } |
| | | console.log(error); |
| | | }); |
| | | } |
| | | |
| | | const login = (data, iWndIndex)=>{ |
| | | WebVideoCtrl.I_Login(data.ip, 1, data.port, data.username, data.password, { |
| | | timeout: 3000, |
| | | success: function () { |
| | | console.log("开始预览"); //不能删除 |
| | | const szId = data.ip+"_"+data.port; |
| | | |
| | | // 模拟通道 |
| | | WebVideoCtrl.I_GetAnalogChannelInfo(data.ip, { |
| | | const getAnalog = WebVideoCtrl.I_GetAnalogChannelInfo(szId, { |
| | | timeout: 3000, |
| | | success: function (xmlDoc) { |
| | | setTimeout(()=>{ |
| | | initPlay(data.ip, data.port, iWndIndex); |
| | | }, 1000); |
| | | console.log("模拟通道成功"); |
| | | }, |
| | | error: function (oError) { |
| | | console.log("模拟通道失败"); |
| | | } |
| | | }); |
| | | |
| | | Promise.all([getAnalog]).then(res=>{ |
| | | console.log("数据成功"); |
| | | setTimeout(()=>{ |
| | | initPlay(data.ip, data.port, iWndIndex); |
| | | }, 1000); |
| | | } |
| | | }, 3000); |
| | | }).catch(error=>{ |
| | | console.log("数据失败"); |
| | | setTimeout(()=>{ |
| | | initPlay(data.ip, data.port, iWndIndex); |
| | | }, 3000); |
| | | }); |
| | | }, |
| | | error: function () { |
| | |
| | | iWndIndex, |
| | | success: function () { |
| | | startRealPlay(ip, port, iWndIndex); |
| | | }, |
| | | error: function() { |
| | | startRealPlay(ip, port, iWndIndex); |
| | | } |
| | | }); |
| | | } else { |
| | |
| | | console.log("开始预览成功!"); |
| | | }, |
| | | error: function (oError) { |
| | | setTimeout(()=>{ |
| | | initPlay(ip, port, iWndIndex); |
| | | }, 3000); |
| | | console.log("开始预览失败!"); |
| | | console.log(oError); |
| | | } |