I\'m trying to get the new streaming audio API going. Is the following response valid? I\'m getting a \"there was a problem with the skill\" error when I test it on my devic
We created a really simple project on Github that shows the easiest possible way to use the AudioPlayer:
https://github.com/bespoken/super-simple-audio-player
We also created a writeup for it here:
https://bespoken.tools/blog/2017/02/27/super-simple-audioplayer
The project shows how to play a track, as well pausing and resuming.
Here is the code that shows the actual playing of an audio file:
SimplePlayer.prototype.play = function (audioURL, offsetInMilliseconds) {
var response = {
version: "1.0",
response: {
shouldEndSession: true,
directives: [{
type: "AudioPlayer.Play",
playBehavior: "REPLACE_ALL", // Setting to REPLACE_ALL means that this track will start playing immediately
audioItem: {
stream: {
url: audioURL,
token: "0", // Unique token for the track - needed when queueing multiple tracks
expectedPreviousToken: null, // The expected previous token - when using queues, ensures safety
offsetInMilliseconds: offsetInMilliseconds
}
}
}]
}
}
this.context.succeed(response);
};