Browse Source

+ 视频跟随前端

chen.cheng 6 months ago
parent
commit
ab70835a5b
2 changed files with 7 additions and 8 deletions
  1. 2 2
      src/components/Video/index.vue
  2. 5 6
      src/components/VideoTrail/index.vue

+ 2 - 2
src/components/Video/index.vue

@@ -42,7 +42,7 @@ export default {
         height: "100%",
         width: "100%",
         playbackRates: [0.5], // 可选的播放速度
-        autoplay: false, // 如果为true,浏览器准备好时开始回放
+        autoplay: true, // 如果为true,浏览器准备好时开始回放
         muted: true, // 默认情况下静音播放
         loop: false, // 是否视频一结束就重新开始
         preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据,auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
@@ -52,7 +52,7 @@ export default {
         sources: [
           {
             type: "video/mp4", // 类型
-            src: videoM, // url地址,在使用本地的资源时,需要用require()引入,否则控制台会报错
+            src: this.stream, // url地址,在使用本地的资源时,需要用require()引入,否则控制台会报错
           },
         ],
         notSupportedMessage: "此视频暂无法播放,请稍后再试", // 允许覆盖Video.js无法播放媒体源时显示的默认信息

+ 5 - 6
src/components/VideoTrail/index.vue

@@ -1,22 +1,21 @@
 <template>
   <div v-drag class="video-trail-container">
-    <div class="video-trail-title" style="">
+    <div class="video-trail-title">
       视频跟随
     </div>
     <div class="video-trail-content">
       <div class="main-video">
         <video-obj
-            :stream="ws"
-            :lastTime="0"
-            key="ws"
-            @error="error"
+            v-if="videoList.length > 0"
+            :stream="videoList[0].video.cameraLive"
+            :key="`main-${videoList[0].key}`"
         />
       </div>
       <div class="trail-videos">
         <video-obj
             v-for="item in videoList"
             :key="item.key"
-            :stream="item.video.liveStream"
+            :stream="item.video.cameraLive"
             :lastTime="0"
         />
       </div>