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

MediaObject delay when playing short mp3 files

Open CoreyCole opened this issue 6 years ago • 22 comments

I'm attempting to play a short 3-second audio file on loop. In my real application, this is a silent file. I run important logic every time MediaStatus is called, and this logic is best called frequenty, hence the short length. For testing purposes, it is the jaws hit instead of silence.

My problem is there is a large amount of delay between files where nothing is playing. There is no delay when initially playing the first audio file, but then when looping the file using MediaStatus, there is long silences in between loops (sometimes >30 seconds long). You can see my code here, but main logic is in the MediaStatus handler:

app.intent('MediaStatus', (conv) => {
    console.log('[MediaStatus]');
    const mediaStatus = conv.arguments.get('MEDIA_STATUS');
    if (!mediaStatus || mediaStatus.status !== 'FINISHED') {
        return conv;
    }
    conv.ask(`<speak><audio src="${shortAudio}"><desc>Silent while waiting...</desc></audio></speak>`);
    conv.ask(new MediaObject({
        name: 'short audio loop',
        description: 'testing auto play',
        url: shortAudio,
        icon: new Image({
            url: 'https://s3-us-west-2.amazonaws.com/www.heymuse.com/images/hey-muse-large.png',
            alt: 'Logo',
        })
    }));
    conv.ask(new Suggestions('cancel'));
    return conv;
});

I'll attach my DialogFlow export MediaTester.zip

Note: this delay is most prominent on google home devices. The delay is not as long in the simulator.

CoreyCole avatar Jan 04 '19 03:01 CoreyCole

We've experienced this too. If you replay a MediaObject that has already been played before during the session, the 'Google Voice Service' holds the request for around 30 seconds about 50% of the time, causing a long lag for the user

joecaine avatar Jan 24 '19 10:01 joecaine

I can also confirm this. It's in fact pretty annoying according UX..

Thomas-A-Reinert avatar Jan 24 '19 10:01 Thomas-A-Reinert

@joecaine do you know what about the MediaObject needs to be changed to avoid the delay? I tried making the mp3 url unique each time I play it, but I'm still getting the delay. Do I need a different mp3 file each time?

CoreyCole avatar Jan 25 '19 21:01 CoreyCole

According to my experience there is no option to minimize the delay with any option avail. That delay is totally incomputable to my experience. And it also totally differs between the simulator, the smartphone app and a home device. It´s just somewhere between a totally erratic 10 - 60 secs to my experience. And changing with every other call. I´d be interested to know what @igilham has to say bout that, because I guess we have some kind of comparable purposes.

Thomas-A-Reinert avatar Jan 25 '19 23:01 Thomas-A-Reinert

@Thomas-A-Reinert , I can only echo what @joecaine said. We work together. No solution yet and we're still waiting for a response from Google.

igilham avatar Jan 28 '19 10:01 igilham

Thanks for you input, @igilham . Yes I guess we'll have to sit and wait then ;)

Thomas-A-Reinert avatar Jan 28 '19 10:01 Thomas-A-Reinert

I've the same issue playing a live stream from dialogflow . The docs days live stream not supported.. can you confirm it ? Anyway stream starts but with large delay (about 1 min ).. ps there are actions with radio streams , so in Some way they are supported , but i don't know the correct way to achieve it.

lucacalcaterra avatar Feb 03 '19 17:02 lucacalcaterra

I experimented with live streams a few months ago. Some stream formats would start playing but the Assistant would get confused if I paused it or tried to interact while it was playing. Streams are definitely not supported for third-party actions.

There are some companies with first-party integration that seem to have access to live streaming as a feature. TuneIn plays radio streams in the UK, but I'm pretty sure it's impossible to build a similar experience as a third-party developer.

igilham avatar Feb 04 '19 11:02 igilham

The MediaObject response does not support streaming.

For content partners, Media Actions provides an integration with the Google Assistant: https://developers.google.com/actions/media/

NoRulesJustFeels avatar Feb 04 '19 16:02 NoRulesJustFeels

So, if i want to create an Action for a private radio (which has an internet streamin ), cannot get to work well ?

lucacalcaterra avatar Feb 06 '19 17:02 lucacalcaterra

Nope. Only content partners can use streaming audio formats (HLS etc.)

igilham avatar Feb 07 '19 10:02 igilham

Ok, thanks... which are the requirements for become content partner ?

lucacalcaterra avatar Feb 07 '19 10:02 lucacalcaterra

I believe this is the page you need: https://developers.google.com/actions/verticals/overview

igilham avatar Feb 07 '19 11:02 igilham

Streaming mp3 (Icecast) does work with MediaResponse but is not supported.

BoneGoat avatar Apr 10 '19 08:04 BoneGoat

Hey @CoreyCole, did you find any solution or workaround for your problem? Thanks.

yrmartinez avatar Sep 12 '19 03:09 yrmartinez

Hey @yrmartinez no there is still a pause of a seemingly random interval between audio files in my skill. I've had an open support ticket with Christian Dale since January. I'm sure they are aware of the behavior, but it must be low-priority to fix it or it is the intended behavior.

CoreyCole avatar Sep 13 '19 20:09 CoreyCole

No matter if it´s "a short MP3" or a live stream, there is a random delay between 5s to 120s to my experience. That´s totally intolerable. And that problem still persists for more than half a year now.

Thomas-A-Reinert avatar Sep 13 '19 20:09 Thomas-A-Reinert

I still see the latency problem with MediaResponse...

alexal avatar Dec 13 '19 23:12 alexal

Same here - worst on Google Home devices, but only about 5-7 seconds for me.

talkingnews avatar Dec 18 '19 15:12 talkingnews

Facing the same issue because of it even my app is not approving

RaheelAshraf avatar May 19 '20 18:05 RaheelAshraf

I have recently discovered that Media is not supported at all any more by API v2, I see there is an API v3 alpha, but I don't know how to use it or, nor whether it supports streaming. I'm currently investigating the issue and collating info and will post in a few days (remind me if I forget!)

talkingnews avatar May 19 '20 19:05 talkingnews

@CoreyCole have you ever got that to work with a Caster.fm stream?

Yahav avatar Jul 24 '20 08:07 Yahav