jovotech / jovo-framework

🔈 The React for Voice and Chat: Build Apps for Alexa, Messenger, Instagram, the Web, and more
https://www.jovo.tech
Apache License 2.0
1.68k stars 309 forks source link

APL for audio - Devices not supported #849

Closed leogiroux closed 3 years ago

leogiroux commented 3 years ago

Hi everyone,

I'm using Jovo to develop an alexa skill but I'm facing an issue to execute an addAplDirective.

Js Code this.$alexaSkill.addAplDirective({ type: 'Alexa.Presentation.APLA.RenderDocument', token: 'hi', document: require('../apla/documents/testDocument'), datasources: { params: { test: formatSSMLwithBalise(this, 'ceci est un test audio', 'alexa'), }, }, }); Document module.exports = { type: 'APLA', version: '0.8', description: 'This document demonstrates key components used to create audio responses.', mainTemplate: { parameters: [ 'payload', ], item: { type: 'Sequencer', description: 'The Sequencer component plays a series of audio clips one after another.', items: [ { type: 'Speech', contentType: 'SSML', content: '${payload.params.test}', }, { type: 'Audio', source: 'https://www.jovo.tech/audio/LshHeoze-a67e020ead100a4d3818cf35e31c879d.mp3', }, ], }, }, };

On my Echo show 8 everything goes well, I can play text and audio, but on an Echo dot 3 without the clock display nothing happen just a silence during a few seconds, on an Echo dot 3 with the clock display it is working. Even the speech text is not played so I guess It is not the mp3 encoding which is not working.

Do you think that the issue come from the device himself or APLa from the jovo method addAplDirective is bugged ? I'm trying to reach Alexa team too.

Thanks

aswetlow commented 3 years ago

Hey @leogiroux

Not 100% sure, but I think APLA is not supported on non-visual devices like the echo dot 3 (without the clock). Could you post the request json (from the Echo Dot with the clock and the one without the clock)? We could compare the property for the supported interfaces.

leogiroux commented 3 years ago

Hi @aswetlow !

I've try on the both device and this is the apla directive log on the device that is working : WORKING DEVICE {   "version": "1.0",   "response": {     "shouldEndSession": false,     "outputSpeech": {       "type": "SSML",       "ssml": " "     },     "reprompt": {       "outputSpeech": {         "type": "SSML",         "ssml": " "       }     },     "directives": [       {         "type": "Alexa.Presentation.APLA.RenderDocument",         "token": "playNextSample",         "document": {           "type": "APLA",           "version": "0.9",           "description": "This document demonstrates key components used to create audio responses.",           "mainTemplate": {             "parameters": [               "payload"             ],             "item": {               "type": "Sequencer",               "description": "The Sequencer component plays a series of audio clips one after another.",               "items": [                 {                   "type": "Speech",                   "contentType": "SSML",                   "when": "${payload.params.isFirstSession == true && payload.params.fromNext == false}",                   "content": "${payload.params.niceName}"                 },                 {                   "type": "Speech",                   "contentType": "SSML",                   "when": "${payload.params.isFirstSession == true && payload.params.fromNext == false}",                   "content": "${payload.params.start}"                 },                 {                   "type": "Speech",                   "contentType": "SSML",                   "content": "${payload.params.presentSample}"                 },                 {                   "type": "Audio",                   "description": "The Audio component plays the provided audio file, such as an MP3 file. See docs for more information.",                   "source": "${payload.params.sample}",                   "filter": [                     {                       "type": "Volume",                       "amount": 0.5                     },                     {                       "type": "FadeOut",                       "duration": 2000                     }                   ]                 },                 {                   "type": "Speech",                   "contentType": "SSML",                   "content": "${payload.params.variantNext}"                 }               ]             }           }         },         "datasources": {           "params": {             "fromNext": false,             "isFirstSession": true,             "start": "Les extraits vont défiler au hasard, si tu souhaites passer à l'extrait suivant, dis « Alexa suivant ».",             "niceName": "<prosody pitch=\"high\"> C'est stylé ! <break time=\"0.1s\"/> C'est un monde illimité de divertissement audio qui s'ouvre à toi, léo ! Découvrons les extraits de nos meilleurs contenus de la semaine !",             "presentSample": "C'est parti pour l'extrait de ",             "sample": "https://files.sybel.com/series/TIpk8ZkLSy/sample/946c66a128f0e6303308d1ab45371b82",             "variantNext": "<prosody pitch=\"high\">Pas mal ! non ? <break time=\"0.1s\"/> Ça te dit qu'on l'écoute ? <break time=\"0.1s\"/> ou au suivant ?"           }         }       }     ]   },

NO WORKING DEVICE {   "version": "1.0",   "response": {     "shouldEndSession": false,     "outputSpeech": {       "type": "SSML",       "ssml": " "     },     "reprompt": {       "outputSpeech": {         "type": "SSML",         "ssml": " "       }     }   },   "sessionAttributes": {     "isFirstSession": true,     "_JOVOSTATE": "EXTRACT_FLOW",     "isSamplePlaying": true,     "sampleFlowPlayer": {       "series": [         "IADhtDBf2q",         "DPq0DqX9c7"       ],       "index": 1     }   } }

So as you can see the directive section is not present, and I have found some article and post that say APLA is available for all alexa devices :/ https://forums.developer.amazon.com/questions/233492/is-apl-supported-on-echo-dot-3rd-gen-which-has-no.html https://developer.amazon.com/en-US/blogs/alexa/alexa-skills-kit/2020/07/apl-for-audio APL for audio is supported on all Alexa devices like Echo devices and third-party devices.

Do you have any idea ? Maybe there is a part in the jovo code that check the compatibility with APL device that block the APLA feature ? Thanks :)

aswetlow commented 3 years ago

Thanks! Yes, in the meantime I also found the blogpost about APL-A. It's a bug on our side. Working on a fix.

leogiroux commented 3 years ago

Thanks man ! You are the best :D

I guess this is this function ;)

https://github.com/jovotech/jovo-framework/blob/f911f3bed60faa8f9395084dc22257558345236c/jovo-platforms/jovo-platform-alexa/src/modules/AplPlugin.ts#L120

you merge an APL document which block the APLA for unsupported APL devices.

leogiroux commented 3 years ago

Nice thanks :) When do you think it's gonna be live ?

aswetlow commented 3 years ago

Struggling with a few other issues in this release. Will do it tomorrow.

leogiroux commented 3 years ago

Thanks man !

aswetlow commented 3 years ago

Fixed. Please run jovo update

leogiroux commented 3 years ago

It is working thanks for your quick reaction :D