GoogleCloudPlatform / GoogleCloudPlatform/java-docs-samples

InfiniteStreamRecognize - io.grpc.StatusRuntimeException: CANCELLED: Failed to read message when EnableVoiceActivityEvents is true

未关闭
#8,950 5 条评论 0 个 reaction 已指派 1 人 已指派给 @ssvir 在 GitHub 查看
priority: p2 samples type: question
主要语言
Java
星标
1.9k
派生
2.9k
平均合并
3 天 3 小时
30 天内合并 PR
17

描述

## In which file did you encounter the issue?
https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/speech/src/main/java/com/example/speech/InfiniteStreamRecognize.java

## Did you change the file? If so, how?
Added enable voice activity event option and set audio channel count to 1

RecognitionConfig recognitionConfig =
RecognitionConfig.newBuilder()
.setEncoding(RecognitionConfig.AudioEncoding.LINEAR16)
.setLanguageCode(languageCode)
.setSampleRateHertz(16000)
**.setAudioChannelCount(1)**
.build();

StreamingRecognitionConfig streamingRecognitionConfig =
StreamingRecognitionConfig.newBuilder()
.setConfig(recognitionConfig)
.setInterimResults(true)
**.setEnableVoiceActivityEvents(true)
.setVoiceActivityTimeout(VoiceActivityTimeout.newBuilder()
.setSpeechStartTimeout(Duration.newBuilder().setSeconds(15L))
)**
.build();

## Describe the issue
After I receive the event SPEECH_ACTIVITY_BEGIN I get the CancelledException: Failed to read message.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。