|
@@ -97,6 +97,7 @@ export default {
|
|
|
activeName: 'first',
|
|
|
iscamera: false,
|
|
|
typevalue: 'warning',
|
|
|
+ index: 0,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -185,15 +186,20 @@ export default {
|
|
|
userSig: res.data,
|
|
|
});
|
|
|
await this.client_.join({ roomId: this.roomname, role: 'anchor' });
|
|
|
- let i = 0;
|
|
|
this.client_.on('stream-subscribed', event => {
|
|
|
const remoteStream = event.stream;
|
|
|
// 远端流订阅成功,播放远端音视频流
|
|
|
console.log('111' + remoteStream.getType());
|
|
|
- i = i + 1;
|
|
|
- if (i < 8) {
|
|
|
- const id_ = 'look-video-' + i;
|
|
|
- remoteStream.play(id_);
|
|
|
+ const usertempid_ = remoteStream.getUserId();
|
|
|
+ const res_ = usertempid_.indexOf('-');
|
|
|
+ if (res_ === -1) {
|
|
|
+ remoteStream.play('look-video-1');
|
|
|
+ } else {
|
|
|
+ this.index = this.index + 1;
|
|
|
+ if (this.index < 8) {
|
|
|
+ const id_ = 'look-video-' + this.index;
|
|
|
+ remoteStream.play(id_);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
// 监听远端流增加事件
|
|
@@ -217,6 +223,7 @@ export default {
|
|
|
videoTrack.stop();
|
|
|
this.client_.unpublish(this.localStream_).then(() => {
|
|
|
// 取消发布本地流成功
|
|
|
+ this.index = this.index - 1;
|
|
|
});
|
|
|
});
|
|
|
}
|
|
@@ -225,12 +232,13 @@ export default {
|
|
|
} else {
|
|
|
this.iscamera = true;
|
|
|
this.typevalue = 'success';
|
|
|
+ const _userid = 'meet-' + this.userId_;
|
|
|
this.localStream_ = await TRTC.createStream({
|
|
|
audio: true,
|
|
|
video: true,
|
|
|
// cameraId: this.cameraId,
|
|
|
// microphoneId: this.microphoneId,
|
|
|
- userId: this.userId_,
|
|
|
+ userId: _userid,
|
|
|
});
|
|
|
this.localStream_.setVideoProfile('480p');
|
|
|
await this.localStream_.initialize();
|