Browse Source

video small change

xyh123999 1 year ago
parent
commit
aa4d1fe815
1 changed files with 42 additions and 32 deletions
  1. 42 32
      src/views/taskScreen.vue

+ 42 - 32
src/views/taskScreen.vue

@@ -371,7 +371,7 @@ export default {
       currentTaskGrade: "",
       unitSubGradeValue: "",
       gridData: [],
-      dataSrc: ["rtsp://admin:sgw123456@192.168.0.64:554/h265/ch01/main/av_stream", "", "", "", ""],
+      dataSrc: ["", "", "", "", ""],
       completionRate: false,
       playerList: [],
       videoPlayerName: ["监控名称", "监控名称", "监控名称", "监控名称", "监控名称"],
@@ -382,7 +382,8 @@ export default {
         "videoPlayer_third",
         "videoPlayer_fourth"
       ],
-      mainVideoData: {}
+      mainVideoData: {},
+      currentSubject: ''
     };
   },
   methods:{
@@ -781,7 +782,7 @@ export default {
 
     },
 
-    async initUrl(subjectName = "电子干扰课目") {
+    async initUrl(subjectName = "步坦协同课目") {
       //     		if(this.playerList.length){
       // 	this.playerList.forEach((item)=>{
       // 		item.dispose()
@@ -806,35 +807,42 @@ export default {
       // 		item.dispose()
       // 	})
       // }
-      let params = {};
+      if(subjectName+"课目" != this.currentSubject){
+        this.currentSubject = subjectName + "课目";
+         let params = {};
        request("/dt_screen/video/videos/videoClose", "get", params, false);
       
       // const res = request("/dt_screen/video/videos/videoClose", "get", params, false);
-      // this.initUrl(subjectName + "课目");
-      // setTimeout(() => {
-      //   let index = 0;
-
-      //   this.playerList.forEach((item) => {
-      //     item.src([{ type: "application/x-mpegURL", src: this.dataSrc[index++] }]);
-      //     item.load();
-      //     item.play();
-      //   });
-      // }, 35000);
+     
+       setTimeout(() => {
+    this.initUrl(subjectName + "课目");
+      }, 1000);
+      setTimeout(() => {
+        let index = 0;
+
+        this.playerList.forEach((item) => {
+          item.src([{ type: "application/x-mpegURL", src: this.dataSrc[index++] }]);
+          item.load();
+          item.play();
+        });
+      }, 6000);
+      }
+     
     }
   },
   mounted() {
-    //  this.initUrl()
-    let url = "rtsp://admin:sgw123456@192.168.0.64:554/h265/ch01/main/av_stream";
-    url = url.split("/");
-    url = url[2];
-    url = url.split(":");
-    this.mainVideoData.Username = url[0];
-    this.mainVideoData.Port = url[2];
-    url = url[1];
-    url = url.split("@");
-    this.mainVideoData.IP = url[1];
-    this.mainVideoData.Password = url[0];
-    console.log("this.mainVideoData :>> ", this.mainVideoData);
+   
+    // let url = "rtsp://admin:sgw123456@192.168.0.64:554/h265/ch01/main/av_stream";
+    // url = url.split("/");
+    // url = url[2];
+    // url = url.split(":");
+    // this.mainVideoData.Username = url[0];
+    // this.mainVideoData.Port = url[2];
+    // url = url[1];
+    // url = url.split("@");
+    // this.mainVideoData.IP = url[1];
+    // this.mainVideoData.Password = url[0];
+    // console.log("this.mainVideoData :>> ", this.mainVideoData);
 
     // 获取全部单位
     this.getAllUnits();
@@ -843,14 +851,16 @@ export default {
     // 建立任务的weksocket链接
     this.initWebsoket();
 
-
+    this.initUrl()
+    this.currentSubject = "步坦协同课目";
 
     //     // 过14秒调用
-    // setTimeout(() => {
-    //   for (let index = 0; index < this.dataSrc.length; index++) {
-    //     this.initVideo(this.dataSrc[index], this.videoList[index]);
-    //   }
-    // }, 5500);
+    setTimeout(() => {
+      for (let index = 0; index < this.dataSrc.length; index++) {
+        console.log('object :>> ',this.dataSrc[index]);
+        this.initVideo(this.dataSrc[index], this.videoList[index]);
+      }
+    }, 5000);
   },
   beforeDestroy() {
     if (this.playerList.length) {