onSpeakWithAudioStream property

EventStream<OnSpeakWithAudioStreamEvent> onSpeakWithAudioStream

Called when the user makes a call to tts.speak() and one of the voices from this extension's manifest is the first to match the options object. Differs from ttsEngine.onSpeak in that Chrome provides audio playback services and handles dispatching tts events.

Implementation

EventStream<OnSpeakWithAudioStreamEvent> get onSpeakWithAudioStream =>
    $js.chrome.ttsEngine.onSpeakWithAudioStream.asStream(($c) => (
          String utterance,
          $js.SpeakOptions options,
          $js.AudioStreamOptions audioStreamOptions,
          JSFunction sendTtsAudio,
          JSFunction sendError,
        ) {
          return $c(OnSpeakWithAudioStreamEvent(
            utterance: utterance,
            options: SpeakOptions.fromJS(options),
            audioStreamOptions: AudioStreamOptions.fromJS(audioStreamOptions),
            sendTtsAudio: sendTtsAudio,
            sendError: sendError,
          ));
        });