Skip to content

Commit

Permalink
オーディオデバイスの設定を認識しないもんだいを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
nokhnaton committed Jan 27, 2025
1 parent dc04496 commit 1069991
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/composables/qall/useLiveKitSDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ async function leaveRoom() {
const addMicTrack = async () => {
let stream: MediaStream | undefined

const noiseSuppression = useRtcSettings().noiseSuppression
.value as NoiseSuppressionType
const { noiseSuppression, audioInputDeviceId } = useRtcSettings()

Check warning on line 264 in src/composables/qall/useLiveKitSDK.ts

View check run for this annotation

Codecov / codecov/patch

src/composables/qall/useLiveKitSDK.ts#L264

Added line #L264 was not covered by tests
try {
if (!room.value?.localParticipant?.permissions?.canPublish) {
throw new Error('権限がありません')
Expand All @@ -272,12 +271,18 @@ const addMicTrack = async () => {
audioContext.value = new AudioContext()
}

stream = await navigator.mediaDevices.getUserMedia({ audio: true })
stream = await navigator.mediaDevices.getUserMedia({
audio: {
deviceId: {
ideal: audioInputDeviceId.value
}
}
})

Check warning on line 280 in src/composables/qall/useLiveKitSDK.ts

View check run for this annotation

Codecov / codecov/patch

src/composables/qall/useLiveKitSDK.ts#L274-L280

Added lines #L274 - L280 were not covered by tests
const source = audioContext.value.createMediaStreamSource(stream)

let lastNode: AudioNode = source

if (noiseSuppression === 'rnnoise') {
if (noiseSuppression.value === 'rnnoise') {

Check warning on line 285 in src/composables/qall/useLiveKitSDK.ts

View check run for this annotation

Codecov / codecov/patch

src/composables/qall/useLiveKitSDK.ts#L285

Added line #L285 was not covered by tests
const [rnnoiseBinary] = await Promise.all([
loadRnnoiseWasmBinary(),
audioContext.value?.audioWorklet.addModule(rnnoiseWorkletPath)
Expand All @@ -288,7 +293,7 @@ const addMicTrack = async () => {
})
source.connect(rnnoiseNode)
lastNode = rnnoiseNode
} else if (noiseSuppression === 'speex') {
} else if (noiseSuppression.value === 'speex') {

Check warning on line 296 in src/composables/qall/useLiveKitSDK.ts

View check run for this annotation

Codecov / codecov/patch

src/composables/qall/useLiveKitSDK.ts#L296

Added line #L296 was not covered by tests
const [speexBinary] = await Promise.all([
loadSpeexWasmBinary(),
audioContext.value?.audioWorklet.addModule(speexWorkletPath)
Expand Down

0 comments on commit 1069991

Please sign in to comment.