From 37987861f1e566f4882e742e3b4eed930e998631 Mon Sep 17 00:00:00 2001 From: acgist <289547414@qq.com> Date: Tue, 22 Aug 2023 07:54:05 +0800 Subject: [PATCH] =?UTF-8?q?[*]=20=E6=97=A5=E5=B8=B8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acgist/taoyao/client/signal/Taoyao.java | 4 +- taoyao-client-web/src/components/Taoyao.js | 70 ++++++++++--------- 2 files changed, 40 insertions(+), 34 deletions(-) diff --git a/taoyao-client-android/taoyao/client/src/main/java/com/acgist/taoyao/client/signal/Taoyao.java b/taoyao-client-android/taoyao/client/src/main/java/com/acgist/taoyao/client/signal/Taoyao.java index a2cf036..8e45529 100644 --- a/taoyao-client-android/taoyao/client/src/main/java/com/acgist/taoyao/client/signal/Taoyao.java +++ b/taoyao-client-android/taoyao/client/src/main/java/com/acgist/taoyao/client/signal/Taoyao.java @@ -1205,7 +1205,7 @@ public final class Taoyao implements ITaoyao { final String sessionId = MapUtils.get(body, "sessionId"); final SessionClient sessionClient = this.sessions.get(sessionId); if(sessionClient == null) { - Log.w(Taoyao.class.getSimpleName(), "无效会话:" + sessionId); + Log.w(Taoyao.class.getSimpleName(), "暂停媒体(无效会话):" + sessionId); return; } final String type = MapUtils.get(body, "type"); @@ -1222,7 +1222,7 @@ public final class Taoyao implements ITaoyao { final String sessionId = MapUtils.get(body, "sessionId"); final SessionClient sessionClient = this.sessions.get(sessionId); if(sessionClient == null) { - Log.w(Taoyao.class.getSimpleName(), "无效会话:" + sessionId); + Log.w(Taoyao.class.getSimpleName(), "恢复媒体(无效会话):" + sessionId); return; } final String type = MapUtils.get(body, "type"); diff --git a/taoyao-client-web/src/components/Taoyao.js b/taoyao-client-web/src/components/Taoyao.js index 6dfbe55..9e27658 100644 --- a/taoyao-client-web/src/components/Taoyao.js +++ b/taoyao-client-web/src/components/Taoyao.js @@ -3154,74 +3154,80 @@ class Taoyao extends RemoteClient { } /** - * 暂停会话 + * 暂停媒体信令 * * @param {*} sessionId 会话ID * @param {*} type 媒体类型 */ async sessionPause(sessionId, type) { - const me = this; - const session = me.sessionClients.get(sessionId); - if(!session) { - return; + const session = this.sessionClients.get(sessionId); + if(session) { + console.debug("暂停媒体", type, sessionId); + this.push(protocol.buildMessage("session::pause", { + type, + sessionId + })); + session.pauseRemote(type); + } else { + console.debug("暂停媒体(无效会话)", type, sessionId); } - me.push(protocol.buildMessage("session::pause", { - type, - sessionId - })); - session.pauseRemote(type); } /** - * 暂停会话信令 + * 暂停媒体信令 * * @param {*} message 信令消息 */ async defaultSessionPause(message) { - const me = this; - const { type, sessionId } = message.body; - const session = me.sessionClients.get(sessionId); + const { + type, + sessionId + } = message.body; + const session = this.sessionClients.get(sessionId); if(session) { - console.debug("暂停会话", type, sessionId); + console.debug("暂停媒体", type, sessionId); session.pause(type); } else { - console.debug("暂停会话(无效)", type, sessionId); + console.debug("暂停媒体(无效会话)", type, sessionId); } } /** - * 恢复会话 + * 恢复媒体信令 * * @param {*} sessionId 会话ID * @param {*} type 媒体类型 */ async sessionResume(sessionId, type) { - const me = this; - const session = me.sessionClients.get(sessionId); - if(!session) { - return; + const session = this.sessionClients.get(sessionId); + if(session) { + console.debug("恢复媒体", type, sessionId); + this.push(protocol.buildMessage("session::resume", { + type, + sessionId + })); + session.resumeRemote(type); + } else { + console.debug("恢复媒体(无效会话)", type, sessionId); } - me.push(protocol.buildMessage("session::resume", { - type, - sessionId - })); - session.resumeRemote(type); } /** - * 恢复会话信令 + * 恢复媒体信令 * * @param {*} message 信令消息 */ async defaultSessionResume(message) { - const me = this; - const { type, sessionId } = message.body; - const session = me.sessionClients.get(sessionId); + const { + type, + sessionId + } = message.body; + const session = this.sessionClients.get(sessionId); if(session) { - console.debug("恢复会话", type, sessionId); + console.debug("恢复媒体", type, sessionId); session.resume(type); } else { - console.debug("恢复会话(无效)", type, sessionId); + console.debug("恢复媒体(无效会话)", type, sessionId); } }