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.

[BUG] Unhandled Exception: Exception: PlatformException(startRecorder, startRecorder, Failure to start recorder, null)

See original GitHub issue

The full code is here, I tried on the Samsung c7 pro https://github.com/Canardoux/tau/blob/master/flutter_sound/example/lib/simple_recorder/simple_recorder.dart

Error Log

D/ViewRootImpl@8a428ba[MainActivity]( 2064): ViewPostIme pointer 0
D/ViewRootImpl@8a428ba[MainActivity]( 2064): ViewPostIme pointer 1
I/flutter ( 2064): FS:---> openAudioSession 
I/flutter ( 2064): FS:---> channelMethodCallHandler : openAudioSessionCompleted
I/flutter ( 2064): FS:<--- channelMethodCallHandler : openAudioSessionCompleted
I/flutter ( 2064): FS:<--- openAudioSession 
D/ViewRootImpl@8a428ba[MainActivity]( 2064): ViewPostIme pointer 0
D/ViewRootImpl@8a428ba[MainActivity]( 2064): ViewPostIme pointer 1
I/MediaRecorderJNI( 2064): setup
I/MediaRecorderJNI( 2064): native_reset
I/MediaRecorderJNI( 2064): setAudioSource(0)
E/SoundMediaRecorder( 2064): Exception: 
E/SoundMediaRecorder( 2064): java.lang.RuntimeException: setAudioSource failed.
E/SoundMediaRecorder( 2064): 	at android.media.MediaRecorder._setAudioSource(Native Method)
E/SoundMediaRecorder( 2064): 	at android.media.MediaRecorder.setAudioSource(MediaRecorder.java:700)
E/SoundMediaRecorder( 2064): 	at com.dooboolab.TauEngine.FlautoRecorderMedia._startRecorder(FlautoRecorderMedia.java:139)
E/SoundMediaRecorder( 2064): 	at com.dooboolab.TauEngine.FlautoRecorder.startRecorder(FlautoRecorder.java:198)
E/SoundMediaRecorder( 2064): 	at com.dooboolab.fluttersound.FlutterSoundRecorder.startRecorder(FlutterSoundRecorder.java:206)
E/SoundMediaRecorder( 2064): 	at com.dooboolab.fluttersound.FlutterSoundRecorderManager.onMethodCall(FlutterSoundRecorderManager.java:109)
E/SoundMediaRecorder( 2064): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/SoundMediaRecorder( 2064): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/SoundMediaRecorder( 2064): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
E/SoundMediaRecorder( 2064): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/SoundMediaRecorder( 2064): 	at android.os.MessageQueue.next(MessageQueue.java:325)
E/SoundMediaRecorder( 2064): 	at android.os.Looper.loop(Looper.java:142)
E/SoundMediaRecorder( 2064): 	at android.app.ActivityThread.main(ActivityThread.java:6942)
E/SoundMediaRecorder( 2064): 	at java.lang.reflect.Method.invoke(Native Method)
E/SoundMediaRecorder( 2064): 	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
E/SoundMediaRecorder( 2064): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
I/MediaRecorderJNI( 2064): resume
E/MediaRecorder( 2064): resume called in an invalid state: 0
I/MediaRecorderJNI( 2064): stop
E/MediaRecorder( 2064): stop called in an invalid state: 0
D/SoundMediaRecorder( 2064): Error Stop Recorder
E/FlautoRecorder( 2064): Error starting recordersetAudioSource failed.
E/flutter ( 2064): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Exception: PlatformException(startRecorder, startRecorder, Failure to start recorder, null)
E/flutter ( 2064): #0      FlutterSoundRecorder.startRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:414:7)
E/flutter ( 2064): <asynchronous suspension>
E/flutter ( 2064): #1      _SimpleRecorderState.record (package:ychat/screens/chat/tempRecord.dart:84:22)
E/flutter ( 2064): #2      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:993:19)
E/flutter ( 2064): #3      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:1111:38)
E/flutter ( 2064): #4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:183:24)
E/flutter ( 2064): #5      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:598:11)
E/flutter ( 2064): #6      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:287:5)
E/flutter ( 2064): #7      BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:222:7)
E/flutter ( 2064): #8      PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:476:9)
E/flutter ( 2064): #9      PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:77:12)
E/flutter ( 2064): #10     PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:122:9)
E/flutter ( 2064): #11     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
E/flutter ( 2064): #12     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:120:18)
E/flutter ( 2064): #13     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:106:7)
E/flutter ( 2064): #14     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:358:19)
E/flutter ( 2064): #15     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:338:22)
E/flutter ( 2064): #16     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:267:11)
E/flutter ( 2064): #17     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:295:7)
E/flutter ( 2064): #18     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:240:7)
E/flutter ( 2064): #19     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:213:7)
E/flutter ( 2064): #20     _rootRunUnary (dart:async/zone.dart:1206:13)
E/flutter ( 2064): #21     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter ( 2064): #22     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter ( 2064): #23     _invoke1 (dart:ui/hooks.dart:265:10)
E/flutter ( 2064): #24     _dispatchPointerDataPacket (dart:ui/hooks.dart:174:5)
E/flutter ( 2064): 

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
bhanuka96commented, Dec 7, 2020

Thank you very much for your time @Larpoux

0reactions
bhanuka96commented, Dec 7, 2020

Version 6.4.7 with correct code for asking permission is released.

Thank you to have pointed this missing code in the examples.

It’s working now. BTW, need to add <uses-permission android:name="android.permission.RECORD_AUDIO"/> on android

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 >
audio_recorder - Bountysource
ZygoteInit.main(ZygoteInit.java:1075) E/flutter ( 3981): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, null, ...
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