dedsudiyu 5 days ago
parent
commit
650f0b35f7
2 changed files with 40 additions and 19 deletions
  1. 8 0
      src/api/index.js
  2. 32 19
      src/components/LabStats/videoStats.vue

+ 8 - 0
src/api/index.js

@@ -386,3 +386,11 @@ export function iotDeviceList(data = {}) {
     data
   })
 }
+//查询第三方flv视频
+export function laboratorySignInCheckGetKunYunToken(params) {
+  return request({
+    url: '/laboratory/signIn/check/getKunYunToken',
+    method: 'get',
+    params
+  })
+}

+ 32 - 19
src/components/LabStats/videoStats.vue

@@ -11,7 +11,7 @@
   </div>
 </template>
 <script>
-  import { getVideoList,laboratoryLabScreenScreenConfigGet,iotDeviceList } from '@/api/index'
+  import { getVideoList,laboratoryLabScreenScreenConfigGet,iotDeviceList,laboratorySignInCheckGetKunYunToken } from '@/api/index'
   import videoForMod from '@/components/videoForMod/videoForMod.vue'
   import mpegtsVideo from '@/components/mpegtsVideo/mpegtsVideo.vue'
   import webRTC from './webRTC.vue'
@@ -23,20 +23,7 @@
         width:470,
         height:280,
         modList:[],
-        mpegtsList:[
-          {
-            width: 470, //(宽度:非必传-默认600)
-            height: 280, //(高度:非必传-默认338)
-            url: 'https://192.168.166.11/zlmedia/gpfas/e6ba259ca65e47c3bd8c8ff357ab07ed-e31734aa19e342f198d56d3335e82b39-7.live.flv',
-            cameraIndexCode: '4012',
-          },
-          {
-            width: 470, //(宽度:非必传-默认600)
-            height: 280, //(高度:非必传-默认338)
-            url: 'https://192.168.166.11/zlmedia/gpfas/e6ba259ca65e47c3bd8c8ff357ab07ed-bfb405ce0991426ca8ef611a60e7a483-7.live.flv',
-            cameraIndexCode: '4211',
-          },
-        ],
+        mpegtsList:[],
         pollTimer:null,
         page:1,
         webRtcType:false,
@@ -46,8 +33,8 @@
 
     },
     mounted(){
-      this.laboratoryLabScreenScreenConfigGet();
-      this.pollTimer = setInterval(this.laboratoryLabScreenScreenConfigGet, 5 * 60 * 1000)
+      this.getData();
+      this.pollTimer = setInterval(this.getData, 5 * 60 * 1000)
       // this.getVideoData();
     },
     methods:{
@@ -69,11 +56,17 @@
           }
         }
       },
+      getData(){
+        this.$set(this,'modList',[]);
+        this.$set(this,'mpegtsList',[]);
+        this.laboratoryLabScreenScreenConfigGet();
+        this.laboratorySignInCheckGetKunYunToken();
+      },
+      //获取海康流
       async laboratoryLabScreenScreenConfigGet(){
         try {
           const res = await laboratoryLabScreenScreenConfigGet({ screenType: 2 })
           if (res.code === 200) {
-            this.$set(this,'modList',[]);
             if(res.data.effective){
               this.$set(this,'webRtcType',true);
               this.$set(this,'page',1);
@@ -84,7 +77,6 @@
                 }
               }
               this.$set(this,'modList',list);
-              console.log('modList',this.modList)
             }else{
               this.$set(this,'webRtcType',false);
               this.iotDeviceList();
@@ -94,6 +86,27 @@
 
         }
       },
+      //获取第三方流token
+      async laboratorySignInCheckGetKunYunToken(){
+        const res = await laboratorySignInCheckGetKunYunToken();
+        if (res.code === 200) {
+          this.$set(this,'mpegtsList',[
+            {
+              width: 470, //(宽度:非必传-默认600)
+              height: 280, //(高度:非必传-默认338)
+              url: 'wss://192.168.166.11/zlmedia/gpfas/e6ba259ca65e47c3bd8c8ff357ab07ed-e31734aa19e342f198d56d3335e82b39-7.live.flv?token='+res.data,
+              cameraIndexCode: '4012',
+            },
+            {
+              width: 470, //(宽度:非必传-默认600)
+              height: 280, //(高度:非必传-默认338)
+              url: 'wss://192.168.166.11/zlmedia/gpfas/e6ba259ca65e47c3bd8c8ff357ab07ed-bfb405ce0991426ca8ef611a60e7a483-7.live.flv?token='+res.data,
+              cameraIndexCode: '4211',
+            },
+          ]);
+
+        }
+      },
       //刷新视屏
       getVideoData(data) {
         let obj = {