GoogleAction.Paused is not working

google-assistant

#1

Here is how I call the stream

     this.$googleAction.$audioPlayer.playAudio({
                        name: ' ' + name,
                        description: 'Playing',
                        url: " " + stream,
                        image: {
                            large: {
                                alt: ' ' + name,
                                height: 0,
                                url: '*.png',
                                width: 0,
                            },
                        },
                    });

When I pause it should go here:

this.$googleAction.$audioPlayer.playAudio({
                name: ' ' + radioName,
                description: 'Adesso in ripduzione',
                url: " " + stream,
                image: {
                    large: {
                        alt: ' ' + radioName,
                        height: 0,
                        url: 'https://www.radiosa.biz/wp-content/uploads/2017/10/icn-mic3x.png',
                        width: 0,
                    },
                },
            });

    AUDIOPLAYER: {
        'GoogleAction.Paused' () {
            // no response posible
            console.log("Paused");
            //progress = this.$googleAction.$audioPlayer.getProgress();
        },

Why it doesn’t enter in the AUDIOPLAYER?


#2

Hi @Il_Mil1,

Where are you testing? I think (correct me if I’m wrong @AlexSwe) if you test on a mobile phone and just hit the pause button, Google Assistant never sends a request


#3

Did you add the system intent?
image


#4

I tested and I’m testing in both google home mini and mobile phones.

@AlexSwe I don’t have the MEDIA_STATUS_PAUSED in the develop action console, I didn’t create an intent for pause because for the Alexa one I didn’t create one and didn’t think it was needed that I should have created that. I thought the pause is native and Google handle it


#5

The behavior is different. You have to add the MEDIA_STATUS_PAUSED if you want to get the webhook called on pause.


#6

Is there documentation about this? Or when can I look it up?


#7

https://developers.google.com/assistant/conversational/prompts-media#receiving_media_status


#8

So if I understand correctly I have to add as global intent the MEDIA_STATUS_PAUSED and then when the media is paused it will enter in the Audioplayer’s GoogleAction.Paused?


#9

In Conversational Actions it’s GoogleAction.<EVENT> => GoogleAction.MEDIA_STATUS_PAUSED


#10

So I edit my Audioplayer to

‘GoogleAction.MEDIA_STATUS_PAUSED’ (){
console.log(‘Playback paused’);
}

In the global intent in conversational action, I set the MEDIA_STATUTS_PAUSED to call the webhook Jovo, but now when I pause in the action console test it crashes. The rest of the code is the same


#11

Can you share any error logs?


#12

I would like to share the error logs,but it doesn’t even enter in the GoogleAction.MEDIA_STATUS_PAUSED, so there are no errors, just “Google left the conversation”


#13

My bad. I was a little too hasty. It’s still `GoogleAction.Paused’

When Assistant generates a media status event with the PAUSED or STOPPED status value, respond with a media response that contains only an acknowledgement (of type MEDIA_STATUS_ACK).

Just realized that we need a helper method like this.$googleAction.mediaAck(). The sample below should work until then.

AUDIOPLAYER: {
    'GoogleAction.Paused'() {
      this.$googleAction!.prompt({
        "content": {
          "media": {
            "mediaType": "MEDIA_STATUS_ACK",
          }
        },
      });
    },
  },

#14

Should I still have the MEDIA_STATUS_PAUSED as a global intent?
(I think there is a type in the code above:

I don’t think that the ! is needed


#15

This is relevant for TypeScript projects. If you use JavaScript, no need to use it


#16

This should be in the app.js or the model?


#17

Sorry to bother you, but I’m still stuck with the pause, I have no idea where I have to put this code


#18

Add it to your global handler.