Tedros
04/19/2024, 12:52 AMVapi Support
04/19/2024, 12:52 AMVapi Support
04/19/2024, 12:52 AMvapi.setMuted(true);
and vapiInstance.isMuted();
you've mentioned are indeed part of the Vapi Web SDK functionalities, as highlighted in the documentation for the Vapi Web SDK [(1)]() . These methods are used to mute and unmute the microphone during a call and check the mute status, respectively.
However, if you're working with the Vapi Voice Widget, as indicated by your reference to using an assistant object in the voice widget example, it's important to note that the Voice Widget example documentation [(2)]() does not explicitly mention support for setMuted
or isMuted
functions directly within the widget. The Voice Widget documentation primarily focuses on integrating the widget into your site, customizing the appearance, and handling events but doesn't cover all the functionalities available in the SDKs for direct voice call manipulation like muting or unmuting.
Your observation that vapiInstance.setMuted
and vapiInstance.isMuted
are not recognized as functions suggests that these specific methods might not be exposed or available in the same manner within the context of the Voice Widget. This could be due to differences in how the Voice Widget is designed to operate compared to direct SDK integration, focusing more on providing a simplified interface for embedding voice assistant capabilities on web pages without requiring detailed control over the call's audio states.
For detailed control over the call states, including muting and unmuting, using the Vapi Web SDK directly, as you've initially tried, is the recommended approach where these functions are explicitly defined and documented [(1)]() .
If muting and unmuting capabilities are critical for your use case withiVapi Support
04/19/2024, 12:52 AMVapi Support
04/19/2024, 12:53 AMTedros
04/19/2024, 12:54 AMTedros
04/19/2024, 7:15 PMSahil
04/20/2024, 8:01 AMjs
<script>
(function (d, t) {
var g = document.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src =
"https://cdn.jsdelivr.net/gh/VapiAI/html-script-tag@latest/dist/assets/index.js";
g.defer = true;
g.async = true;
s.parentNode.insertBefore(g, s);
g.onload = function () {
const vapi = window.vapiSDK.run({
apiKey: "", // required
assistant: assistant, // required
config: buttonConfig // optional
});
if(vapi) {
// Extend more using vapi
// This is where you can call any method on vapi similar to web sdk.
vapi.isMuted(); // false
vapi.setMuted(true);
vapi.isMuted(); // true
}
};
})(document, "script");
</script>
Tedros
04/20/2024, 3:01 PMTedros
04/20/2024, 3:03 PMTedros
04/20/2024, 3:10 PMTedros
04/20/2024, 3:19 PMTedros
04/20/2024, 3:22 PMTedros
04/20/2024, 4:10 PMSahil
04/20/2024, 4:11 PMTedros
04/20/2024, 4:12 PMzoratrox360
04/21/2024, 5:37 AMTedros
04/21/2024, 6:21 PMTedros
04/21/2024, 6:22 PM