actions-on-google / actions-on-google-nodejs

Node.js client library for Actions on Google
https://actions-on-google.github.io/actions-on-google-nodejs
Apache License 2.0
900 stars 197 forks source link

Custom shuffle/loop intents end audio playback #342

Open lukelafountaine opened 4 years ago

lukelafountaine commented 4 years ago

I have tried to implement custom shuffle and loop intents for my action that has audio content. The platform does not seem to support this.

The ideal behavior would be like this:

> "OK Google, tell 'my cool action' to play music"
< "Playing music..." 
> "OK Google, turn loop on"
< "Turning loop on"
Music continues playing

Instead, this is what happens:

> "OK Google, tell 'my cool action' to play music"
< "Playing music..." 
> "OK Google, turn loop on"
< "Turning loop on"
Music stops

Even worse, after the latter scenario, since the session with my action is over, restarting the audio ("OK Google, play") will only play through the current track and my fulfillment endpoint will not get a request to play the next song. The custom shuffle and loop intents will also not be invoked. Instead, the built-in intents for shuffle and loop are invoked.

The reason this is happening is because we have two options when sending a speech response:

  1. Await a user response and keep the mic open
  2. End the session and turn the mic off.

Option 1) Awaiting a user response doesn't make any sense in this scenario because there is nothing for the user to respond with after they just asked for loop/shuffle to be turned on/off. This continues to prompt them 3 times until Google gives up and closes the session.

Option 2) Ending the session makes more sense but it also ends the currently playing audio track.

Is there any plan to support something like this? Or is there any usable workaround for this?

jthomerson commented 4 years ago

It should be noted that turning loop and shuffle features on and off is natively supported by Alexa, which is why we're sort of monkey-patching it into our Google intents to try to keep feature parity.