mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-19 06:20:25 +00:00
@@ -6,6 +6,9 @@ Please see LICENSE in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { BehaviorSubject, Subject } from "rxjs";
|
||||
import { logger as rootLogger } from "matrix-js-sdk/lib/logger";
|
||||
|
||||
const logger = rootLogger.getChild("[controlled-media]");
|
||||
|
||||
export interface Controls {
|
||||
canEnterPip(): boolean;
|
||||
@@ -79,12 +82,17 @@ window.controls = {
|
||||
setPipEnabled$.next(false);
|
||||
},
|
||||
setAvailableAudioDevices(devices: OutputDevice[]): void {
|
||||
logger.info("setAvailableAudioDevices called from native:", devices);
|
||||
|
||||
controlledAvailableOutputDevices$.next(devices);
|
||||
},
|
||||
setAudioDevice(id: string): void {
|
||||
logger.info("setAudioDevice called from native", id);
|
||||
controlledAudioDevice$.next(id);
|
||||
},
|
||||
setAudioEnabled(enabled: boolean): void {
|
||||
logger.info("setAudioEnabled called from native:", enabled);
|
||||
|
||||
if (!setAudioEnabled$.observed)
|
||||
throw new Error(
|
||||
"Output controls are disabled. No setAudioEnabled$ observer",
|
||||
|
||||
@@ -385,6 +385,10 @@ function useControlledOutput(): MediaDeviceHandle {
|
||||
// selected - for example, Element X iOS listens to this to determine whether it
|
||||
// should enable the proximity sensor.
|
||||
if (preferredId) {
|
||||
logger.info(
|
||||
"[controlled-media] setAudioDeviceSelect called:",
|
||||
preferredId,
|
||||
);
|
||||
window.controls.onAudioDeviceSelect?.(preferredId);
|
||||
// Call deprecated method for backwards compatibility.
|
||||
window.controls.onOutputDeviceSelect?.(preferredId);
|
||||
|
||||
@@ -73,8 +73,6 @@ export function useLivekit(
|
||||
|
||||
// Only ever create the room once via useInitial.
|
||||
const room = useInitial(() => {
|
||||
logger.info("[LivekitRoom] Create LiveKit room");
|
||||
|
||||
let e2ee: E2EEManagerOptions | undefined;
|
||||
if (e2eeSystem.kind === E2eeType.PER_PARTICIPANT) {
|
||||
logger.info("Created MatrixKeyProvider (per participant)");
|
||||
@@ -110,6 +108,7 @@ export function useLivekit(
|
||||
},
|
||||
e2ee,
|
||||
};
|
||||
logger.info("[LivekitRoom] Create LiveKit room with options", roomOptions);
|
||||
// We have to create the room manually here due to a bug inside
|
||||
// @livekit/components-react. JSON.stringify() is used in deps of a
|
||||
// useEffect() with an argument that references itself, if E2EE is enabled
|
||||
|
||||
Reference in New Issue
Block a user