Wednesday, October 28, 2026
HomeiOS Developmentandroid - Alan AI can not entry the microphone after audio is...

android – Alan AI can not entry the microphone after audio is performed in Flutter App

[ad_1]

I’m making an attempt to make a voice managed app in Flutter utilizing Alan AI.
Proper now I’m simply navigating between the screens utilizing voice instructions, nevertheless I’ve encountered a difficulty the place when audio is performed in one of many screens, Alan stops responding. He doesn’t wake upon utilizing the wake instructions, and if I press the Alan button he doesn’t appear to listen to any enter. There are not any errors being thrown when this occurs. I’m testing utilizing an iPhone 12 and a Xiaomi Redmi Be aware 10, I’ve tried a couple of issues akin to eradicating and including the Alan button after the audio has completed taking part in however this didn’t work.
Beneath is the code for Alan:

  @override
  void initState() {
    tremendous.initState();
    AlanVoice.addButton(
        "<My SDK key>");

    AlanVoice.onCommand.add((command) {
      _handleCommand(command.knowledge);
    });
  }

  void _handleCommand(Map<String, dynamic> command) {
    change (command["command"]) {
      case "house":
        Navigator.pop(context);
        break;
      case "tuner":
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => Tuner(uuid: widget.uuid)),
        );
        break;
      case "metronome":
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => Metronome()),
        );
        break;
      default:
        debugPrint("Unknown command");
        break;
    }
  }

And beneath is the audio code which when executed breaks Alan (if I remark the _audioCache.play() command out and run the applying it really works wonderful):

  @override
  void initState() {
    tremendous.initState();
    _audioCache = AudioCache(
      prefix: 'belongings/audio/',
      fixedPlayer: AudioPlayer()..setReleaseMode(ReleaseMode.STOP),
    );
  }
  
  void _start() {
    _audioCache.play('tick.mp3');
  }

I hope I’ve supplied sufficient data, I might drastically admire any concepts on why this can be taking place and the way it might be mounted.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments