actions-on-google-nodejs
actions-on-google-nodejs copied to clipboard
MediaObject delay when playing short mp3 files
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.
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
I can also confirm this. It's in fact pretty annoying according UX..
@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?
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 , I can only echo what @joecaine said. We work together. No solution yet and we're still waiting for a response from Google.
Thanks for you input, @igilham . Yes I guess we'll have to sit and wait then ;)
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.
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.
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/
So, if i want to create an Action for a private radio (which has an internet streamin ), cannot get to work well ?
Nope. Only content partners can use streaming audio formats (HLS etc.)
Ok, thanks... which are the requirements for become content partner ?
I believe this is the page you need: https://developers.google.com/actions/verticals/overview
Streaming mp3 (Icecast) does work with MediaResponse but is not supported.
Hey @CoreyCole, did you find any solution or workaround for your problem? Thanks.
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.
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.
I still see the latency problem with MediaResponse...
Same here - worst on Google Home devices, but only about 5-7 seconds for me.
Facing the same issue because of it even my app is not approving
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!)
@CoreyCole have you ever got that to work with a Caster.fm stream?