guhongwei vor 4 Jahren
Ursprung
Commit
b996efc133
3 geänderte Dateien mit 12248 neuen und 4 gelöschten Zeilen
  1. 12208 0
      package-lock.json
  2. 3 2
      package.json
  3. 37 2
      src/views/live/parts/liveDetail.vue

Datei-Diff unterdrückt, da er zu groß ist
+ 12208 - 0
package-lock.json


+ 3 - 2
package.json

@@ -15,10 +15,11 @@
     "lodash": "^4.17.15",
     "moment": "^2.26.0",
     "naf-core": "^0.1.2",
-    "vant": "^2.8.4",
+    "vant": "^2.8.5",
     "vue": "^2.6.11",
     "vue-meta": "^2.3.4",
     "vue-router": "^3.3.2",
+    "vue-video-player": "^5.0.2",
     "vuex": "^3.1.3"
   },
   "devDependencies": {
@@ -32,7 +33,7 @@
     "eslint": "^6.7.2",
     "eslint-plugin-prettier": "^3.1.1",
     "eslint-plugin-vue": "^6.2.2",
-    "less": "^3.0.4",
+    "less": "^3.11.2",
     "less-loader": "^5.0.0",
     "prettier": "^1.19.1",
     "vue-template-compiler": "^2.6.11"

+ 37 - 2
src/views/live/parts/liveDetail.vue

@@ -4,7 +4,7 @@
       <el-col :span="24" class="info">
         <el-col :span="24" class="video">
           <el-col :span="15" class="videoLeft">
-            左侧
+            <videoPlayer ref="videoPlayer" :options="videoOptions" class="vjs-custom-skin videoPlayer" :playsinline="true" />
           </el-col>
           <el-col :span="9" class="videoRight">
             右侧
@@ -29,14 +29,49 @@
 </template>
 
 <script>
+import 'video.js/dist/video-js.css';
+import 'vue-video-player/src/custom-theme.css';
+import { videoPlayer } from 'vue-video-player';
+import 'videojs-flash';
 import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
   name: 'liveDetail',
   props: {},
-  components: {},
+  components: {
+    videoPlayer,
+  },
   data: function() {
     return {
       input: '',
+      videoSrc: '',
+      videoOptions: {
+        playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
+        autoplay: false, //如果true,浏览器准备好时开始回放。
+        muted: false, // 默认情况下将会消除任何音频。
+        loop: false, // 导致视频一结束就重新开始。
+        preload: 'auto', // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
+        language: 'zh-CN',
+        aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
+        techOrder: ['flash', 'html5'], // 兼容顺序
+        fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
+        sources: [
+          {
+            // 流配置,数组形式,会根据兼容顺序自动切换
+            type: 'rtmp/hls',
+            src: 'rtmp://58.200.131.2:1935/livetv/hunantv',
+            // src: 'rtmp://play.liaoningdoupo.com/live/1',
+          },
+        ],
+        poster: '', //你的封面地址
+        // width: document.documentElement.clientWidth,
+        notSupportedMessage: '此视频暂无法播放,请稍后再试', // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
+        controlBar: {
+          timeDivider: true,
+          durationDisplay: true,
+          remainingTimeDisplay: false,
+          fullscreenToggle: true, //全屏按钮
+        },
+      },
     };
   },
   created() {},