Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
876 stars 569 forks source link

[BUG]: iPad iOS cannot record anything without the 16 000kHz sample rate #869

Open magacao opened 2 years ago

magacao commented 2 years ago

Flutter Sound Version :

| |-- flutter_sound_lite... |-- flutter_sound_lite 8.5.0 | |-- flutter_sound_platform_interface 8.5.0 | |-- flutter_sound_web 8.5.0 | | |-- flutter_sound_platform_interface...


Severity


Platforms you faced the error


Describe the bug When starting the recording player, it crashes on an iPad.

To Reproduce Steps to reproduce the behavior: Start the player with SampleRate set as 44100Hz in a stream (toFile = null) on a real device iPad. Codec pcm16.

Logs!!!!

Stops at _startRecorder

See this: flutter: │ 🐛 ---> startRecorderCompleted: true flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.startRecorderCompleted (package:flutter_sound/public/flutter_sound_recorder.dart:243:13) flutter: │ #1 MethodChannelFlutterSoundRecorder.channelMethodCallHandler (package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:74:22) flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 <--- startRecorderCompleted: true flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]' *** First throw call stack: (0x18448bc9c 0x19b63f758 0x18458491c 0x18458eb34 0x18444bb4c 0x184468edc 0x10017e104 0x10091f5f4 0x10092082c 0x1ddee19d0 0x1dde9b65c 0x1ddee08dc 0x184158198 0x1840fa550 0x18410bfb8 0x1840fdfa4 0x1840febb4 0x1840ffd20 0x184108750 0x1dd569e84 0x1dd5699f0) libc++abi: terminating with uncaught exception of type NSException


Turns out by checking this other issue: https://github.com/Canardoux/flutter_sound/issues/689 I realized I could check the default SampleRate and it works with 16000hz.

We could definitely have a better error message for when this crashes. Also we could support 44100Hz as a sample rate on ipad 🤔

Hope this can actually save some search time for someone else.

brianmabusinsoft commented 1 year ago

is it solved?

github-actions[bot] commented 10 months ago

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.