Search code examples
alexa-skills-kitalexa-web-api-for-games

How do I request the microphone to be opened with Alexa Web API for Games through the JavaScript client?


On devices that support Web API for Games, I use SSML speech marks and play the demuxed mp3 via JavaScript rather than through the Alexa response outputSpeech. When the mp3 is done playing, I would like to open the microphone to allow the player to answer a prompt. In the Alexa HTML SDK documentation, it says I can do that with alexaClient.voice.requestMicrophoneOpen(), but it errors out with a reason code of permission-denied. Is there something special I need to do to be able to use this method?


Solution

  • I received the following message from the Alexa Developer Communication team:

    "...we have made changes to alexa.voice.requestMicrophoneOpen API and need confirmation that your skill is not using it. Since we have not heard back from you we have cancelled the certification process. Before resubmitting, please confirm that you’re skill is not using the API. See here for updated guidelines on how to voice enable your Web API skill Add Voice Control and Speech to the Web App: Add Voice Control and Speech to the Web App"

    That probably explains why you're getting an error with that API now. Check out the details in the link there for a possible solution. The general idea is that your web app should send a message to your skill backend. Then you should have your skill backend respond explicitly setting the shouldEndSession flag to false to open the microphone.