Open leonjensen opened 1 year ago
@leonjensen Hi, could you please share the error log more? And could you please share the platform information? (iOS? Andriond? and its version)
Sure, im using Ubuntu as OS and this is my output:
The audio itself still works, just thought i might share this, since i couldn't figure out how to get rid of the error.
Well... do you use this library for making Ubuntu (Linux) application? I'm sorry, I can't support it because I don't implement it. @iceychris did on #9 .
I got the same message, when i start the recording. I am on Linux Mint 20
Starting recording sr=44100, bs=3000
[ERROR:flutter/shell/common/shell.cc(1004)] The 'ymd.dev/audio_capture_event_channel' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.
Android does not work either:
D/AudioCaptureStream(19612): onListen started
E/IAudioFlinger(19612): createRecord returned error -22
E/AudioRecord(19612): AudioFlinger could not create record track, status: -22
E/AudioRecord-JNI(19612): Error creating AudioRecord instance: initialization check failed with status -22.
E/android.media.AudioRecord(19612): Error code -20 when initializing native AudioRecord object.
E/AndroidRuntime(19612): FATAL EXCEPTION: Thread-8
E/AndroidRuntime(19612): Process: de.synchrondev.JCHPlayer, PID: 19612
E/AndroidRuntime(19612): java.lang.UnsupportedOperationException: Cannot create AudioRecord
E/AndroidRuntime(19612): at android.media.AudioRecord$Builder.build(AudioRecord.java:635)
E/AndroidRuntime(19612): at com.ymd.flutter_audio_capture.AudioCaptureStreamHandler.record(AudioCaptureStreamHandler.kt:122)
E/AndroidRuntime(19612): at com.ymd.flutter_audio_capture.AudioCaptureStreamHandler.access$record(AudioCaptureStreamHandler.kt:14)
E/AndroidRuntime(19612): at com.ymd.flutter_audio_capture.AudioCaptureStreamHandler$startRecording$runnableObj$1.run(AudioCaptureStreamHandler.kt:57)
E/AndroidRuntime(19612): at java.lang.Thread.run(Thread.java:764)
I/Process (19612): Sending signal. PID: 19612 SIG: 9
So maybe here is something bigger broken...
Probably the way of sharing data between Flutter and plugins or native code changed since I've implemented the Linux part, like the error message above says.
Worth looking into fixing the code to use a Platform Thread for passing data around I guess: https://docs.flutter.dev/platform-integration/platform-channels
@synchronisator I published new issue for Android bug, please provide more information to there. https://github.com/ysak-y/flutter_audio_capture/issues/25
And I'm really sorry, because I don't have proper Linux environment, I can't solve this bug now...
//Need help// Every time im stopping the recording i get the error: write() failed. Data transfer aborted (broken pipe)
Im using a new flutter project with just this package and both the start and the stop method inside as well as the listener and onError. The start method is being called like this:
await plugin.start( listener, onError, sampleRate: 16000, );