mirror of
https://github.com/vector-im/element-call.git
synced 2026-02-02 04:05:56 +00:00
Add flags to optimize EC device handling
This commit is contained in:
@@ -22,6 +22,9 @@ export interface OutputDevice {
|
||||
id: string;
|
||||
name: string;
|
||||
forEarpiece?: boolean;
|
||||
isEarpiece?: boolean;
|
||||
isSpeaker?: boolean;
|
||||
isBluetooth?: boolean;
|
||||
}
|
||||
|
||||
export const setPipEnabled$ = new Subject<boolean>();
|
||||
|
||||
@@ -327,10 +327,17 @@ function useControlledOutput(): MediaDeviceHandle {
|
||||
startWith<OutputDevice[]>([]),
|
||||
map((devices) => {
|
||||
const deviceForEarpiece = devices.find((d) => d.forEarpiece);
|
||||
const deviceMapTuple: [string, DeviceLabel][] = devices.map(
|
||||
({ id, name, isEarpiece, isSpeaker /*,isBluetooth*/ }) => {
|
||||
let deviceLabel: DeviceLabel = { type: "name", name };
|
||||
// if (isBluetooth) // Do we want this?
|
||||
if (isEarpiece) deviceLabel = { type: "earpiece" };
|
||||
if (isSpeaker) deviceLabel = { type: "default", name };
|
||||
return [id, deviceLabel];
|
||||
},
|
||||
);
|
||||
return {
|
||||
devicesMap: new Map<string, DeviceLabel>(
|
||||
devices.map(({ id, name }) => [id, { type: "name", name }]),
|
||||
),
|
||||
devicesMap: new Map<string, DeviceLabel>(deviceMapTuple),
|
||||
deviceForEarpiece,
|
||||
};
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user