Skip to content

Commit

Permalink
refactor(webapp): device update device list
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Dec 15, 2023
1 parent 6ac38b0 commit 4ccf29f
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions webapp/components/device.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,9 @@ export default function DeviceBar() {
})

const updateDeviceList = async () => {
const devices = await navigator.mediaDevices.enumerateDevices()
const audios: Device[] = []
const videos: Device[] = []
devices.filter(i => !!i.deviceId).map(device => {
switch (device.kind) {
case 'audioinput':
audios.push(device)
break
case 'videoinput':
videos.push(device)
break
}
})
const devices = (await navigator.mediaDevices.enumerateDevices()).filter(i => !!i.deviceId)
const audios: Device[] = devices.filter(i => i.kind === 'audioinput')
const videos: Device[] = devices.filter(i => i.kind === 'videoinput')

if (currentDeviceAudio === disableDevice && currentSelectDeviceAudio === disableDevice) {
let device = audios[0]
Expand Down

0 comments on commit 4ccf29f

Please sign in to comment.