flutter_sound icon indicating copy to clipboard operation
flutter_sound copied to clipboard

[HELP]: PlatformException on starting recorder

Open PavelTurk opened this issue 3 years ago • 14 comments
trafficstars

This is my code:

import 'package:audio_session/audio_session.dart';
import 'package:flutter/material.dart';
import 'package:flutter_sound/flutter_sound.dart';
import 'package:flutter_sound_platform_interface/flutter_sound_recorder_platform_interface.dart';
import 'package:path_provider/path_provider.dart';

class MicTest {

  static FlutterSoundRecorder? _mRecorder = FlutterSoundRecorder();

  static Codec _codec = Codec.aacMP4;

  static const theSource = AudioSource.microphone;

  static void startRecorder() async {
    await _mRecorder!.openRecorder();
    final session = await AudioSession.instance;
    await session.configure(AudioSessionConfiguration(
      avAudioSessionCategory: AVAudioSessionCategory.playAndRecord,
      avAudioSessionCategoryOptions:
      AVAudioSessionCategoryOptions.allowBluetooth |
      AVAudioSessionCategoryOptions.defaultToSpeaker,
      avAudioSessionMode: AVAudioSessionMode.spokenAudio,
      avAudioSessionRouteSharingPolicy:
      AVAudioSessionRouteSharingPolicy.defaultPolicy,
      avAudioSessionSetActiveOptions: AVAudioSessionSetActiveOptions.none,
      androidAudioAttributes: const AndroidAudioAttributes(
        contentType: AndroidAudioContentType.speech,
        flags: AndroidAudioFlags.none,
        usage: AndroidAudioUsage.voiceCommunication,
      ),
      androidAudioFocusGainType: AndroidAudioFocusGainType.gain,
      androidWillPauseWhenDucked: true,
    ));
    print("initialized");
    String _mPath = 'tau_file.mp4';
    var tempPath = await getTemporaryDirectory();
    _mPath = tempPath.path + "/" + _mPath;
    _mRecorder!
        .startRecorder(
      toFile: _mPath,
      codec: _codec,
      audioSource: theSource,
    )
    .then((value) {
      //setState(() {});
    });
  }

  static void stopRecorder() async {
    await _mRecorder!.stopRecorder().then((value) {
      // setState(() {
      //   //var url = value;
      //   _mplaybackReady = true;
      // });
    });
  }
}

When I call MicTest.startRecorder() I get:

