Skip to content

On device=true leads to SpeechToTextError.runtimeError("Not enough available inputs.") on very first listen attempt #654

@rnextit

Description

@rnextit

Hi,

steps to reproduce the crash:

Used configuration:

.listen(
          onResult: resultListener,
          localeId: "sv-SE",
          pauseFor: Duration(seconds: 5),
          listenOptions: SpeechListenOptions(
            listenMode: ListenMode.confirmation,
            onDevice: true
            cancelOnError: true,
            partialResults: true,
            autoPunctuation: true,
            enableHapticFeedback: true,
          ),
        )

localeId should be a locale that is not set as locale on the device.
It only happens on the first listening attempt after a clean install and only if onDevice = true. After restarting the app it does not crash (sometimes logs an error, but then I can catch it and restart listening with onDevice: false)

The crash that occurs is happening here

      if inputNode?.inputFormat(forBus: 0).channelCount == 0 {
        throw SpeechToTextError.runtimeError("Not enough available inputs.")
      }

Flutter 3.38.7
Tested on iOS Simulator: iPhone 17 Pro, iPad mini (A17 Pro) on iOS 26.2.

Setting it to onDevice: false seems to fix the crash, but then the user looses advantages of onDevice: true..
Is there any workaround or fix for this?
The language used when it crashes is included in the list of speech.locales() somehow (but still crashes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions