美文网首页
基于Bilibili开源flv.js实时视频拉流

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

作者: 大咔丶 | 来源:发表于2022-09-29 14:32 被阅读0次
    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()
          }
    

    相关文章

      网友评论

          本文标题:基于Bilibili开源flv.js实时视频拉流

          本文链接:https://www.haomeiwen.com/subject/odolartx.html