|
@@ -72,7 +72,7 @@ export default {
|
|
|
students: [
|
|
|
{
|
|
|
id: 1,
|
|
|
- roomId: "1",
|
|
|
+ roomId: "8888",
|
|
|
stdAvatar: "/img/avatars/1.jpg",
|
|
|
stdName: "邹朵朵",
|
|
|
},
|
|
@@ -103,7 +103,7 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- // this.initRong();
|
|
|
+ this.initRong();
|
|
|
},
|
|
|
methods: {
|
|
|
async initRong() {
|
|
@@ -114,7 +114,12 @@ export default {
|
|
|
this.$message.error("初始化错误!");
|
|
|
return;
|
|
|
}
|
|
|
- this.rongRTC = initRongRTC({ debug: true });
|
|
|
+ const { Mode, ROLE } = window.RongRTC;
|
|
|
+ this.rongRTC = initRongRTC({
|
|
|
+ debug: false,
|
|
|
+ mode: Mode.LIVE,
|
|
|
+ liveRole: ROLE.ANCHOR,
|
|
|
+ });
|
|
|
},
|
|
|
async answer(student, isVideo) {
|
|
|
this.dialogVisible = true;
|
|
@@ -139,7 +144,6 @@ export default {
|
|
|
if (!joinRoomSuccess) return;
|
|
|
|
|
|
// 初始化stream
|
|
|
- // TODO:后加入房间的人,是否会执行先加入房间的人的published回调
|
|
|
this.stream = new Stream({
|
|
|
published: (user) => {
|
|
|
console.log(user);
|
|
@@ -147,9 +151,9 @@ export default {
|
|
|
let {
|
|
|
stream: { mediaStream },
|
|
|
} = 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) => {
|
|
@@ -180,10 +184,12 @@ export default {
|
|
|
.catch((error) => {
|
|
|
console.log(error);
|
|
|
});
|
|
|
+ console.log(streamPublishResult);
|
|
|
+ // {configUrl, liveUrl}
|
|
|
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() {
|