Any specific reason why it has minSdkVersion as 24 ?
I want to use this plugin but I cannot afford minSdkVersion as 24.
What are the extra features it is using ?
Can we downgrade it to minSdkVersion 21 ?
Yes.
The actual minSdkVersion is not good. This is my fault.
I will try to downgrade to 16 in Flutter Sound 5.1
(Probably this week)
Sorry for the actual inconvenient.
Alright, till the time I'll fork it and make my POC on it and eagerly waiting for you to upgrade the package.
I was going to ask the same thing. Btw can we use this package for production? Also, I wonder how to cut sounds. Will it be available or never?
Actually, Flutter Sound V5 cannot be installed on an Android emulator having a SDK Version less than 24. I do not understand really why, but I do not have much time for investigating this limit.
Maybe someone else can look to that ?
Probably your solution is to use Flutter Sound V4, which has a MinSdkVersion = 16.
@Larpoux does Flutter Sound V5 works fine on real Android device aving a SDK Version less than 24?
π I hope so !
Personally I am actually focused on iOS for my own app, so I have not yet used Android very much.
(My own App makes heavy use of sound, so it is a very good test of Flutter Sound.
I plan to port my App to Android later this year.)
But I have not received any complain for Android, yet.
Hi, @felixjunghans ,
If the only reason for which Flutter Sound need sdk 24 is the use of lambda functions, it should be easy to fix that.
Please, go ahead and do a Pull Request. Other people will be glad of your contribution.
Sorry @Larpoux I was totally wrong and deleted my comment because of that in the hope you haven't seen it yet :D. The use of Lamdas is totally ok. I have now done the following in my project to get Flutter sound working with SDK version 21. In the AndroidManifest I have added the following line:
<uses-sdk android:minSdkVersion="21"
android:targetSdkVersion="28"
tools:overrideLibrary="com.dooboolab.fluttersound" />
So my project now runs on minSdkVersion 21 and with Flutter Sound lite.
The only bug I've noticed so far was while try to playing a file. The app crashed after the file was played with following error:
E/AndroidRuntime(10708): FATAL EXCEPTION: main
E/AndroidRuntime(10708): java.lang.IllegalArgumentException
E/AndroidRuntime(10708): at java.util.Timer.schedule(Timer.java:476)
E/AndroidRuntime(10708): at com.dooboolab.fluttersound.FlutterSoundPlayer.onPrepared(FlutterSoundPlayer.java:462)
E/AndroidRuntime(10708): at com.dooboolab.fluttersound.FlutterSoundPlayer.lambda$startPlayer$0$FlutterSoundPlayer(FlutterSoundPlayer.java:375)
E/AndroidRuntime(10708): at com.dooboolab.fluttersound.-$$Lambda$FlutterSoundPlayer$CKEELXPVh5rkG3TIOBhd8o5Vky8.onPrepared(lambda)
E/AndroidRuntime(10708): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3712)
E/AndroidRuntime(10708): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(10708): at android.os.Looper.loop(Looper.java:158)
E/AndroidRuntime(10708): at android.app.ActivityThread.main(ActivityThread.java:7230)
E/AndroidRuntime(10708): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(10708): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
E/AndroidRuntime(10708): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
To fix this error I have replaced this line of code:
mTimer.schedule(mTask, 0, subsDurationMillis);
with this line of code:
mTimer.schedule(mTask, 0, subsDurationMillis > 0 ? subsDurationMillis : 1);
in FlutterSoundPlayer.java ( Line 462).
It's probably not the best solution but now I can record and play PCM without problems on sdkVersion 21.
Sorry again for assuming, wrongly, that it was the Lambdas. I thought it was because lambdas are only supported in Java 8 and above and FlutterSoundPlayer.onPrepared is called via a lambda.
π Thank you so much, @felixjunghans , for your work.
This will help many people having the same problem than you.
I will look to your patch and integrate it in next Flutter Sound version.
Thank you again for the time you spent to improve Flutter Sound π₯
Hi so is it stable to use sdkVersion 16/21 instead of 24 now? Thanks!
@fzyzcjy I use Flutter Sound with minSdkVersion 21 and the described changes in my comment. I don't know if the current version of flutter sound includes these changes, because I'm currently using a local fork of Flutter sound.
Thank you for this, @felixjunghans . I am glad that you confirm that your patch is fine. π
I plan to do an update of Flutter Sound in a few weeks (I fixed a bug in Android openAudioSession() ).
I will insert your patch into this new release.
By the way, if you are working on your own fork, maybe you added some great features that could be interesting to share with other users. Do not hesitate to do Pull Requests if this is the case.
When are you planning to change the minSDK version to 16 or 19?
I'm using 3.x.x version of sound APIs have tons of app crash errors even when the app was not running. it's something to do with the background services. I would like to used 5.x.x APIs but it seems the minSDK should be 24. Our app's minSDK was 19 and we cannot change it to 24 at all now.
Please let me know if you have plans to support SDK 19 or not.
Thank you.
Hi I find a strange thing when reviewing the code: Inside FlutterSoundAudioRecorder, one of the codec is AudioFormat.ENCODING_AAC_LC. However, it warns that Field requires min API 28. Thus, IMHO, in Android lower than 28, this encoding (as well as several others) may not work!!! This seems to be a serious problem :( Does anyone have a <28 device to test it? @Larpoux
Hi @kmusham .
I am really sorry to hear that you must still use FS 3.x.x
This is really a not sane situation for you. π
I am actually working on a FS version 6.0.0
This version will be compatible with minSdk 16 (as it was in previous versions). π
I began to do some tests on a SDK 19 emulator, and it seems to work correctly. Unfortunately those very old Android versions do not support many codecs for recording (as @fzyzcjy told us).
I will adapt the result of isEncoderSupported() verb to reflect the current SDK used by the device.
I hope to release V6.0 in next few weeks. So be patient.
Wow! Thank you so much for working on 6.x.x and making it compatible with sdk 19.
Yesterday, I just updated from 3.x.x. to 4.0.6 and I'm not seeing the app crashes anymore.
I need to do some more tests before deploy to production.
V6.0 is released. The MinSdk is 18.
But I have many problems doing simulation on the Android emulator and I do not have a so old (!) real device.
It seems that playback is OK on SDK 18, but recording needs at least SDK 24
If someone has a very old Android device, it would be good if he/she does some test to understand these compatibilty issues.
Most helpful comment
Yes.
The actual minSdkVersion is not good. This is my fault.
I will try to downgrade to 16 in Flutter Sound 5.1
(Probably this week)
Sorry for the actual inconvenient.