Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

How to add connect timeout to the streamingAPI call? #115

Open
Kiran2shaw opened this issue Dec 28, 2019 · 0 comments
Open

How to add connect timeout to the streamingAPI call? #115

Kiran2shaw opened this issue Dec 28, 2019 · 0 comments

Comments

@Kiran2shaw
Copy link

Kiran2shaw commented Dec 28, 2019

I have used two files of speech module namely SpeechService.java & VoiceRecorder.java.

And have used the streamingApi call as follows:

   `public void startRecognizing(int sampleRate) {
    if (mApi == null) {
        Log.w(TAG, "API not ready. Ignoring the request.");
        return;
    }
    System.out.println("calling api....");
    // Configure the API
    mRequestObserver = mApi.streamingRecognize(mResponseObserver);
    mRequestObserver.onNext(StreamingRecognizeRequest.newBuilder()
            .setStreamingConfig(StreamingRecognitionConfig.newBuilder()
                    .setConfig(RecognitionConfig.newBuilder()
                            .setLanguageCode(getDefaultLanguageCode())
                            .setEncoding(RecognitionConfig.AudioEncoding.LINEAR16)
                            .setSampleRateHertz(sampleRate)
                            .build())
                    .setInterimResults(true)
                    .setSingleUtterance(true)
                    .build())
            .build());
}`

I am showing a progress bar until the callbacks namely are called via the StreamObserver mResponseObserver`s onNext() or orError() or OnCompleted().

But due to no response the progress bar keeps shown indefinitely so Now I need to add a timeout for this API call. With the help of which I can disable the progress bar and reset the view i.e, make the mic(for voice recording) again visible for user to try recording speech further.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant