Skip to content

Instantly share code, notes, and snippets.

@zephiransas
Created December 13, 2017 04:38
Show Gist options
  • Save zephiransas/89558536a76efee2687181d81777772d to your computer and use it in GitHub Desktop.
Save zephiransas/89558536a76efee2687181d81777772d to your computer and use it in GitHub Desktop.
Alexa Audio Player problem with Promise
let handlers = {
'PlayAudio_NG': function() {
let get_url = () => {
return new Promise((resolve) => {
...
resolve(url); // S3のObjectのURLを返す
});
}
let self = this;
get_url().then((url) => {
self.response.speak('再生します').audioPlayerPlay('REPLACE_ALL', url, url, null, 0);
self.emit(':responseReady');
});
},
'PlayAudio_OK': function() {
let url = 'https://s3-ap-northeast-1.amazonaws.com/hoge/sample.mp4';
this.response.speak('再生します').audioPlayerPlay('REPLACE_ALL', url, url, null, 0);
this.emit(':responseReady');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment