"unswap" audio/video

Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
Timo K
2023-10-10 12:32:45 +02:00
parent 7bdb633999
commit daf97fb22e

View File

@@ -139,11 +139,11 @@ export function useLiveKit(
const participant = room.localParticipant;
const syncMuteStateAudio = () => {
if (participant.isCameraEnabled !== muteStates.video.enabled) {
if (participant.isMicrophoneEnabled !== muteStates.audio.enabled) {
participant
.setCameraEnabled(muteStates.video.enabled)
.setMicrophoneEnabled(muteStates.audio.enabled)
.catch((e) =>
logger.error("Failed to sync video mute state with LiveKit", e)
logger.error("Failed to sync audio mute state with LiveKit", e)
)
// Run the check again after the change is done. Because the user
// can update the state (presses mute button) while the device is enabling
@@ -154,11 +154,11 @@ export function useLiveKit(
}
};
const syncMuteStateVideo = () => {
if (participant.isMicrophoneEnabled !== muteStates.audio.enabled) {
if (participant.isCameraEnabled !== muteStates.video.enabled) {
participant
.setMicrophoneEnabled(muteStates.audio.enabled)
.setCameraEnabled(muteStates.video.enabled)
.catch((e) =>
logger.error("Failed to sync audio mute state with LiveKit", e)
logger.error("Failed to sync video mute state with LiveKit", e)
)
// see above
.then(() => syncMuteStateVideo());