[*] 日常优化
This commit is contained in:
@@ -962,7 +962,7 @@ public final class Taoyao implements ITaoyao {
|
|||||||
final String roomId = MapUtils.get(body, "roomId");
|
final String roomId = MapUtils.get(body, "roomId");
|
||||||
final Room room = this.rooms.get(roomId);
|
final Room room = this.rooms.get(roomId);
|
||||||
if(room == null) {
|
if(room == null) {
|
||||||
Log.w(Taoyao.class.getSimpleName(), "无效房间:" + roomId);
|
Log.w(Taoyao.class.getSimpleName(), "房间终端列表(无效房间):" + roomId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
room.newRemoteClientFromRoomClientList(body);
|
room.newRemoteClientFromRoomClientList(body);
|
||||||
|
|||||||
@@ -2220,7 +2220,6 @@ class Taoyao extends RemoteClient {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
me.dataConsumers.forEach(dataConsumer => {
|
me.dataConsumers.forEach(dataConsumer => {
|
||||||
console.info(dataConsumer);
|
|
||||||
dataConsumer.send(data);
|
dataConsumer.send(data);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -2242,19 +2241,6 @@ class Taoyao extends RemoteClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} roomId 房间ID
|
|
||||||
*
|
|
||||||
* @returns 设备列表
|
|
||||||
*/
|
|
||||||
async roomClientList(roomId) {
|
|
||||||
const me = this;
|
|
||||||
const response = await me.request(protocol.buildMessage("room::client::list", {
|
|
||||||
roomId: roomId || me.roomId
|
|
||||||
}));
|
|
||||||
return response.body;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 房间广播信令
|
* 房间广播信令
|
||||||
*
|
*
|
||||||
@@ -2289,23 +2275,6 @@ class Taoyao extends RemoteClient {
|
|||||||
return response.body;
|
return response.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 房间终端列表信令
|
|
||||||
*
|
|
||||||
* @param {*} message 信令消息
|
|
||||||
*/
|
|
||||||
defaultRoomClientList(message) {
|
|
||||||
const me = this;
|
|
||||||
const { clients } = message.body;
|
|
||||||
clients.forEach((v) => {
|
|
||||||
if (v.clientId === me.clientId) {
|
|
||||||
// 忽略自己
|
|
||||||
} else {
|
|
||||||
me.remoteClients.set(v.clientId, new RemoteClient(v));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 媒体回调
|
* 媒体回调
|
||||||
*
|
*
|
||||||
@@ -2849,6 +2818,38 @@ class Taoyao extends RemoteClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间终端列表信令
|
||||||
|
*
|
||||||
|
* @param {*} roomId 房间ID
|
||||||
|
*
|
||||||
|
* @returns 设备列表
|
||||||
|
*/
|
||||||
|
async roomClientList(roomId) {
|
||||||
|
const response = await this.request(protocol.buildMessage("room::client::list", {
|
||||||
|
roomId: roomId || this.roomId
|
||||||
|
}));
|
||||||
|
return response.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间终端列表信令
|
||||||
|
*
|
||||||
|
* @param {*} message 信令消息
|
||||||
|
*/
|
||||||
|
defaultRoomClientList(message) {
|
||||||
|
const {
|
||||||
|
clients
|
||||||
|
} = message.body;
|
||||||
|
clients.forEach(v => {
|
||||||
|
if (v.clientId === this.clientId) {
|
||||||
|
// 忽略自己
|
||||||
|
} else {
|
||||||
|
this.remoteClients.set(v.clientId, new RemoteClient(v));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭房间信令
|
* 关闭房间信令
|
||||||
*/
|
*/
|
||||||
@@ -2870,7 +2871,7 @@ class Taoyao extends RemoteClient {
|
|||||||
if (roomId !== this.roomId) {
|
if (roomId !== this.roomId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.info("关闭房间", roomId);
|
console.debug("关闭房间", roomId);
|
||||||
this.closeRoomMedia();
|
this.closeRoomMedia();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,10 @@ import com.acgist.taoyao.signal.protocol.ProtocolRoomAdapter;
|
|||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
flow = "终端=>信令服务->终端"
|
flow = {
|
||||||
|
"终端=>信令服务->终端",
|
||||||
|
"终端=[进入房间]>信令服务->终端",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
public class RoomClientListProtocol extends ProtocolRoomAdapter implements ApplicationListener<RoomEnterEvent> {
|
public class RoomClientListProtocol extends ProtocolRoomAdapter implements ApplicationListener<RoomEnterEvent> {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user