Skip to content

Commit

Permalink
refactor(webapp): remove device none
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Dec 16, 2023
1 parent 4ccf29f commit e295c0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions webapp/components/device.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef, useState } from 'react'
import { useEffect, useState } from 'react'
import { useAtom } from 'jotai'
import {
Device,
Expand All @@ -19,7 +19,6 @@ import SvgVideo from './svg/video'

export default function DeviceBar() {
const disableDevice = "none"
const refEnabled = useRef(false)

const [permissionAudio, setPermissionAudio] = useState("...")
const [permissionVideo, setPermissionVideo] = useState("...")
Expand Down Expand Up @@ -79,8 +78,8 @@ export default function DeviceBar() {
}
}

setDeviceAudio([deviceNone, ...audios])
setDeviceVideo([deviceNone, ...videos, deviceScreen])
setDeviceAudio([...audios])
setDeviceVideo([...videos, deviceScreen])
}

const init = async () => {
Expand All @@ -95,11 +94,8 @@ export default function DeviceBar() {
}

useEffect(() => {
if (!refEnabled.current) {
refEnabled.current = true
init()
}
}, [])
init()
}, [localStream])

useEffect(() => {
// Reference: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/devicechange_event
Expand Down Expand Up @@ -226,7 +222,7 @@ export default function DeviceBar() {
: <div className='bg-orange-500 shadow-sm w-1 h-1 p-1 rounded-full' style={{ position: 'relative', right: '7px' }}></div>
}
{currentDeviceVideo === disableDevice
? < div className='w-8 h-1 bg-red-500 rounded-full rotate-45'
? <div className='w-8 h-1 bg-red-500 rounded-full rotate-45'
style={{
position: 'relative',
right: '32px',
Expand Down
2 changes: 1 addition & 1 deletion webapp/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function Layout(props: { meetingId: string }) {
}, [])

return (
<div className='flex flex-col justify-around' style={{ height: '100vh' }}>
<div className='flex flex-col justify-between' style={{ height: '100vh' }}>

<center className='text-white'>
<label>meeting Id: </label><code>{props.meetingId}</code>
Expand Down

0 comments on commit e295c0d

Please sign in to comment.