mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Disable device switching when in controlled audio devices mode
This commit is contained in:
@@ -42,6 +42,7 @@ import {
|
|||||||
} from "./TrackProcessorContext";
|
} from "./TrackProcessorContext";
|
||||||
import { useInitial } from "../useInitial";
|
import { useInitial } from "../useInitial";
|
||||||
import { observeTrackReference$ } from "../state/MediaViewModel";
|
import { observeTrackReference$ } from "../state/MediaViewModel";
|
||||||
|
import { useUrlParams } from "../UrlParams";
|
||||||
|
|
||||||
interface UseLivekitResult {
|
interface UseLivekitResult {
|
||||||
livekitRoom?: Room;
|
livekitRoom?: Room;
|
||||||
@@ -54,6 +55,8 @@ export function useLivekit(
|
|||||||
sfuConfig: SFUConfig | undefined,
|
sfuConfig: SFUConfig | undefined,
|
||||||
e2eeSystem: EncryptionSystem,
|
e2eeSystem: EncryptionSystem,
|
||||||
): UseLivekitResult {
|
): UseLivekitResult {
|
||||||
|
const { controlledAudioDevices } = useUrlParams();
|
||||||
|
|
||||||
const e2eeOptions = useMemo((): E2EEManagerOptions | undefined => {
|
const e2eeOptions = useMemo((): E2EEManagerOptions | undefined => {
|
||||||
if (e2eeSystem.kind === E2eeType.NONE) return undefined;
|
if (e2eeSystem.kind === E2eeType.NONE) return undefined;
|
||||||
|
|
||||||
@@ -303,7 +306,11 @@ export function useLivekit(
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Sync the requested devices with LiveKit's devices
|
// Sync the requested devices with LiveKit's devices
|
||||||
if (room !== undefined && connectionState === ConnectionState.Connected) {
|
if (
|
||||||
|
room !== undefined &&
|
||||||
|
connectionState === ConnectionState.Connected &&
|
||||||
|
!controlledAudioDevices
|
||||||
|
) {
|
||||||
const syncDevice = (
|
const syncDevice = (
|
||||||
kind: MediaDeviceKind,
|
kind: MediaDeviceKind,
|
||||||
device: MediaDeviceHandle,
|
device: MediaDeviceHandle,
|
||||||
@@ -363,7 +370,7 @@ export function useLivekit(
|
|||||||
syncDevice("audiooutput", devices.audioOutput);
|
syncDevice("audiooutput", devices.audioOutput);
|
||||||
syncDevice("videoinput", devices.videoInput);
|
syncDevice("videoinput", devices.videoInput);
|
||||||
}
|
}
|
||||||
}, [room, devices, connectionState]);
|
}, [room, devices, connectionState, controlledAudioDevices]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
connState: connectionState,
|
connState: connectionState,
|
||||||
|
|||||||
Reference in New Issue
Block a user