[*] 日常优化
This commit is contained in:
@@ -978,7 +978,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.remove(roomId);
|
final Room room = this.rooms.remove(roomId);
|
||||||
if(room == null) {
|
if(room == null) {
|
||||||
Log.w(Taoyao.class.getSimpleName(), "无效房间:" + roomId);
|
Log.w(Taoyao.class.getSimpleName(), "关闭房间(无效房间):" + roomId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
room.close();
|
room.close();
|
||||||
|
|||||||
@@ -2306,31 +2306,6 @@ class Taoyao extends RemoteClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭房间信令
|
|
||||||
*/
|
|
||||||
async roomClose() {
|
|
||||||
const me = this;
|
|
||||||
me.push(protocol.buildMessage("room::close", {
|
|
||||||
roomId: me.roomId,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭房间信令
|
|
||||||
*
|
|
||||||
* @param {*} message 消息
|
|
||||||
*/
|
|
||||||
defaultRoomClose(message) {
|
|
||||||
const me = this;
|
|
||||||
const { roomId } = message.body;
|
|
||||||
if (me.roomId !== roomId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.info("关闭房间", roomId);
|
|
||||||
me.closeRoomMedia();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 媒体回调
|
* 媒体回调
|
||||||
*
|
*
|
||||||
@@ -2874,6 +2849,31 @@ class Taoyao extends RemoteClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭房间信令
|
||||||
|
*/
|
||||||
|
async roomClose() {
|
||||||
|
this.push(protocol.buildMessage("room::close", {
|
||||||
|
roomId: this.roomId,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭房间信令
|
||||||
|
*
|
||||||
|
* @param {*} message 信令消息
|
||||||
|
*/
|
||||||
|
defaultRoomClose(message) {
|
||||||
|
const {
|
||||||
|
roomId
|
||||||
|
} = message.body;
|
||||||
|
if (roomId !== this.roomId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.info("关闭房间", roomId);
|
||||||
|
this.closeRoomMedia();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建房间信令
|
* 创建房间信令
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import com.acgist.taoyao.signal.protocol.ProtocolRoomAdapter;
|
|||||||
"roomId": "房间ID"
|
"roomId": "房间ID"
|
||||||
}
|
}
|
||||||
""",
|
""",
|
||||||
flow = "终端->信令服务+)终端"
|
flow = "终端->信令服务->媒体服务->信令服务+)终端"
|
||||||
)
|
)
|
||||||
public class RoomCloseProtocol extends ProtocolRoomAdapter implements ApplicationListener<RoomCloseEvent> {
|
public class RoomCloseProtocol extends ProtocolRoomAdapter implements ApplicationListener<RoomCloseEvent> {
|
||||||
|
|
||||||
@@ -40,8 +40,9 @@ public class RoomCloseProtocol extends ProtocolRoomAdapter implements Applicatio
|
|||||||
public void onApplicationEvent(RoomCloseEvent event) {
|
public void onApplicationEvent(RoomCloseEvent event) {
|
||||||
final Room room = event.getRoom();
|
final Room room = event.getRoom();
|
||||||
final Client mediaClient = room.getMediaClient();
|
final Client mediaClient = room.getMediaClient();
|
||||||
final Map<String, String> body = Map.of(Constant.ROOM_ID, room.getRoomId());
|
mediaClient.push(this.build(Map.of(
|
||||||
mediaClient.push(this.build(body));
|
Constant.ROOM_ID, room.getRoomId()
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user