jsmpeg.min下载地址
提取码:lzal
import './views/video/jsmpeg.min'
<canvas id="vueMiniPlayer" style="width: 100%;" @click="play"></canvas>
mounted() {
this.player = new JSMpeg.Player("video/video1.ts", {canvas: document.getElementById('vueMiniPlayer')})
},
methods(){
play0() {
if (this.player.paused)
this.player.play()
else
this.player.pause()
},
}
在vue.config.js中加入
devServer: {
proxy: {
'/video': {
target:'www.baidu.com',
ws: true,
changeOrigin: true,
pathRewrite: {
'^/video': ''
}
}
}
},
ffmpeg下载地址
提取码:insc
下载下来后直接进入bin目录,打开cmd执行
ffmpeg -i video.mp4 -f mpegts -codec:v mpeg1video -codec:a mp2 video.ts
视频的fps最好高一点,30左右吧,太低了解压出来播放会有问题