提交 7906dee9 authored 作者: pengxiaohui's avatar pengxiaohui

直播流视频播放

上级 4343a5d4
<template> <template>
<el-dialog :title="info.title" v-bind="$attrs" v-on="$listeners" width="800px" top="20vh"> <el-dialog :title="info.title" v-bind="$attrs" v-on="$listeners" width="800px" top="20vh">
<!-- <video :src="info.url" controls="controls" autoplay="autoplay"></video> --> <video id="videoPlayer" width="750" class="video-js" controls="controls"></video>
<!-- <video-player class="video-player-box"
ref="videoPlayer"
:options="playerOptions"
:playsinline="true"
customEventName="customstatechangedeventname">
</video-player> -->
<video id="videoPlayer" class="video-js" muted></video>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
// import Videojs from "video.js"
export default { export default {
// components: {
// videoPlayer
// },
props: { props: {
info: { info: {
type: Object, type: Object,
...@@ -26,30 +15,19 @@ export default { ...@@ -26,30 +15,19 @@ export default {
}, },
data() { data() {
return { return {
playerOptions: {
// videojs options
muted: true,
language: 'en',
playbackRates: [0.7, 1.0, 1.5, 2.0],
sources: [{
type: "video/mp4",
src: "https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm"
}],
poster: "https://img1.ezijing.com/curriculum/courses/bf3b399810-houzi.jpg",
}
} }
}, },
mounted() { mounted() {
console.log(this.info)
const url = this.info.url const url = this.info.url
setTimeout(() => { setTimeout(() => {
const player = window.videojs('videoPlayer'); const player = window.videojs('videoPlayer')
player.src({ player.src({
src: url, src: url,
type: 'application/x-mpegURL', type: 'application/x-mpegURL'
withCredentials: true // withCredentials: true
}) })
}, 1000) player.play()
}, 300)
} }
} }
</script> </script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论