mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-15 00:04:59 +08:00
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
This commit is contained in:
parent
4dcec504ca
commit
2b92bf3694
@ -130,7 +130,7 @@ export const usePTT = (
|
|||||||
const onMuteStateChanged = useCallback(() => {
|
const onMuteStateChanged = useCallback(() => {
|
||||||
const activeSpeakerFeed = getActiveSpeakerFeed(userMediaFeeds, groupCall);
|
const activeSpeakerFeed = getActiveSpeakerFeed(userMediaFeeds, groupCall);
|
||||||
|
|
||||||
let blocked = false;
|
let blocked = transmitBlocked;
|
||||||
if (activeSpeakerUserId === null && activeSpeakerFeed !== null) {
|
if (activeSpeakerUserId === null && activeSpeakerFeed !== null) {
|
||||||
if (activeSpeakerFeed.userId === client.getUserId()) {
|
if (activeSpeakerFeed.userId === client.getUserId()) {
|
||||||
playClip(PTTClipID.START_TALKING_LOCAL);
|
playClip(PTTClipID.START_TALKING_LOCAL);
|
||||||
@ -141,8 +141,8 @@ export const usePTT = (
|
|||||||
playClip(PTTClipID.END_TALKING);
|
playClip(PTTClipID.END_TALKING);
|
||||||
} else if (
|
} else if (
|
||||||
pttButtonHeld &&
|
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
|
// 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
|
// (this is the easier way of cutting other speakers off if an
|
||||||
@ -167,6 +167,7 @@ export const usePTT = (
|
|||||||
client,
|
client,
|
||||||
userMediaFeeds,
|
userMediaFeeds,
|
||||||
setMicMuteWrapper,
|
setMicMuteWrapper,
|
||||||
|
transmitBlocked,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user