We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5189d0b commit 190ee3bCopy full SHA for 190ee3b
text-to-speech/synthesize.js
@@ -55,7 +55,16 @@ module.exports = function synthesize(options) {
55
audio.crossOrigin = 'anonymous';
56
audio.src = url + '/v1/synthesize?' + qs.stringify(pick(options, QUERY_PARAMS_ALLOWED));
57
if (options.autoPlay !== false) {
58
- audio.play();
+ var playPromise = audio.play();
59
+ if (playPromise !== undefined) {
60
+ playPromise
61
+ .then(() => {
62
+ // console.log("autoPlay promise resolved")
63
+ })
64
+ .catch(error => {
65
+ throw new Error('Watson TextToSpeech: autoplay error:' + error);
66
+ });
67
+ }
68
}
69
return audio;
70
};
0 commit comments