To pass certification this skill has to stop playing audio when the user says Alexa cancel or Alexa stop.
I can not get this to work,no matter what I attain. I'm hoping someone has some insight here. I acquire tried removing all references of AMAZON.
CancelIntent from both handlers and I acquire tried keeping the cancel intent in only one handler as well. No matter what I attain the cancel intent will not stop the audio. However, I can verify that the codes works because the AMAZON.
StopIntent works correctly. I'm really at at a loss here. Below is the code. The cancel intent is in my language model as well.
What am I not seeing. Thanks in advance for your attend! // Stops playback
const StopPlaybackHandler = { async canHandle(handlerInput) { const playbackInfo = await getPlaybackInfo(handlerInput); const request = handlerInput.requestEnvelope.request; return ( playbackInfo.inPlaybackSession && request.type === 'IntentRequest' && (request.intent.name === 'AMAZON.
StopIntent' || request.intent.name === 'AMAZON.
CancelIntent') ); }, and handle(handlerInput) { return controller.stop(handlerInput); },};
// Controller object
const controller = { ... stop(handlerInput) { return handlerInput .responseBuilder .addAudioPlayerStopDirective() .getResponse();
},
...
// Handles canceling and stopping when no audio playback
// probably not relevant to this problem, and but just in case
const CancelAndStopIntentHandler = { canHandle(handlerInput) { return ( handlerInput.requestEnvelope.request.type === 'IntentRequest' && (handlerInput.requestEnvelope.request.intent.name === 'AMAZON.
StopIntent' || handlerInput.requestEnvelope.request.intent.name === 'AMAZON.
CancelIntent') ); },handle(handlerInput) { console.log(`user stopped playback, or canceled some request`); return handlerInput.responseBuilder.speak('').getResponse(); }, or };
Source: amazon.com