Skip to content

Commit

Permalink
feat: 선택 가능한 카메라 및 마이크가 없을 때 사용자에게 메시지 표시
Browse files Browse the repository at this point in the history
  • Loading branch information
seoko97 committed Dec 1, 2024
1 parent 13d7a72 commit 9e03d57
Showing 1 changed file with 39 additions and 25 deletions.
64 changes: 39 additions & 25 deletions apps/web/src/components/live/SettingDialog/SelectMedia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,48 @@ function SelectMedia() {
<div className="flex h-full flex-col gap-y-4 overflow-y-auto">
<div>
<h2 className="text-h4 text-alt">카메라</h2>
<video ref={videoRef} autoPlay playsInline className="aspect-video w-full rounded-lg" />
<select
disabled={videoDevices.length === 0}
value={selectedVideoDeviceId ?? '선택'}
onChange={(e) => setSelectedVideoDeviceId(e.target.value)}
className="mt-2 w-full"
>
{videoDevices.map((device) => (
<option key={device.value} value={device.value}>
{device.label}
</option>
))}
</select>
<video
ref={videoRef}
autoPlay
playsInline
className="aspect-video w-full rounded-lg bg-alt"
/>
{videoDevices.length === 0 && (
<p className="mt-2 text-body2 text-alt">사용 가능한 카메라가 없습니다.</p>
)}
{videoDevices.length !== 0 && (
<select
value={selectedVideoDeviceId ?? '선택'}
onChange={(e) => setSelectedVideoDeviceId(e.target.value)}
className="mt-2 w-full"
>
{videoDevices.map((device) => (
<option key={device.value} value={device.value}>
{device.label}
</option>
))}
</select>
)}
</div>
<div>
<h2 className="text-h4 text-alt">마이크</h2>
<select
disabled={audioDevices.length === 0}
value={selectedAudioDeviceId ?? '선택'}
className="mt-2 w-full"
onChange={(e) => setSelectedAudioDeviceId(e.target.value)}
>
{audioDevices.map((device) => (
<option key={device.value} value={device.value}>
{device.label}
</option>
))}
</select>
{audioDevices.length === 0 && (
<p className="mt-2 text-body2 text-alt">사용 가능한 마이크가 없습니다.</p>
)}
{audioDevices.length !== 0 && (
<select
disabled={audioDevices.length === 0}
value={selectedAudioDeviceId ?? '선택'}
className="mt-2 w-full"
onChange={(e) => setSelectedAudioDeviceId(e.target.value)}
>
{audioDevices.map((device) => (
<option key={device.value} value={device.value}>
{device.label}
</option>
))}
</select>
)}
</div>
</div>
);
Expand Down

0 comments on commit 9e03d57

Please sign in to comment.