|
|
@@ -76,9 +76,6 @@
|
|
|
alt=""
|
|
|
/>
|
|
|
</span>
|
|
|
- <!-- <span>
|
|
|
- <img src="../../assets/images/realTime/B.png" alt="">
|
|
|
- </span> -->
|
|
|
<span>
|
|
|
<img
|
|
|
@click="videoAxios(scope.row)"
|
|
|
@@ -331,17 +328,17 @@ export default {
|
|
|
microphone: true, // 是否打开麦克风
|
|
|
camera: true, // 是否打开摄像头
|
|
|
appID: 2672645646, //项目唯一标识 AppID
|
|
|
- server: "1e8344b2a193220e5e96338ba53c3dcc", // 接入服务器地址Server
|
|
|
+ // server: "1e8344b2a193220e5e96338ba53c3dcc", // 接入服务器地址Server
|
|
|
videoUrl: "wss://webliveroom2672645646-api.imzego.com/ws", // 请求
|
|
|
zg: null,
|
|
|
// UserID: "sample" + Math.floor(Math.random() * 10000000000000).toString(),
|
|
|
UserID: "user00002",
|
|
|
- StreamID: "web-4796754531236",
|
|
|
- // StreamID: "web-" + Math.floor(Math.random() * 10000000000000).toString(),
|
|
|
+ // UserID: "168",
|
|
|
+ // StreamID: "web-4796754531236",
|
|
|
+ StreamID: "web-" + Math.floor(Math.random() * 10000000000000).toString(),
|
|
|
localStream: null,
|
|
|
- Token:
|
|
|
- "03AAAAAGHyVbgAEGdqdmp0cnpia2lvcnd2aGUAsEZBIPxO1xCGkPt7alN2ldHRSJ/di1xoXhw5hxlwTyXUFb4FUPCg6xbKyjEK8ne34apzy0JiJw7V5apRQSCrxv3k+fYYVtM8IgaXza1yD77x50HIAe3raJLvCGDn56jC5ElN//QdspBKkjHBQ0GFHKAlRN5oYDYja7sv3wKsCGRAQW26cxnbVm8SUOU/r71kB4C+qXrb7UE1/IgdkS87RJtJfwiafpOvya0nK9wTTZOY",
|
|
|
- RoomID: "00002",
|
|
|
+ Token: "",
|
|
|
+ RoomID: "",
|
|
|
videoTle: "正在和云飞-卢万里视频通话",
|
|
|
|
|
|
// 文本聊天框
|
|
|
@@ -504,6 +501,7 @@ export default {
|
|
|
this.getUserObj = data;
|
|
|
this.userName = localStorage.getItem("username");
|
|
|
this.videoTle = "正在和" + data.real_name + "视频通话";
|
|
|
+ this.UserID = localStorage.getItem('userID')
|
|
|
|
|
|
|
|
|
// 先获取当前用户的房间号和登录所需的Token
|
|
|
@@ -517,8 +515,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
this.websock.send(JSON.stringify(obj))
|
|
|
-
|
|
|
- // 登录房间
|
|
|
+ // // 登录房间
|
|
|
// this.zg.loginRoom(
|
|
|
// this.RoomID,
|
|
|
// this.Token,
|
|
|
@@ -665,7 +662,26 @@ export default {
|
|
|
this.websock.send(JSON.stringify(obj));
|
|
|
} else if (data.action == 'recv_video') {
|
|
|
// 获取当前点击用户的房间号以及登录房间所需的Token
|
|
|
- console.log(JSON.parse(event.data));
|
|
|
+ // console.log(JSON.parse(event.data));
|
|
|
+ var data = JSON.parse(event.data)
|
|
|
+ console.log(data)
|
|
|
+ this.RoomID = data.data.room_id // 房间号
|
|
|
+ this.Token = data.data.room_token // Token
|
|
|
+ // 登录房间
|
|
|
+ console.log(this.RoomID)
|
|
|
+ console.log(this.Token)
|
|
|
+ console.log(this.UserID)
|
|
|
+ this.zg.loginRoom(
|
|
|
+ this.RoomID,
|
|
|
+ this.Token,
|
|
|
+ { userID: this.UserID, userName: this.UserID },
|
|
|
+ { userUpdate: true }
|
|
|
+ ).then((result) => {
|
|
|
+ if (result == true) {
|
|
|
+ this.plugFlow(); //推流
|
|
|
+ this.videoVisible = true
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
this.websock.onerror = (event) => {
|
|
|
@@ -687,6 +703,8 @@ export default {
|
|
|
},
|
|
|
// 监听房间
|
|
|
soundOn() {
|
|
|
+ var timer
|
|
|
+
|
|
|
// 房间状态更新回调
|
|
|
this.zg.on(
|
|
|
"roomStateUpdate",
|
|
|
@@ -695,6 +713,16 @@ export default {
|
|
|
// 与房间连接成功,只有当房间状态是连接成功时,才能进行推流、拉流等操作。
|
|
|
// 接下来的“预览并推流”的代码写在这里
|
|
|
console.log("房间连接成功");
|
|
|
+ //定时器
|
|
|
+ timer = setTimeout(() => {
|
|
|
+ this.$message({
|
|
|
+ message: '没人接听,请稍后重试',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 1500
|
|
|
+ });
|
|
|
+ this.videoVisible = false
|
|
|
+ // }, 60000)
|
|
|
+ }, 6000)
|
|
|
}
|
|
|
if (state == "DISCONNECTED") {
|
|
|
// 与房间断开了连接
|
|
|
@@ -712,6 +740,7 @@ export default {
|
|
|
// 其他用户进出房间的通知
|
|
|
console.log(updateType);
|
|
|
console.log(userList);
|
|
|
+ clearTimeout(timer)
|
|
|
console.log("有其他用户进出房间");
|
|
|
});
|
|
|
|