1

I am trying to make an Alexa fitness app and when the user begins an exercise, Alexa explains the exercise and then plays an audio file. I would like to then get Alexa to explain the second exercise and play the next audio file. Repeating this for around 5 exercises.

Here is part of my code:

else if (slotValues.area.heardAs == 'lower body' || slotValues.area.heardAs == 'lower' || slotValues.area.heardAs == 'legs') {

say = 'Great choice! We will get started with an lower body workout. Let\'s begin with a warm-up. The first exercise is ' + lowerWorkout1[0].name + lowerWorkout1[0].description + ' 3. 2. 1.' ;

handlerInput.responseBuilder.addAudioPlayerPlayDirective('REPLACE_ALL', sLowerWorkout1.url, sLowerWorkout1.token, 0, null, sLowerWorkout1.metadata);
                // Then explain second exercise
                // Play the second audio
                // Then explain third exercise
                // Play the third audio
            }

/.../

 return responseBuilder
            .speak(say)
            //.reprompt('try again, ' + say)
            .getResponse();

I have tried to add the a second say variable after the audioPlayerPlayDirective but it only outputs the second .speak() and then plays the first audio file. I have also tried to add another .speak() after getResponse() but that gives me an error.

Does anyone have any ideas as to how I can do this?

Thanks,

Martin

1 Answers1

0

Once your audio player starts, your skill ends its session. Meaning either you are playing mp3s, either you are in skill session and you can speak. Not both. I guess workaround would be to have all as audio clips.

tole
  • 304
  • 1
  • 14