问题描述
用webRtc推流 循环video标签拉流,video标签显示无法播放媒体。
相关代码
这是DOM结构
<div class="remote-stream-container">
<video
v-for="users in roomUserList"
:key="users"
id="yuanVideo"
:ref="`pullOtheriVideo${users}`"
v-show="pullOtheriVideo"
>
</video>
</div>
这是js
定义了一个methods拉流方法
handlePullRTC() {
this.roomUserList.forEach((id) => {
this.$nextTick(() => {
let streamObj = new SRS_SDK.SrsRtcPlayerAsync();
let path_url = `${this.path_url}${id}`;
this.$refs[`pullOtheriVideo${id}`].srcObject = streamObj.stream;
this.$refs[`pullOtheriVideo${id}`][0].play();
streamObj.play(path_url);
});
});
},
然后在mounted里面进行拉流