【问题标题】:How to detect end of speech in ResponsiveVoice JS如何在 ResponsiveVoice JS 中检测语音结束
【发布时间】:2016-04-03 02:37:00
【问题描述】:

我正在使用 ResponsiveVoice 文本转语音库。

除了似乎无法在 API 中检测到语音结束之外,一切都运行良好。

responsiveVoice 对象上,我可以看到OnFinishedPlaying 回调,但它不起作用。 onend callback mentioned here. 也没有

现在我正在使用setInterval 轮询isPlaying 方法来检测语音结束。但是,如果有一种方法可以正确地做到这一点,那就太好了。

Here's the code on Github 我正在使用。

这是一个最小的JSFiddle test code

【问题讨论】:

    标签: javascript responsivevoice


    【解决方案1】:

    如果您将选项对象作为第三个参数,上述onend 回调将起作用:

    responsiveVoice.speak('Responsive Voice is ready', 'UK English Male', {onend: yourCallbackGoesHere});
    

    JSFiddle

    【讨论】:

    • 感谢解决,没注意用法,直接在对象上使用onend
    猜你喜欢
    • 2016-09-29
    • 1970-01-01
    • 2021-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-30
    相关资源
    最近更新 更多