腾讯云直播updateRemoteVideo报错
在html中点击atherList中的用户列表,将id传输后更新视频在canvasView上,但atherList中可以看到用户的实时画面,点击后却报错INVALID_OPERATION: cannot updateRemoteVideo because remote user(userId: ...) does not publishing stream.
<div ref="canvasView" class="centerVideo_mobile" style="width: 100%; height: 100%" :id="bigView"></div>
<div class="atherList" ref="pohoneOther">
<div :id="localOpenViewId" @click="itemClick(createRoomParams.userId)"></div>
<div v-for="(item, index) in atherPeople" :key="index" :id="item.userId" @click="itemClick(item.userId)">
</div>
</div>
mounted() {
trtc.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE, ({ userId, streamType }) => {
if (
userId.indexOf("down") == -1 &&
userId.indexOf("up") == -1 &&
this.bigView == ""
) {
this.bigView = userId;
}
// 为了播放视频画面,您需在 DOM 中放置一个 HTMLElement,可以是一个 div 标签,假设其 id 为 `${userId}_${streamType}`
const view = userId;
this.$nextTick(() => {
trtc.startRemoteVideo({
userId,
streamType,
view,
option: { fillMode: "cover" },
});
});
});
}
methods: {
async itemClick(i) {
this.bigView = JSON.parse(JSON.stringify(i));
await trtc.updateRemoteVideo({
view: this.bigView,
userId: this.bigView,
streamType: "main",
});
},