The order of block execution... a bug or a feature?

I am working on an Alexa skill with a number of audio blocks. I want to implement a feature to save the last played audio block to a variable (last_position). If you re-open the skill, this feature will allow to jump right to the position where you left the skill during the last execution. So the sequence might be:

– Set-Block (last_position = position1)
– Audio-Block (audio1)
– Set-Block (last_position = position2)
– Audio-Block (audio2)
– Set-Block (last_position = position3)
– Audio-Block (audio3)

Problem: If I stop the skill during the first audio block (audio1) and re-start the skill, the variable “last_position” has a value of position3. So if I jump to that position, I would miss the rest of audio1 and audio2. It turns out that I receive the value for the last Set-Block before a user input is performed. So it seems as if the Set-Blocks would be executed up to the next user input block, while the audio blocks are executed in sequence.

So I have 2 questions: (1) Is this a bug or a feature? (2) Are there any other ways to keep track of the individual progress of the audio blocks ?

Thanks in advance

This is tricky and a little tech-y. somehow related to this.

  • all speak blocks is converted into 1 single response like “This is the first one. This is the second one. This is the third one”

Audio block actually works same as speak block. between users’ interaction, speak/audio blocks are converted in 1 single response.

That means:

  • You may feel like Alexa plays each audio sequentially and you say “stop” in the middle of audio. but actually Alexa has already respond whole audio as a single response to make Echo device plays those sequentially. if you say “stop” in the middle of audio, for Alexa, everything has finished.
  • so, 3 set blocks are same. those are not executed between each audio playing, but all executed before Alexa responds.

This is not a bug but Alexa’s request and response system.

(2) Are there any other ways to keep track of the individual progress of the audio blocks ?

for keeping track of the progress, you should put users’ interaction such as Choice or Capture between each audio step.