Skip to content

Commit 6d70fee

Browse files
committed
Migrating logic to create the default label to call-ui
1 parent 193487e commit 6d70fee

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

src/hooks/useDevices.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,6 @@ export const useDevices = () => {
5757
const micDevices = useRecoilValue(microphoneDevicesState);
5858
const speakerDevices = useRecoilValue(speakerDevicesState);
5959

60-
const createDefaultLabelIfEmpty = (
61-
devices: MediaDeviceInfo[],
62-
defaultLabel: string
63-
) => {
64-
for (let i = 0; i < devices.length; i++) {
65-
const device = devices[i];
66-
if (!device.label) {
67-
const label = `${defaultLabel} - ${i + 1}`;
68-
devices[i] = Object.assign(device, { label });
69-
}
70-
}
71-
};
72-
7360
/**
7461
* Refreshes list of available devices using enumerateDevices.
7562
* Previous device states are kept in place, otherwise states are initialized as 'granted'.
@@ -93,25 +80,18 @@ export const useDevices = () => {
9380

9481
try {
9582
const { devices } = await daily.enumerateDevices();
96-
9783
/**
9884
* Filter out "empty" devices for when device access has not been granted (yet).
9985
*/
10086
const cams = devices.filter(
10187
(d) => d.kind === 'videoinput' && d.deviceId !== ''
10288
);
103-
createDefaultLabelIfEmpty(cams, 'Camera');
104-
10589
const mics = devices.filter(
10690
(d) => d.kind === 'audioinput' && d.deviceId !== ''
10791
);
108-
createDefaultLabelIfEmpty(mics, 'Microphone');
109-
11092
const speakers = devices.filter(
11193
(d) => d.kind === 'audiooutput' && d.deviceId !== ''
11294
);
113-
createDefaultLabelIfEmpty(speakers, 'Speaker');
114-
11595
const { camera, mic, speaker } = await daily.getInputDevices();
11696

11797
const mapDevice = (

0 commit comments

Comments
 (0)