mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
fix(voice): make deafen reach watched screen share audio (#1786)
This commit is contained in:
1 parent
ef6536644c
commit
b144e650f2
1 file changed
+25
-3
@@ -51,7 +51,11 @@ import {
|
|||||||
getLocalMicrophonePublications,
|
getLocalMicrophonePublications,
|
||||||
getPrimaryLocalMicrophonePublication,
|
getPrimaryLocalMicrophonePublication,
|
||||||
} from '@app/features/voice/engine/VoiceTrackPublicationUtils';
|
} from '@app/features/voice/engine/VoiceTrackPublicationUtils';
|
||||||
import {asVoiceTrackSource, VoiceTrackSource} from '@app/features/voice/engine/VoiceTrackSource';
|
import {
|
||||||
|
asVoiceTrackSource,
|
||||||
|
isScreenShareAudioPublicationLike,
|
||||||
|
VoiceTrackSource,
|
||||||
|
} from '@app/features/voice/engine/VoiceTrackSource';
|
||||||
import {
|
import {
|
||||||
assertBoolean,
|
assertBoolean,
|
||||||
assertNonEmptyString,
|
assertNonEmptyString,
|
||||||
@@ -1286,6 +1290,15 @@ export class VoiceEngineV2AppMediaExecutionAdapter extends Store {
|
|||||||
assertNonEmptyString(userId, 'applyLocalAudioPreferencesForUser.userId');
|
assertNonEmptyString(userId, 'applyLocalAudioPreferencesForUser.userId');
|
||||||
assertNullableObjectLike<Room>(room, 'applyLocalAudioPreferencesForUser.room');
|
assertNullableObjectLike<Room>(room, 'applyLocalAudioPreferencesForUser.room');
|
||||||
if (!room) {
|
if (!room) {
|
||||||
|
const connection = getVoiceConnectionContextFromMediaEngine();
|
||||||
|
logger.warn(`Skipped audio preferences for user ${userId} because no room was attached`, {
|
||||||
|
userId,
|
||||||
|
guildId: connection?.guildId ?? null,
|
||||||
|
channelId: connection?.channelId ?? null,
|
||||||
|
connectionId: connection?.connectionId ?? null,
|
||||||
|
connecting: connection?.connecting ?? false,
|
||||||
|
reconnecting: connection?.reconnecting ?? false,
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
room.remoteParticipants.forEach((participant) => {
|
room.remoteParticipants.forEach((participant) => {
|
||||||
@@ -1496,8 +1509,16 @@ export class VoiceEngineV2AppMediaExecutionAdapter extends Store {
|
|||||||
});
|
});
|
||||||
room.remoteParticipants.forEach((participant) => {
|
room.remoteParticipants.forEach((participant) => {
|
||||||
participant.audioTrackPublications.forEach((publication) => {
|
participant.audioTrackPublications.forEach((publication) => {
|
||||||
if (asVoiceTrackSource(publication.source) !== VoiceTrackSource.Microphone) return;
|
const isScreenShareAudio = isScreenShareAudioPublicationLike(publication);
|
||||||
|
const isMicrophone = asVoiceTrackSource(publication.source) === VoiceTrackSource.Microphone;
|
||||||
|
if (!isScreenShareAudio && !isMicrophone) return;
|
||||||
try {
|
try {
|
||||||
|
if (isScreenShareAudio) {
|
||||||
|
if (deafened && publication.isDesired) {
|
||||||
|
publication.setEnabled(false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (deafened) {
|
if (deafened) {
|
||||||
if (publication.isDesired) {
|
if (publication.isDesired) {
|
||||||
publication.setEnabled(false);
|
publication.setEnabled(false);
|
||||||
@@ -1508,10 +1529,11 @@ export class VoiceEngineV2AppMediaExecutionAdapter extends Store {
|
|||||||
publication.setSubscribed(true);
|
publication.setSubscribed(true);
|
||||||
publication.setEnabled(true);
|
publication.setEnabled(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('Failed to apply deaf state to remote microphone publication', {
|
logger.error('Failed to apply deaf state to remote audio publication', {
|
||||||
error,
|
error,
|
||||||
deafened,
|
deafened,
|
||||||
identity: participant.identity,
|
identity: participant.identity,
|
||||||
|
isScreenShareAudio,
|
||||||
trackSid: publication.trackSid,
|
trackSid: publication.trackSid,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user