Skip to content

Commit

Permalink
Fix: safari는 default deviceId가 존재하지 않아 처음에는 true로 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
luckylooky2 committed Oct 3, 2024
1 parent 779c0c0 commit b324dd8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hooks/useStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ export function useStream() {
}
};

const connectStream = async (deviceId: string = "default") => {
// safari에서는 default라는 deviceId가 존재하지 않음
const connectStream = async (deviceId?: string) => {
let stream = null;

try {
stream = await navigator.mediaDevices.getUserMedia({
video: false,
audio: { deviceId: { exact: deviceId } },
audio: deviceId ? { deviceId: { exact: deviceId } } : true,
});
dispatch({
type: AudioActionType.SET_STREAM,
Expand Down

0 comments on commit b324dd8

Please sign in to comment.