Before saying goodbye and stopping, check first whether this skill is currently playing audio.
Issue #, if available:
If users say "Alexa, stop" when AudioPlayer was last used by a custom skill, that skill will receive an AMAZON.StopIntent request, even if audio is not playing any more.
Before giving a goodbye message, a custom skill needs to check whether it is currently playing audio.
Description of changes:
When audio is currently playing, context in the intent request looks like:
"context": {
"AudioPlayer": {
"offsetInMilliseconds": 21264,
"token": "https://example.com/stream/",
"playerActivity": "PLAYING"
},
Here's what context looks like if playback is already stopped:
"context": {
"AudioPlayer": {
"offsetInMilliseconds": 21264,
"token": "https://example.com/stream/",
"playerActivity": "STOPPED"
},
I have added checks for StopIntent and PauseIntent for both single-stream and multiple-stream, with unit tests.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Hello! I don't understand why this is bad:
"If users say "Alexa, stop" when AudioPlayer was last used by a custom skill, that skill will receive an AMAZON.StopIntent request, even if audio is not playing any more."
I added your code, but now I have problems where I can never stop playing. Is it correct?