|
@@ -185,7 +185,12 @@ export default {
|
|
this.$message.error("初始化错误!");
|
|
this.$message.error("初始化错误!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.rongRTC = initRongRTC({ debug: true });
|
|
|
|
|
|
+ const { Mode, ROLE } = window.RongRTC;
|
|
|
|
+ this.rongRTC = initRongRTC({
|
|
|
|
+ debug: true,
|
|
|
|
+ mode: Mode.LIVE,
|
|
|
|
+ liveRole: ROLE.ANCHOR,
|
|
|
|
+ });
|
|
},
|
|
},
|
|
initVideo() {
|
|
initVideo() {
|
|
const { Stream } = this.rongRTC;
|
|
const { Stream } = this.rongRTC;
|
|
@@ -220,6 +225,7 @@ export default {
|
|
closeVideo() {
|
|
closeVideo() {
|
|
this.stream.unsubscribe({ liveUrl: this.liveUrlFirst });
|
|
this.stream.unsubscribe({ liveUrl: this.liveUrlFirst });
|
|
this.stream.unsubscribe({ liveUrl: this.liveUrlThree });
|
|
this.stream.unsubscribe({ liveUrl: this.liveUrlThree });
|
|
|
|
+ this.stream = null;
|
|
this.firstViewVideoReady = false;
|
|
this.firstViewVideoReady = false;
|
|
this.threeViewVideoReady = false;
|
|
this.threeViewVideoReady = false;
|
|
},
|
|
},
|
|
@@ -247,7 +253,6 @@ export default {
|
|
if (!joinRoomSuccess) return;
|
|
if (!joinRoomSuccess) return;
|
|
|
|
|
|
// 初始化stream
|
|
// 初始化stream
|
|
- // TODO:后加入房间的人,是否会执行先加入房间的人的published回调
|
|
|
|
this.stream = new Stream({
|
|
this.stream = new Stream({
|
|
published: (user) => {
|
|
published: (user) => {
|
|
console.log(user);
|
|
console.log(user);
|
|
@@ -255,9 +260,9 @@ export default {
|
|
let {
|
|
let {
|
|
stream: { mediaStream },
|
|
stream: { mediaStream },
|
|
} = user;
|
|
} = user;
|
|
- this.$refs.VideoGuest.srcObject = mediaStream;
|
|
|
|
- this.$refs.VideoGuest.autoplay = true;
|
|
|
|
- this.videoGuestReady = true;
|
|
|
|
|
|
+ this.$refs.VideoHost.srcObject = mediaStream;
|
|
|
|
+ this.$refs.VideoHost.autoplay = true;
|
|
|
|
+ this.videoHostReady = true;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
unpublished: (user) => {
|
|
unpublished: (user) => {
|
|
@@ -288,10 +293,12 @@ export default {
|
|
.catch((error) => {
|
|
.catch((error) => {
|
|
console.log(error);
|
|
console.log(error);
|
|
});
|
|
});
|
|
|
|
+ console.log(streamPublishResult);
|
|
|
|
+ // {configUrl, liveUrl}
|
|
if (isVideo && streamPublishResult) {
|
|
if (isVideo && streamPublishResult) {
|
|
- this.$refs.VideoHost.autoplay = true;
|
|
|
|
- this.$refs.VideoHost.srcObject = localStream.mediaStream;
|
|
|
|
- this.videoHostReady = true;
|
|
|
|
|
|
+ this.$refs.VideoGuest.autoplay = true;
|
|
|
|
+ this.$refs.VideoGuest.srcObject = localStream.mediaStream;
|
|
|
|
+ this.videoGuestReady = true;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async hangup() {
|
|
async hangup() {
|