Announcement before playing audio?


#1

I’m trying to implement an announcement of what track we’re about to play. For example, when moving to the previous track, I added a .tell() as follows:

    currentIndex=Player.previousIndex(currentIndex)
    episode=Player.getEpisode(currentIndex)
    this.$speech.addText('Fetching episode '+episode.title+".");
    if (this.isAlexaSkill()) {
        this.$alexaSkill.$audioPlayer
            .setOffsetInMilliseconds(0)
            .play(addUriUsage(episode.url), `${currentIndex}`)
            .tell(this.$speech)
    } else if (this.isGoogleAction()) {  /* ... */ }

This works, sort of – but it seems to start the playback process, then the text-to-speech output steps occurs… If the episode happens to be in the Alexa cache, or otherwise comes back sooner than expected, this results in the first few seconds of playback being stepped on by the .tell().

Is there a way to get these sequenced more correctly?

An alternative that seems to work better (but still not right, there’s a hiccup in the MP3 playback):

    this.$speech.addText('Fetching episode '+previousEpisode.title+".");
    this.tell(this.$speech)
    if (this.isAlexaSkill()) { ... etc ...}

There must be a Correct Solution which neither of these is. Help?


#2

Sorry, no solution, but I’m wondering if this is the results of some change that Alexa made, as I’ve noticed this recently in my released skill where I do a preanounce and then start the stream.