question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(startRecorder, startRecorder, Failure to start recorder, null)

See original GitHub issue

This error happens to me even if I make toFile: ‘flutter_example.aac’ as in the package example … here is my log:

I/flutter (15733): ---> openRecorderCompleted: true
I/flutter (15733): <--- openRecorderCompleted: true
I/flutter (15733): <--- openAudioSession
I/flutter (15733): FS:<--- openAudioSession
I/flutter (15733): ********* record outputpath : /data/user/0/com.q8intouch.hareem/cache/c34s2.aac
I/flutter (15733): FS:---> startRecorder
I/flutter (15733): FS:---> _startRecorder.
I/flutter (15733): Calling instance.startRecorder
E/MediaRecorder(15733): start failed: -38
E/SoundMediaRecorder(15733): Exception:
E/SoundMediaRecorder(15733): java.lang.IllegalStateException
E/SoundMediaRecorder(15733): 	at android.media.MediaRecorder.start(Native Method)
E/SoundMediaRecorder(15733): 	at com.dooboolab.TauEngine.q.a(:182)
E/SoundMediaRecorder(15733): 	at com.dooboolab.TauEngine.m.r(:239)
E/SoundMediaRecorder(15733): 	at f.e.b.e.M(:259)
E/SoundMediaRecorder(15733): 	at f.e.b.f.onMethodCall(:118)
E/SoundMediaRecorder(15733): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(:233)
E/SoundMediaRecorder(15733): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(:85)
E/SoundMediaRecorder(15733): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(:818)
E/SoundMediaRecorder(15733): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/SoundMediaRecorder(15733): 	at android.os.MessageQueue.next(MessageQueue.java:325)
E/SoundMediaRecorder(15733): 	at android.os.Looper.loop(Looper.java:142)
E/SoundMediaRecorder(15733): 	at android.app.ActivityThread.main(ActivityThread.java:6494)
E/SoundMediaRecorder(15733): 	at java.lang.reflect.Method.invoke(Native Method)
E/SoundMediaRecorder(15733): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/SoundMediaRecorder(15733): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
E/MediaRecorder(15733): resume called in an invalid state: 0
E/MediaRecorder(15733): stop called in an invalid state: 0
D/SoundMediaRecorder(15733): Error Stop Recorder
E/FlautoRecorder(15733): Error starting recordernull
E/flutter (15733): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(startRecorder, startRecorder, Failure to start recorder, null)
E/flutter (15733): #0      StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:597
E/flutter (15733): #1      MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:158
E/flutter (15733): <asynchronous suspension>
E/flutter (15733): #2      FlutterSoundRecorder._startRecorder
package:flutter_sound/public/flutter_sound_recorder.dart:662
E/flutter (15733): <asynchronous suspension>
E/flutter (15733): #3      FlutterSoundRecorder.startRecorder.<anonymous closure>
package:flutter_sound/public/flutter_sound_recorder.dart:584
E/flutter (15733): <asynchronous suspension>
E/flutter (15733): #4      BasicLock.synchronized
package:synchronized/src/basic_lock.dart:33
E/flutter (15733): <asynchronous suspension>
E/flutter (15733): #5      FlutterSoundRecorder.startRecorder
package:flutter_sound/public/flutter_sound_recorder.dart:583
E/flutter (15733): <asynchronous suspension>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
mhstollercommented, Jul 14, 2021

No, actually I’ve run it on my device and it gets past the startRecorder portion on my phone.

What device and android version are you using for development @AbdallahLabib ?

I/flutter ( 5167): ********* record outputpath : /data/user/0/com.example.recorder_problem/cache/aIy3i.aac
I/flutter ( 5167): FS:---> startRecorder
I/flutter ( 5167): FS:---> _startRecorder.
I/flutter ( 5167): Calling instance.startRecorder
I/flutter ( 5167): ---> startRecorderCompleted: true
I/flutter ( 5167): <--- startRecorderCompleted: true
I/flutter ( 5167): FS:<--- _startRecorder.
I/flutter ( 5167): FS:<--- startRecorder
2
I/flutter ( 5167): FS:---> stopRecorder
I/flutter ( 5167): FS:---> stop
I/flutter ( 5167): ---> stopRecorderCompleted: true
I/flutter ( 5167): <---- stopRecorderCompleted: true
I/flutter ( 5167): FS:<--- stop
I/flutter ( 5167): FS:<--- stopRecorder : /data/user/0/com.example.recorder_problem/cache/aIy3i.aac
1reaction
mhstollercommented, Jul 14, 2021

Can you provide the exact code you’re using to open the audio session and start the recorder? Also can you provide the output of flutter pub deps | grep flutter_sound?

Read more comments on GitHub >

github_iconTop Results From Across the Web

PlatformException(startRecorder, startRecorder, Failure to ...
11+1. Exception has occurred. _Exception (Exception: PlatformException(startRecorder, startRecorder, Failure to start recorder, null)). Severity.
Read more >
flutter - Unable to successfully call startRecorder(uri
Receiver: null Tried calling: startRecorder(codec: Instance of ... by using touch audio.aac and tried to record, I still got the same error.
Read more >
FlutterSoundRecorder class - recorder library - Dart API
Using a recorder is very simple : Create a new FlutterSoundRecorder. Open it with openAudioSession(). Start your recording with startRecorder().
Read more >
Recording and playing audio in Flutter - wafrat
startRecorder (null); result.then(path) { print('startRecorder: ... Once you start recording, flutter_sound records the audio in a file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found