无法检测responseVoice isPlaying() [英] Cant detect if responsiveVoice isPlaying()

查看:62
本文介绍了无法检测responseVoice isPlaying()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于isPlaying() http://sensitivevoice.org 的信息不多.

这是我尝试过的不起作用的内容.我没有得到console.log().

Here is what I tried which isnt working. I do not get the 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" 
/>

如何检测是否正在播放音频?另外,一旦音频播放完毕,是否有办法获取回调?

How do I detect if an audio is playing? Also, is there a way to get callback once the audio is done playing?

推荐答案

感谢您使用ResponsiveVoice!

Thanks for using ResponsiveVoice!

自v1.3.4起,我们已将函数isPlaying()添加到ResponsiveVoice,并更新了API文档.

We've added the function isPlaying() to ResponsiveVoice since v1.3.4 and updated the API documentation.

您现在可以使用:

responsiveVoice.isPlaying() 

适用于本机SpeechSynthesis和后备音频TTS.

which works for both native SpeechSynthesis and fallback audio TTS.

您可以在这里获得它:

http://code.sensitivevoice.org/develop/1.3/sensitivevoice.js (指向1.3.x周期的最新版本)

http://code.responsivevoice.org/develop/1.3/responsivevoice.js (points to latest release in 1.3.x cycle)

还要获取特定版本:

http://code.sensitivevoice.org/develop/1.3.4/sensitivevoice.js

这篇关于无法检测responseVoice isPlaying()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