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",