Skip to content

Commit

Permalink
fix(webapp): current divece
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Dec 17, 2023
1 parent 810e107 commit e62e0e0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions webapp/components/device.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,15 @@ export default function DeviceBar() {
}, [])

const toggleEnableAudio = async () => {
setLoadingAudio(true)
if (enabledAudio) {
onChangedDeviceAudio(disableDevice)
} else {
onChangedDeviceAudio(currentDeviceAudio)
}
setLoadingAudio(false)
}

const onChangedDeviceAudio = async (current: string) => {
setLoadingAudio(true)
// Closed old tracks
const stream = localStream.stream
stream.getAudioTracks().map(track => {
Expand All @@ -140,20 +139,20 @@ export default function DeviceBar() {
audio: current === disableDevice ? false : true,
})

setCurrentDeviceAudio(current)
current === disableDevice ? null : setCurrentDeviceAudio(current)
setLoadingAudio(false)
}

const toggleEnableVideo = async () => {
setLoadingVideo(true)
if (enabledVideo) {
onChangedDeviceVideo(disableDevice)
} else {
onChangedDeviceVideo(currentDeviceVideo)
}
setLoadingVideo(false)
}

const onChangedDeviceVideo = async (current: string) => {
setLoadingVideo(true)
// Closed old tracks
const stream = localStream.stream
stream.getVideoTracks().map(track => {
Expand All @@ -176,7 +175,8 @@ export default function DeviceBar() {
screen: current === "screen" ? true : false,
})

setCurrentDeviceVideo(current)
current === disableDevice ? null : setCurrentDeviceVideo(current)
setLoadingVideo(false)
}

return (
Expand Down

0 comments on commit e62e0e0

Please sign in to comment.