Commit 21f07b64 authored by 以墨为白's avatar 以墨为白 🎧

2

parent cb3900de
<template> <template>
<div> <div>
<video style="height: 100%;width: 100%;" id="my-player" v-if="this.src.endsWith('flv')" preload="auto" muted autoplay controls> <video style="height: 100%;width: 100%;" id="my-player" v-if="this.src.endsWith('flv')" preload="auto" muted
autoplay controls>
</video> </video>
<video style="height: 100%;width: 100%;" id="my-player" v-if="!this.src.endsWith('flv')" class="video-js" preload="auto" muted autoplay controls> <video style="height: 100%;width: 100%;" id="my-player" v-if="!this.src.endsWith('flv')" class="video-js"
preload="auto" muted autoplay controls>
</video> </video>
</div> </div>
</template> </template>
<script> <script>
import flvjs from "flv.js"; import flvjs from "flv.js";
import videozhCN from "video.js/dist/lang/zh-CN.json";
import videojs from "video.js"; import videojs from "video.js";
import videozhCN from "video.js/dist/lang/zh-CN.json";
import "video.js/dist/video-js.css"; import "video.js/dist/video-js.css";
export default { export default {
props: ['src'], props: ['src'],
...@@ -39,6 +41,7 @@ export default { ...@@ -39,6 +41,7 @@ export default {
this.flvPlayer.play();//播放 this.flvPlayer.play();//播放
} }
} else { } else {
videojs.addLanguage("zh-CN", videozhCN);
this.mp4Player = videojs('my-player', { this.mp4Player = videojs('my-player', {
sources: [{ sources: [{
language: "zh-CN", language: "zh-CN",
...@@ -47,9 +50,8 @@ export default { ...@@ -47,9 +50,8 @@ export default {
playbackRates: [0.5, 1, 1.5, 2] //倍速播放 playbackRates: [0.5, 1, 1.5, 2] //倍速播放
}] }]
}, function () { }, function () {
console.log("videojs播放器初始化成功");
}); });
videojs.addLanguage("zh-CN", videozhCN);
this.mp4Player.play(); this.mp4Player.play();
} }
}, },
......
...@@ -387,6 +387,7 @@ import VideoPlayer from "../../components/common/video_player.vue" ...@@ -387,6 +387,7 @@ import VideoPlayer from "../../components/common/video_player.vue"
export default { export default {
data() { data() {
return { return {
errimg: '',
centerDialogVisible_add: false, centerDialogVisible_add: false,
centerDialogVisible_edit: false, centerDialogVisible_edit: false,
centerDialogVisible_video: false, centerDialogVisible_video: false,
...@@ -921,12 +922,12 @@ export default { ...@@ -921,12 +922,12 @@ export default {
} }
}, },
//视频预览弹出框隐藏事件 //视频预览弹出框隐藏事件
centerDialogVisible_video: function (s) { // centerDialogVisible_video: function (s) {
if (!s) { // if (!s) {
this.video_src = ""; // this.video_src = "";
document.getElementById("video").pause(); // document.getElementById("video").pause();
} // }
}, // },
//音频预览弹出框隐藏事件 //音频预览弹出框隐藏事件
centerDialogVisible_sound: function (s) { centerDialogVisible_sound: function (s) {
if (!s) { if (!s) {
......
...@@ -915,12 +915,12 @@ export default { ...@@ -915,12 +915,12 @@ export default {
} }
}, },
//视频预览弹出框隐藏事件 //视频预览弹出框隐藏事件
centerDialogVisible_video: function (s) { // centerDialogVisible_video: function (s) {
if (!s) { // if (!s) {
this.video_src = ""; // this.video_src = "";
document.getElementById("video").pause(); // document.getElementById("video").pause();
} // }
}, // },
//音频预览弹出框隐藏事件 //音频预览弹出框隐藏事件
centerDialogVisible_sound: function (s) { centerDialogVisible_sound: function (s) {
if (!s) { if (!s) {
......
...@@ -956,12 +956,12 @@ export default { ...@@ -956,12 +956,12 @@ export default {
} }
}, },
//视频预览弹出框隐藏事件 //视频预览弹出框隐藏事件
centerDialogVisible_video: function (s) { // centerDialogVisible_video: function (s) {
if (!s) { // if (!s) {
this.video_src = ""; // this.video_src = "";
document.getElementById("video").pause(); // document.getElementById("video").pause();
} // }
}, // },
//音频预览弹出框隐藏事件 //音频预览弹出框隐藏事件
centerDialogVisible_sound: function (s) { centerDialogVisible_sound: function (s) {
if (!s) { if (!s) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment