|
@@ -13,6 +13,7 @@ const port = 10010
|
|
const one_mode_count = 2 //1V1模式只能2人
|
|
const one_mode_count = 2 //1V1模式只能2人
|
|
const more_mode_count = 30 //多人模式只能30人
|
|
const more_mode_count = 30 //多人模式只能30人
|
|
const muted = false //默认开启mic
|
|
const muted = false //默认开启mic
|
|
|
|
+const can_speak = true //默认开启mic
|
|
|
|
|
|
const io = require("socket.io")(server, {
|
|
const io = require("socket.io")(server, {
|
|
path: "/im-rtc",
|
|
path: "/im-rtc",
|
|
@@ -72,13 +73,14 @@ class ClientRequest {
|
|
roomId,
|
|
roomId,
|
|
userId,
|
|
userId,
|
|
userName,
|
|
userName,
|
|
- muted
|
|
|
|
|
|
+ muted,
|
|
|
|
+ can_speak
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
let users = __rooms[this.option.roomId]
|
|
let users = __rooms[this.option.roomId]
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
let count
|
|
let count
|
|
if (this.option.mode == '1') {
|
|
if (this.option.mode == '1') {
|
|
count = one_mode_count
|
|
count = one_mode_count
|
|
@@ -130,6 +132,11 @@ class ClientRequest {
|
|
|
|
|
|
// 静音
|
|
// 静音
|
|
this.socket.on("muted", (muted, userId) => this.onMuted(muted, userId))
|
|
this.socket.on("muted", (muted, userId) => this.onMuted(muted, userId))
|
|
|
|
+ //禁言
|
|
|
|
+ this.socket.on("forbidden", (data) =>
|
|
|
|
+ // this.socket.broadcast.to(this.option.roomId).emit("forbidden", data)
|
|
|
|
+ io.to(this.option.roomId).emit("forbidden", data)
|
|
|
|
+ )
|
|
// 成员关闭推流后通知静音
|
|
// 成员关闭推流后通知静音
|
|
this.socket.on("mutedChanged", (muted, userId) => io.to(this.option.roomId).emit("mutedChanged", muted, userId))
|
|
this.socket.on("mutedChanged", (muted, userId) => io.to(this.option.roomId).emit("mutedChanged", muted, userId))
|
|
}
|
|
}
|
|
@@ -227,4 +234,6 @@ class ClientRequest {
|
|
isLeader() {
|
|
isLeader() {
|
|
return this.option.role == "leader"
|
|
return this.option.role == "leader"
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|