【问题标题】:Microsoft Cognitive TTS onAudioEnd event not workingMicrosoft Cognitive TTS onAudioEnd 事件不起作用
【发布时间】:2020-06-24 21:32:18
【问题描述】:

我正在使用来自https://github.com/Azure-Samples/cognitive-services-speech-sdk 的 Microsoft Cognitive Services Speech SDK 的 JavaScript 版本。

关于 SpeechSynthesizer,我将 SpeakerAudioDestination 包含在其中。我想在音频播放完成后做点什么,所以我添加了 onAudioEnd 事件,但它从未被触发。 下面的代码正确吗?

    player = new SpeechSDK.SpeakerAudioDestination();
    player.onAudioEnd = function (s) {
      console.log("onAudioEnd", s);
    };
    synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig, 
      SpeechSDK.AudioConfig.fromSpeakerOutput(player));

感谢任何帮助!

【问题讨论】:

    标签: text-to-speech microsoft-cognitive


    【解决方案1】:

    在 synthesizer.speakTextAsync() 回调中,需要调用 synthesizer.close() 以触发 player.onAudioEnd 事件。

    【讨论】:

      猜你喜欢
      • 2021-04-28
      • 1970-01-01
      • 2014-06-11
      • 2023-04-06
      • 2023-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-22
      相关资源
      最近更新 更多