基于Bilibili开源flv.js实时视频拉流

1.npm install --save flv.js
2.import flvjs from 'flv.js'

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()
      }

你可能感兴趣的:(基于Bilibili开源flv.js实时视频拉流)