actions-on-google-nodejs icon indicating copy to clipboard operation
actions-on-google-nodejs copied to clipboard

On Google Home devices MediaObject stops playing after one second

Open GPack1 opened this issue 5 years ago • 8 comments

I have an action that automatically loops on a collection of shorts audio tracks (each about 30 secs). The action (same action, same code) on Google Assistant app executed on real smartphone works well, but on Google Home devices it has a strange behavior:

  • first track plays entirely
  • second track stops playing after 1 sec
  • third track plays entirely
  • fourth track stops playing after 1 sec
  • and so on, alternately one track plays entirely and the next one not.

So, is there any difference between the MediaObject on smartphone and the Google Home one? Any hints, please? Thanks

UPDATE sept 2019: The behavior of the Home device got worse over the last week (without changes to the active code): now the first track plays completely, the second stops after a second, the third doesn't sound at all and the loop stops (crashes?).

SAMPLE CODE:

-> The next track automatically plays at receiving MEDIA_STATUS = FINISHED

app.intent('Media Status', (conv) => {
   const mediaStatus = conv.arguments.get('MEDIA_STATUS');
   if (mediaStatus && mediaStatus.status === 'FINISHED') {
      // Automatically start playing the next track
      nextTrackPower(conv, true, false, datapower);
   } else {
      console.log('Unknown media status received.');
      conv.close(getRandomPrompt(conv, 'error'));
   }
});

-> Then I emit three ask command from nextTrackPower() function (an intro text, in the middle the right MediaObject, finally some suggestion chips)

const nextTrackPower = (conv, intro, backwards, datapower) => {
   // Loops the tracks
	--- OMITTED ---
   // Plays the next track
   trackpower = datapower[conv.user.storage.trackpower - 1];

   // Add a prompt intro
   if (intro) {
      conv.ask(nextPrompt);
   }

   // Create a media response
   conv.ask(new MediaObject({
    name: trackpower.title,
    url: POWER_BASE_URL + trackpower.clip,
    description: trackpower.artist,
    icon: new Image({
      url: POWER_BASE_URL + trackpower.link,
      alt: 'Media icon'
       })
    }));

   // Add suggestions to continue the conversation
     conv.ask(suggestions1 );
};

GPack1 avatar Aug 10 '19 17:08 GPack1

Cheeky workaround to detect a lack of screen then play 1s blank audio between your tracks? 😄

actionsoneverything avatar Aug 15 '19 13:08 actionsoneverything

Can you provide a code sample to reproduce this behavior? Are you jumping from one media response directly into the next one? Are you adding in any simple text responses?

Fleker avatar Aug 15 '19 14:08 Fleker

Unfortunately the blank audio solution is not allowed, even if it works and they don't really check up on you.

igilham avatar Aug 15 '19 16:08 igilham

Added sample code

GPack1 avatar Aug 20 '19 11:08 GPack1

Can you make your sample more off-the-shelf, so I can better reproduce it.

Fleker avatar Aug 28 '19 19:08 Fleker

Hi, @GPack1 have you found a solution ? We have the same issue with differents AoG. We use Jovo Framework instead of actions on google but the bug is the same ...

kouz75 avatar Sep 09 '19 16:09 kouz75

@kouz75 Hi, sorry no solution so far. I checked several times, the code works well on smartphones. I hope the bug will be fixed soon on the Home device.

GPack1 avatar Sep 09 '19 18:09 GPack1

I added updates about behavior on Home device.

GPack1 avatar Sep 12 '19 08:09 GPack1