flutter_sound: ^1.7.0
Run the example of flutter_sound, ios can't record audio when codec use t_CODEC.CODEC_MP3, android is ok.
/Users/mayer/development/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G1012, locale zh-Hans-CN)
• Flutter version 1.12.13+hotfix.5 at /Users/mayer/development/flutter
• Framework revision 27321ebbad (9 days ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/mayer/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.2, Build version 11B52
• CocoaPods version 1.6.1
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 41.1.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (2 available)
• ELE AL00 • GBG0219619002278 • android-arm64 • Android 9 (API 28)
• LECHENG的 iPhone • 319ce14e3c039f4f9f588e398878952f1f4ecba4 • ios • iOS 13.3
Automatically signing iOS for device deployment using specified development team in Xcode project: ZA562ZPM4Z
Running pod install...
Running Xcode build...
Xcode build done. 27.6s
Installing and launching...
Syncing files to device LECHENGçš„ iPhone...
flutter: got update -> 160.0
flutter: got update -> 160.0
flutter: got update -> 160.0
flutter: got update -> 160.0
flutter: got update -> 160.0
flutter: got update -> 160.0
flutter: got update -> 160.0
flutter: got update -> 160.0
flutter: got update -> 160.0
flutter: stopRecorder: file:///var/mobile/Containers/Data/Application/2A01E0CF-6CA2-42F2-8C6A-745463D38828/Library/Caches/sound.mp3
flutter: startPlayer result: /var/mobile/Containers/Data/Application/2A01E0CF-6CA2-42F2-8C6A-745463D38828/Library/Caches/sound.mp3
flutter: startPlayer: /var/mobile/Containers/Data/Application/2A01E0CF-6CA2-42F2-8C6A-745463D38828/Library/Caches/sound.mp3
flutter: error: PlatformException(Audio Player, player is not set, null)
Could you share minimal reproduction? Please share some of your code.
Actually, the compatibility of various Codecs between Android and iOS is very weak. The only Codec really compatible is AAC.
I want to add a very simple method in the flutter_sound plugin so that the app can dynamically know if a particulary codec is supported by the current plateforme:
if ( flutter_sound.isCodecSupported(t_CODEC.CODEC_MP3) ) {
...
}
I will add this method in my next Pull Request.
But a really better solution would be to really support other Codecs than AAC on the two plateformes. This is not simple, because Google and Apple do not agree which codecs are OK on their OS.
I plan to support VORBIS and OPUS both on Android and iOS, but this is much work. For MP3 I do not have actually any plan, because personally I need OPUS for my own project. OPUS is much better than MP3.
I think that Apple does not support recording MP3 because of patents/license issues. I am glad to know that Android support MP3 recording, but I am surprised : There is here the same license issue than iOS.
@Larpoux Sounds very promising.
Actually, the following codecs are supported by flutter_sound:
| | AAC | OGG/Opus | CAF/Opus | MP3 | OGG/Vorbis | PCM |
| :------------ |:---------------:| :---------------:| :-----| :-----| :-----| :-----|
| iOS encoder| Yes | No | Yes | No | No | No |
| iOS decoder| Yes | No | Yes | Yes | No | Yes |
| Android encoder| Yes | No | No | No | No | No |
| Android decoder| Yes | Yes | No | Yes | Yes | Yes |
This table will eventually be upgrated when more codecs will be added.
Most helpful comment
Codec compatibility:
Actually, the following codecs are supported by flutter_sound:
| | AAC | OGG/Opus | CAF/Opus | MP3 | OGG/Vorbis | PCM |
| :------------ |:---------------:| :---------------:| :-----| :-----| :-----| :-----|
| iOS encoder| Yes | No | Yes | No | No | No |
| iOS decoder| Yes | No | Yes | Yes | No | Yes |
| Android encoder| Yes | No | No | No | No | No |
| Android decoder| Yes | Yes | No | Yes | Yes | Yes |
This table will eventually be upgrated when more codecs will be added.