1.npm install --save flv.js
2.import flvjs from 'flv.js'
<video
id="videoElement"
class="centeredVideo"
style="height: 100%; width: 100%; background-color: black;">
Your browser is too old which doesn't support HTML5 video.</video>
js:
if (flvjs.isSupported()) {
var videoElement = document.getElementById('videoElement')
console.log(videoElement)
var flvPlayer = flvjs.createPlayer({
type: 'flv',
url: 'flv地址'
})
flvPlayer.attachMediaElement(videoElement)
flvPlayer.load()
flvPlayer.play()
}
网友评论