Is there a way to change the audio output device w...
# support
a
Hi we are trying to record a video where the user talks to the voice ai and at the end of the call the video is downloadable. I think we are having issues with being able to change the audio output device. Is this yall can help with ? cc Trung and Deep
v
Hi @Ashwin, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Introduction]() * [Implementing Realtime Conversation]() * [Orchestration Models]() * [Core Models]() -----------------------------
### Answer Currently, the Vapi documentation does not provide specific guidance or methods for dynamically changing the audio output device during an ongoing conversation directly through the Vapi platform [(1)]() . This functionality generally pertains to the client-side management of audio devices, which can depend greatly on the operating system and the environment (web, iOS, Android) in which your application is running. For web applications, managing audio output devices can typically be handled through the Web Audio API and the Media Devices API provided by modern browsers. You would need to implement this control within your application logic, not directly through Vapi. If you are developing for iOS or Android, similar native APIs are available that allow for the selection of audio output sources. These would also need to be controlled via the native development environment and not through Vapi directly. For recording the video with the end-of-call downloadable feature, ensure that your implementation captures both the audio and video streams during the call. Vapi itself focuses on managing the voice interactions, and does not directly handle video recording or changing system-level settings like audio output devices. If you're looking for more detailed control over the call and media handling, reviewing the capabilities of the client environments (like HTML5 APIs for web, or specific iOS/Android APIs) will be necessary.
Got it. Tagging @User for additional help.
s
@Ashwin Can you join the Vapi Office Hour and ask this question? https://discord.gg/KnK58ue6?event=1240493862867304479
s
Hi, I'm Trung Correct me if I'm wrong, currently, the VAPI Web SDK use daily-js to handle the call. It creates a Call object with the parameter
audio
set to
true
. And this will set the audio input device to default device. In my case, I'd like to specify the audio input device ID before joining the call. I have been able to archive that by accessing internal "call" object in the VAPI SDK and use the setInputDevicesAsync, and it works perfectly for changing Audio Input device (microphone) However, for the Audio output device, it's a bit more tricky. To change the audio output device, we need to modify the "sinkId" property of the generated audio tag of VAPI SDK. I tried something like
Copy code
const vapiAudioTags = document.querySelectorAll<any>(
            'audio[data-participant-id]'
        )

        vapiAudioTags.forEach((el) => {
            el.setSinkId(speakerDeviceId)
        })
This works, but somehow the sinkId got "cleared" for every few miliseconds, thus resetting the audio output to default device. I can forcefully set the "sinkId" by use an interval and constantly set it to desired speaker device ID, but it would cause unstability in the audio output (because the output device gets changed back and forth continuously) --------- My proposal is: - Can VAPI SDK expose a method, something like
changeMediaDevices
that allow us to modify the Audio input and Audio output by specifying device IDs? https://cdn.discordapp.com/attachments/1245275704061595679/1245284509470162985/image.png?ex=66583113&is=6656df93&hm=6c24317673e7ce743349fa3a0545dba30d05c88bfcaf4bf669577baf7d816f37& https://cdn.discordapp.com/attachments/1245275704061595679/1245284509729947778/image.png?ex=66583113&is=6656df93&hm=8439dccaac1cd04432413d45835fd71613eee9b5cf8aaa6a57fd4234f3804213&
s
@Sova Can you ask this question no Vapi Office Hour?
s
Sure
s
@Ashwin Can you provide me the repository link so that I can reproduce it?
a
Thanks Sahil, Deep has emailed it to you. Let us know if you have any question
s
Sure.
h
What was the answer to this question? I am investigating how to do this currently?
v
This ticket has been marked as solved, and as a result, you will no longer receive any further responses. Kindly create a new support ticket to escalate your inquiry. 
6 Views