flv.js 播放多個rtsp流【二】

flv.js 播放多個rtsp流【二】

①添加模板

<template>
    <div>
        <video class="demo-video" ref="player" muted autoplay></video>
        <video class="demo-video" ref="player1" muted autoplay></video>
    </div>
</template>

②我這兒簡單演示,所以寫的簡單點,大家可以使用動態獲取數據或json文件優化哦

export default {
    data () {
        return {
          productLists: [
            {
              id: "1",
              rtsp: "rtsp://localhost/0210test6",
              player: null
            },{
              id: "2",
              rtsp: "rtsp://localhost/0210test1",
              player1: null
            }
          ]
        }
    }

③修改鉤子函數mounted ()

mounted () {
        if (flvjs.isSupported()) {
            let video = this.$refs.player;
            if (video) {
                this.player = flvjs.createPlayer({
                    type: "flv",
      
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章