http://responsivevoice.org上没有太多关于isPlaying()
.
这是我尝试过的不起作用的方法。我不明白console.log()
。
setInterval(function(){ // continuously check if the audio is being played
if(responsiveVoice.isPlaying()){
console.log('playing..');
},
100
);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://responsivevoice.org/responsivevoice/responsivevoice.js"></script>
<textarea id="text" cols="45" rows="3">Hello, world!</textarea>
<input
onclick="responsiveVoice.speak($('#text').val(),'US English Female');"
type="button"
value="Play"
/>
如何检测是否正在播放音频?另外,有没有办法在音频播放完毕后获得回调?