I/flutter ( 6616): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): │ #0   new FlutterSoundRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:140:13)
I/flutter ( 6616): │ #1   MicrophoneUtils._mRecorder (package:myapp/utils/mic_test.dart:9:45)
I/flutter ( 6616): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 6616): │ 🐛 ctor: FlutterSoundRecorder()
I/flutter ( 6616): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): │ #0   FlutterSoundRecorder.openRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:372:13)
I/flutter ( 6616): │ #1   MicrophoneUtils.startRecorder (package:myapp/utils/mic_test.dart:16:23)
I/flutter ( 6616): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 6616): │ 🐛 FS:---> openAudioSession 
I/flutter ( 6616): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): │ #0   FlutterSoundRecorder._openAudioSession (package:flutter_sound/public/flutter_sound_recorder.dart:381:13)
I/flutter ( 6616): │ #1   FlutterSoundRecorder.openRecorder.<anonymous closure> (package:flutter_sound/public/flutter_sound_recorder.dart:374:17)
I/flutter ( 6616): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 6616): │ 🐛 ---> openAudioSession
I/flutter ( 6616): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): │ #0   FlutterSoundRecorder._openAudioSession (package:flutter_sound/public/flutter_sound_recorder.dart:396:17)
I/flutter ( 6616): │ #1   FlutterSoundRecorder.openRecorder.<anonymous closure> (package:flutter_sound/public/flutter_sound_recorder.dart:374:17)
I/flutter ( 6616): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 6616): │ 🐛 Resetting flutter_sound Recorder Plugin
I/flutter ( 6616): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
E/MediaRecorder( 6616): resume called in an invalid state: 1
E/MediaRecorder( 6616): stop called in an invalid state: 1
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): Failed to handle method call
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:430)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:267)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at com.dooboolab.fluttersound.FlutterSoundManager.resetPlugin(FlutterSoundManager.java:88)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at com.dooboolab.fluttersound.FlutterSoundRecorderManager.onMethodCall(FlutterSoundRecorderManager.java:70)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at android.os.Looper.loop(Looper.java:223)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#com.dooboolab.flutter_sound_recorder( 6616): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/DartMessenger( 6616): Uncaught exception in binary message listener
E/DartMessenger( 6616): java.lang.IllegalStateException: Reply already submitted
E/DartMessenger( 6616): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:430)
E/DartMessenger( 6616): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:282)
E/DartMessenger( 6616): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/DartMessenger( 6616): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/DartMessenger( 6616): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/DartMessenger( 6616): 	at android.os.Handler.handleCallback(Handler.java:938)
E/DartMessenger( 6616): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/DartMessenger( 6616): 	at android.os.Looper.loop(Looper.java:223)
E/DartMessenger( 6616): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/DartMessenger( 6616): 	at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger( 6616): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/DartMessenger( 6616): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/flutter ( 6616): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): │ #0   FlutterSoundRecorder.openRecorderCompleted (package:flutter_sound/public/flutter_sound_recorder.dart:171:13)
I/flutter ( 6616): │ #1   MethodChannelFlutterSoundRecorder.channelMethodCallHandler (package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:98:22)
I/flutter ( 6616): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 6616): │ 🐛 ---> openRecorderCompleted: true
I/flutter ( 6616): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): │ #0   FlutterSoundRecorder.openRecorderCompleted (package:flutter_sound/public/flutter_sound_recorder.dart:182:13)
I/flutter ( 6616): │ #1   MethodChannelFlutterSoundRecorder.channelMethodCallHandler (package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:98:22)
I/flutter ( 6616): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 6616): │ 🐛 <--- openRecorderCompleted: true
I/flutter ( 6616): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): │ #0   FlutterSoundRecorder._openAudioSession (package:flutter_sound/public/flutter_sound_recorder.dart:412:13)
I/flutter ( 6616): │ #1   <asynchronous suspension>
I/flutter ( 6616): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 6616): │ 🐛 <--- openAudioSession
I/flutter ( 6616): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): │ #0   FlutterSoundRecorder.openRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:376:13)
I/flutter ( 6616): │ #1   <asynchronous suspension>
I/flutter ( 6616): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 6616): │ 🐛 FS:<--- openAudioSession 
I/flutter ( 6616): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): initialized
I/flutter ( 6616): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): │ #0   FlutterSoundRecorder.startRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:590:13)
I/flutter ( 6616): │ #1   MicrophoneUtils.startRecorder (package:myapp/utils/mic_test.dart:40:10)
I/flutter ( 6616): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 6616): │ 🐛 FS:---> startRecorder 
I/flutter ( 6616): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 6616): │ #0   FlutterSoundRecorder._startRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:614:13)
I/flutter ( 6616): │ #1   FlutterSoundRecorder.startRecorder.<anonymous closure> (package:flutter_sound/public/flutter_sound_recorder.dart:592:13)
I/flutter ( 6616): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 6616): │ 🐛 FS:---> _startRecorder.
I/flutter ( 6616): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
E/flutter ( 6616): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(startRecorder, startRecorder, Failure to start recorder, null)
E/flutter ( 6616): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter ( 6616): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter ( 6616): <asynchronous suspension>
E/flutter ( 6616): #2      FlutterSoundRecorder._startRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:671:7)
E/flutter ( 6616): <asynchronous suspension>
E/flutter ( 6616): #3      FlutterSoundRecorder.startRecorder.<anonymous closure> (package:flutter_sound/public/flutter_sound_recorder.dart:592:7)
E/flutter ( 6616): <asynchronous suspension>
E/flutter ( 6616): #4      BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33:16)
E/flutter ( 6616): <asynchronous suspension>
E/flutter ( 6616): #5      FlutterSoundRecorder.startRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:591:5)
E/flutter ( 6616): <asynchronous suspension>
E/flutter ( 6616): 

