MediaObject delay when playing short mp3 files
See original GitHub issueI’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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:22 (1 by maintainers)
Top GitHub Comments
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 userI 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!)