|
@@ -148,17 +148,31 @@ export default {
|
|
|
console.log("==设备编码不全,无法播放==");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if (typeof UVPVideoObj === 'undefined') {
|
|
|
+ console.log("UVPVideoObj尚未加载,延迟重试...");
|
|
|
+ setTimeout(() => {
|
|
|
+ that.videoPlay(options);
|
|
|
+ }, 100);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (!that.nrUvpVideoObj) {
|
|
|
console.log("==创建播放器==");
|
|
|
- that.nrUvpVideoObj = new UVPVideoObj({
|
|
|
- id: that.clientId,
|
|
|
- winNum: options.winNum,
|
|
|
- ip: that.cameraConfig.ip,
|
|
|
- port: that.cameraConfig.port,
|
|
|
- token: that.cameraConfig.token,
|
|
|
- ak: that.cameraConfig.ak,
|
|
|
- callback: onEventNotify
|
|
|
- });
|
|
|
+ try {
|
|
|
+ that.nrUvpVideoObj = new UVPVideoObj({
|
|
|
+ id: that.clientId,
|
|
|
+ winNum: options.winNum,
|
|
|
+ ip: that.cameraConfig.ip,
|
|
|
+ port: that.cameraConfig.port,
|
|
|
+ token: that.cameraConfig.token,
|
|
|
+ ak: that.cameraConfig.ak,
|
|
|
+ callback: window.onEventNotify
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ console.error("创建UVPVideoObj实例失败:", error);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
console.log("==开始播放==>参数集: ", JSON.stringify(options));
|
|
|
that.nrUvpVideoObj.uvpVideoPlay({
|
|
@@ -168,21 +182,10 @@ export default {
|
|
|
streamType: 1
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
// 云台控制
|
|
|
videoControl(options) {
|
|
|
if (!options?.code) return;
|
|
|
- // if (!this.nrUvpVideoObj) {
|
|
|
- // this.nrUvpVideoObj = new UVPVideoObj({
|
|
|
- // id: that.clientId,
|
|
|
- // winNum: options.winNum,
|
|
|
- // ip: that.cameraConfig.ip,
|
|
|
- // port: that.cameraConfig.port,
|
|
|
- // token: that.cameraConfig.token,
|
|
|
- // ak: that.cameraConfig.ak,
|
|
|
- // callback: onEventNotify
|
|
|
- // });
|
|
|
- // }
|
|
|
console.log("==进入云台操作==>参数集: ", JSON.stringify(options));
|
|
|
this.nrUvpVideoObj.uvpVideoControl({
|
|
|
devCode: options.code,
|