From 2b92bf3694b161959ed11d926ac4b2ebeecdf96d Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 7 Jul 2022 19:42:15 +0100 Subject: [PATCH 1/2] Fix talking collision not colliding properly The code was only entering the blocked state if the user was speaking, which often won't be the case when another person starts speaking because we'll have pressed the button but not got the ack back from the server yet. Add the transmitblocked flag instead so we don't enter that state again if we've already decided we've been blocked. We were also starting with blocked = false and so resetting it when it shouldn't have been reset. Also requires https://github.com/matrix-org/matrix-js-sdk/pull/2502 --- src/room/usePTT.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/room/usePTT.ts b/src/room/usePTT.ts index 096e662d5..847a1aa8f 100644 --- a/src/room/usePTT.ts +++ b/src/room/usePTT.ts @@ -130,7 +130,7 @@ export const usePTT = ( const onMuteStateChanged = useCallback(() => { const activeSpeakerFeed = getActiveSpeakerFeed(userMediaFeeds, groupCall); - let blocked = false; + let blocked = transmitBlocked; if (activeSpeakerUserId === null && activeSpeakerFeed !== null) { if (activeSpeakerFeed.userId === client.getUserId()) { playClip(PTTClipID.START_TALKING_LOCAL); @@ -141,8 +141,8 @@ export const usePTT = ( playClip(PTTClipID.END_TALKING); } else if ( pttButtonHeld && - activeSpeakerUserId === client.getUserId() && - activeSpeakerFeed?.userId !== client.getUserId() + activeSpeakerFeed?.userId !== client.getUserId() && + !transmitBlocked ) { // We were talking but we've been cut off: mute our own mic // (this is the easier way of cutting other speakers off if an @@ -167,6 +167,7 @@ export const usePTT = ( client, userMediaFeeds, setMicMuteWrapper, + transmitBlocked, ]); useEffect(() => { From c9ae6532a0b29474be5b5fe392bebc213b6cd4eb Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 8 Jul 2022 09:48:40 +0100 Subject: [PATCH 2/2] Bump js-sdk --- package.json | 2 +- yarn.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 00b61e35c..cf17c3cc0 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "classnames": "^2.3.1", "color-hash": "^2.0.1", "events": "^3.3.0", - "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#9a15094374f52053ca9f833269d2b1c6c7f964d2", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#984dd26a138411ef73903ff4e635f2752e0829f2", "mermaid": "^8.13.8", "normalize.css": "^8.0.1", "pako": "^2.0.4", diff --git a/yarn.lock b/yarn.lock index 76ed2dba9..69ec2dd62 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8602,9 +8602,9 @@ matrix-events-sdk@^0.0.1-beta.7: resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1-beta.7.tgz#5ffe45eba1f67cc8d7c2377736c728b322524934" integrity sha512-9jl4wtWanUFSy2sr2lCjErN/oC8KTAtaeaozJtrgot1JiQcEI4Rda9OLgQ7nLKaqb4Z/QUx/fR3XpDzm5Jy1JA== -"matrix-js-sdk@github:matrix-org/matrix-js-sdk#9a15094374f52053ca9f833269d2b1c6c7f964d2": +"matrix-js-sdk@github:matrix-org/matrix-js-sdk#984dd26a138411ef73903ff4e635f2752e0829f2": version "18.1.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/9a15094374f52053ca9f833269d2b1c6c7f964d2" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/984dd26a138411ef73903ff4e635f2752e0829f2" dependencies: "@babel/runtime" "^7.12.5" "@types/sdp-transform" "^2.4.5"