Implement voice broadcast device selection (#9572)
This commit is contained in:
parent
272aae0973
commit
436146105e
15 changed files with 248 additions and 51 deletions
|
@ -21,6 +21,7 @@ import { logger } from "matrix-js-sdk/src/logger";
|
|||
import SettingsStore from "./settings/SettingsStore";
|
||||
import { SettingLevel } from "./settings/SettingLevel";
|
||||
import { MatrixClientPeg } from "./MatrixClientPeg";
|
||||
import { _t } from './languageHandler';
|
||||
|
||||
// XXX: MediaDeviceKind is a union type, so we make our own enum
|
||||
export enum MediaDeviceKindEnum {
|
||||
|
@ -79,6 +80,18 @@ export default class MediaDeviceHandler extends EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
public static getDefaultDevice = (devices: Array<Partial<MediaDeviceInfo>>): string => {
|
||||
// Note we're looking for a device with deviceId 'default' but adding a device
|
||||
// with deviceId == the empty string: this is because Chrome gives us a device
|
||||
// with deviceId 'default', so we're looking for this, not the one we are adding.
|
||||
if (!devices.some((i) => i.deviceId === 'default')) {
|
||||
devices.unshift({ deviceId: '', label: _t('Default Device') });
|
||||
return '';
|
||||
} else {
|
||||
return 'default';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves devices from the SettingsStore and tells the js-sdk to use them
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue