使用video组件:
<script>
export default {
name: 'Home',
data() {
return {
playerOptions: {
playbackRates: [0.5, 1.0, 1.5, 2.0, 3.0], // 可选的播放速度
autoplay: false, // 如果为true,浏览器准备好时开始回放。
muted: false, // 默认情况下将会消除任何音频。
loop: false, // 是否视频一结束就重新开始。
preload: 'auto', // 建议浏览器在
视频格式
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
type:"video/webm"
type:"video/ogg"
type:"video/3gp"
type:"video/mp4"
type:"video/avi"
type:"video/flv"
type:"video/mkv"
type:"video/mov"
type:"video/mpg"
type:"video/swf"
type:"video/ts"
type:"video/wmv"
type:"video/vob"
type:"video/mxf"
type: "video/rm"
|
控制播放和暂停
|
1
2
3
|
this.$refs.videoPlayer.player.play()
this.$refs.videoPlayer.player.pause()
this.$refs.videoPlayer.player.src(src)
|