ソースを参照

视频播放器优化

liyongli 4 年 前
コミット
1b1d116e27
1 ファイル変更24 行追加2 行削除
  1. 24 2
      src/components/Detail/video.vue

+ 24 - 2
src/components/Detail/video.vue

@@ -3,6 +3,7 @@
     <van-sticky :offset-top="0">
       <video-player
         class="video-player-box"
+        autoplay="autoplay"
         ref="videoPlayer"
         :options="playerOptions"
         :playsinline="true"
@@ -176,10 +177,24 @@ export default {
           src: this.item.videoUrl
         }
       ],
-      poster: "/static/images/author.jpg"
+      // poster: "/static/images/author.jpg",
+      controlBar: {
+        children: [
+          "playToggle",
+          "currentTimeDisplay",
+          "progressControl",
+          "durationDisplay",
+          "fullscreenToggle"
+        ],
+        TimeDivider: false, //当前时间和持续时间的分隔符
+        durationDisplay: true, //显示持续时间
+        CurrentTimeDisplay: false,
+        remainingTimeDisplay: false, //是否显示剩余时间功能
+        playbackRateMenuButton: false, // 播放速度
+        fullscreenToggle: true // 全屏按钮
+      }
     };
     this.timeout = new Date() - 0;
-
     let _this = this;
     this.$refs.videoPlayer &&
       (window["autoPlay"] = function(pageStatus) {
@@ -195,6 +210,13 @@ export default {
   }
 };
 </script>
+<style lang="scss">
+#video {
+  .video-js .vjs-time-control {
+    display: block;
+  }
+}
+</style>
 <style lang="scss" scoped>
 #video {
   .video-js {