Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 5aaad12

Browse files
committed
Fix device selection in pre-join screen for Element Call video rooms
As per element-hq/element-call#609
1 parent 12e3ba8 commit 5aaad12

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/MediaDeviceHandler.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@ export default class MediaDeviceHandler extends EventEmitter {
5050
return devices.some(d => Boolean(d.label));
5151
}
5252

53+
// Gets the available audio input/output and video input devices
54+
// from the browser: a thin wrapper around mediaDevices.enumerateDevices()
55+
// that also returns results by type of devices.
56+
// Note that common browser behaviour is for enumerateDevices() to not require
57+
// user media permission, but if you don't have user media permission, all the
58+
// all device names will be the empty string. If you care about device names,
59+
// call and wait for requestPermission() above.
5360
public static async getDevices(): Promise<IMediaDevices> {
54-
// Only needed for Electron atm, though should work in modern browsers
55-
// once permission has been granted to the webapp
56-
5761
try {
5862
const devices = await navigator.mediaDevices.enumerateDevices();
5963
const output = {

src/models/Call.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,8 @@ export class ElementCall extends Call {
762762
): Promise<void> {
763763
try {
764764
await this.messaging!.transport.send(ElementWidgetActions.JoinCall, {
765-
audioInput: audioInput?.deviceId ?? null,
766-
videoInput: videoInput?.deviceId ?? null,
765+
audioInput: audioInput?.label ?? null,
766+
videoInput: videoInput?.label ?? null,
767767
});
768768
} catch (e) {
769769
throw new Error(`Failed to join call in room ${this.roomId}: ${e}`);

0 commit comments

Comments
 (0)