Parcourir la source

fix:视频播放

chenjiaxin il y a 3 semaines
Parent
commit
26740e66d8
2 fichiers modifiés avec 12 ajouts et 15 suppressions
  1. 7 9
      src/views/catwalk-video/index.vue
  2. 5 6
      src/views/face-swap-video/index.vue

+ 7 - 9
src/views/catwalk-video/index.vue

@@ -9,7 +9,7 @@
         <!-- <el-table-column label="视频标题" min-width="150" align="center" prop="videoTitle" /> -->
         <el-table-column label="原视频" min-width="130" align="center" prop="videoCoverImageUrl">
           <template slot-scope="scope">
-            <div v-if="scope.row.rawVideoUrl" class="video" @click="handlePlay(scope.row)">
+            <div v-if="scope.row.rawVideoUrl" class="video" @click="handlePlay(scope.row.rawVideoUrl)">
               <video :src="scope.row.rawVideoUrl" class="video-img" />
               <i class="el-icon-video-play" />
             </div>
@@ -17,7 +17,7 @@
         </el-table-column>
         <el-table-column label="视频封面" min-width="130" align="center" prop="videoCoverImageUrl">
           <template slot-scope="scope">
-            <div v-if="scope.row.videoUrl" class="video" @click="handlePlay(scope.row)">
+            <div v-if="scope.row.videoUrl" class="video" @click="handlePlay(scope.row.videoUrl)">
               <video :src="scope.row.videoUrl" class="video-img" />
               <i class="el-icon-video-play" />
             </div>
@@ -71,7 +71,7 @@
                 " size="mini" icon="el-icon-download" circle @click="handleDownload(scope.row)" />
             </el-tooltip>
             <el-tooltip class="item" effect="dark" content="播放" placement="top">
-              <el-button type="success" size="mini" icon="el-icon-caret-right" circle @click="handlePlay(scope.row)" />
+              <el-button type="success" size="mini" icon="el-icon-caret-right" circle @click="handlePlay(scope.row.videoUrl)" />
             </el-tooltip>
             <el-tooltip class="more" effect="dark" content="删除" placement="top">
               <el-button type="danger" size="mini" icon="el-icon-delete-solid" circle
@@ -197,15 +197,13 @@ export default {
       }
     },
     // 视频播放
-    handlePlay(row) {
-      const { videoUrl, videoTitle } = row;
-      ``;
-      if (!videoUrl) {
+    handlePlay(url) {
+      if (!url) {
         this.$message.error("视频地址不存在");
         return;
       }
-      this.currentVideoUrl = videoUrl;
-      this.currentVideoTitle = videoTitle;
+      this.currentVideoUrl = url;
+      this.currentVideoTitle = url.split("/").pop() ;
       this.$refs.videoPlayer.show();
     },
     handlePlayerClose() {

+ 5 - 6
src/views/face-swap-video/index.vue

@@ -32,7 +32,7 @@
         <el-table-column label="原图片/视频" min-width="130" align="center" prop="videoUrl">
           <template slot-scope="scope" v-if="scope.row.rawVideoUrl">
             <div v-if="isVideoFormat(scope.row.rawVideoUrl)" class="video"
-              @click="handlePlay(scope.row, scope.row.rawVideoUrl)">
+              @click="handlePlay(scope.row.rawVideoUrl)">
               <video :src="scope.row.rawVideoUrl" class="video-img" />
               <i class="el-icon-video-play" />
             </div>
@@ -46,7 +46,7 @@
         <el-table-column label="处理后图片/视频" min-width="130" align="center" prop="videoUrl">
           <template slot-scope="scope">
             <div v-if="isVideoFormat(scope.row.videoUrl)" class="video"
-              @click="handlePlay(scope.row, scope.row.videoUrl)">
+              @click="handlePlay(scope.row.videoUrl)">
               <!-- <img :src="scope.row.videoCoverImageUrl" class="video-img" /> -->
               <video :src="scope.row.videoUrl" class="video-img" />
               <i class="el-icon-video-play" />
@@ -100,7 +100,7 @@
             </el-tooltip>
             <el-tooltip class="item" effect="dark" content="播放" placement="top">
               <el-button type="success" size="mini" icon="el-icon-caret-right" circle
-                @click="handlePlay(scope.row, scope.row.videoUrl)" />
+                @click="handlePlay(scope.row.videoUrl)" />
             </el-tooltip>
             <el-tooltip class="more" effect="dark" content="删除" placement="top">
               <el-button type="danger" size="mini" icon="el-icon-delete-solid" circle
@@ -242,8 +242,7 @@ export default {
         this.$set(this.downloadingRows, id, false);
       }
     },
-    handlePlay(row, url) {
-      const { videoTitle } = row;
+    handlePlay(url) {
       if (!url) {
         this.$message.error("媒体地址不存在");
         return;
@@ -252,7 +251,7 @@ export default {
       if (this.isVideoFormat(url)) {
         // 视频播放逻辑
         this.currentVideoUrl = url;
-        this.currentVideoTitle = videoTitle;
+        this.currentVideoTitle =  url.split("/").pop();
         this.$refs.videoPlayer.show();
       } else if (this.isImageFormat(url)) {
         // 新增图片格式判断