llfbandit / record

Audio recorder from microphone to a given file path. No external dependencies, MediaRecorder is used for Android an AVAudioRecorder for iOS.
https://pub.dev/packages/record
243 stars 204 forks source link

Every time the recorder is disposed, an error is thrown #387

Closed gonuit closed 2 months ago

gonuit commented 2 months ago

Package version

Environment

Describe the bug

Every time the recorder is disposed, an error is thrown.

RecordConfig(
  encoder: AudioEncoder.flac,
  numChannels: 2,
);

Expected behavior

No error is thrown

Additional context

E/MethodChannel#com.llfbandit.record/messages(11730): Failed to handle method call
E/MethodChannel#com.llfbandit.record/messages(11730): java.lang.IllegalArgumentException: Receiver not registered: com.llfbandit.record.record.bluetooth.BluetoothReceiver@7394f16
E/MethodChannel#com.llfbandit.record/messages(11730):   at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1670)
E/MethodChannel#com.llfbandit.record/messages(11730):   at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1873)
E/MethodChannel#com.llfbandit.record/messages(11730):   at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:822)
E/MethodChannel#com.llfbandit.record/messages(11730):   at com.llfbandit.record.record.bluetooth.BluetoothReceiver.unregister(BluetoothReceiver.kt:74)
E/MethodChannel#com.llfbandit.record/messages(11730):   at com.llfbandit.record.methodcall.RecorderWrapper.maybeStopBluetooth(RecorderWrapper.kt:190)
E/MethodChannel#com.llfbandit.record/messages(11730):   at com.llfbandit.record.methodcall.RecorderWrapper.dispose(RecorderWrapper.kt:63)
E/MethodChannel#com.llfbandit.record/messages(11730):   at com.llfbandit.record.methodcall.MethodCallHandlerImpl.disposeRecorder(MethodCallHandlerImpl.kt:123)
E/MethodChannel#com.llfbandit.record/messages(11730):   at com.llfbandit.record.methodcall.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.kt:100)
E/MethodChannel#com.llfbandit.record/messages(11730):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/MethodChannel#com.llfbandit.record/messages(11730):   at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/MethodChannel#com.llfbandit.record/messages(11730):   at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#com.llfbandit.record/messages(11730):   at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#com.llfbandit.record/messages(11730):   at android.os.Handler.handleCallback(Handler.java:959)
E/MethodChannel#com.llfbandit.record/messages(11730):   at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#com.llfbandit.record/messages(11730):   at android.os.Looper.loopOnce(Looper.java:232)
E/MethodChannel#com.llfbandit.record/messages(11730):   at android.os.Looper.loop(Looper.java:317)
E/MethodChannel#com.llfbandit.record/messages(11730):   at android.app.ActivityThread.main(ActivityThread.java:8592)
E/MethodChannel#com.llfbandit.record/messages(11730):   at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.llfbandit.record/messages(11730):   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
E/MethodChannel#com.llfbandit.record/messages(11730):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
intermediatech22 commented 2 months ago

Having same issue,

llfbandit commented 2 months ago

Fixed in 96240e3c