I've just started using flutter_sound, so I think the problem is in my code. Could anyone say how to fix this problem?

PavelTurk avatar Sep 08 '22 11:09 PavelTurk

are you solve this issue ? also I'm search for solving this issue

Alyy2021 avatar Oct 04 '22 21:10 Alyy2021

@Alyy2021 No, I decided to use another library. But after some thinking I came to conclusion that maybe the problem is in permissions. Try to add to manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="temp.myproject.myproject">
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
</manifest>

and use this code:

Map<Permission, PermissionStatus> statuses = await [Permission.microphone].request();

PavelTurk avatar Oct 05 '22 06:10 PavelTurk

@PashaTurok A solution here. #938

netsesame2 avatar Nov 09 '22 01:11 netsesame2

hi @PavelTurkish

I decided to use another library

I'd be interested in the library you used and does it support recording to stream in specified chunks?

kespaldon avatar Mar 22 '23 07:03 kespaldon

@kespaldon I use this library https://pub.dev/packages/record_mp3

PavelTurk avatar Mar 22 '23 07:03 PavelTurk

I am also facing this error any idea how to fix it

deepanshi0 avatar Jul 14 '23 11:07 deepanshi0

This is an abandoned package sadly. Good luck trying to find a replacement. I never solved my issue as well

kespaldon avatar Jul 14 '23 11:07 kespaldon

Yes. This is an abandoned library. I am very sad of that. I hope that you will found a good replacement.

Larpoux avatar Jul 14 '23 11:07 Larpoux

Thank you anyway @Larpoux. Have a great rest of your day 💙💛

kespaldon avatar Jul 14 '23 11:07 kespaldon

why hasn't flutter removed it officialy then:((

deepanshi0 avatar Jul 14 '23 11:07 deepanshi0

你解决这个问题了吗? 我也在寻找解决这个问题的方法

Pgrammerybj avatar Oct 15 '23 17:10 Pgrammerybj

This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.

github-actions[bot] avatar Jan 14 '24 01:01 github-actions[bot]

@Larpoux I have the same issue. Only when I hot restart.

E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): Failed to handle method call
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:431)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:272)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at xyz.canardoux.fluttersound.FlutterSoundManager.resetPlugin(FlutterSoundManager.java:89)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at xyz.canardoux.fluttersound.FlutterSoundPlayerManager.onMethodCall(FlutterSoundPlayerManager.java:68)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at android.os.Handler.handleCallback(Handler.java:958)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at android.os.Looper.loopOnce(Looper.java:230)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at android.os.Looper.loop(Looper.java:319)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at android.app.ActivityThread.main(ActivityThread.java:8893)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
E/MethodChannel#xyz.canardoux.flutter_sound_player(26362): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
E/DartMessenger(26362): Uncaught exception in binary message listener
E/DartMessenger(26362): java.lang.IllegalStateException: Reply already submitted
E/DartMessenger(26362): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:431)
E/DartMessenger(26362): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:287)
E/DartMessenger(26362): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/DartMessenger(26362): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/DartMessenger(26362): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/DartMessenger(26362): 	at android.os.Handler.handleCallback(Handler.java:958)
E/DartMessenger(26362): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/DartMessenger(26362): 	at android.os.Looper.loopOnce(Looper.java:230)
E/DartMessenger(26362): 	at android.os.Looper.loop(Looper.java:319)
E/DartMessenger(26362): 	at android.app.ActivityThread.main(ActivityThread.java:8893)
E/DartMessenger(26362): 	at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(26362): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
E/DartMessenger(26362): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

devnta avatar May 16 '24 06:05 devnta

Yes @phamquoctrongnta ,

Hot restart is a pain on FlutterSound. I tried to reset the plugin when hot restarted but This is a hack and I am not surprised that it does not work well. It would be great if someone else work on this issue, because I am not an expert on the plugin life-cycle when Hot Restart.

Larpoux avatar May 16 '24 07:05 Larpoux