-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Platform Exception Error when playing audio file Android, Vscode (0.17.3) #752
Comments
After doing some more searching I did find this entry in the forum that addressed my issue. #734 (comment) however this is a workaround not a fix so I would suggest that this issue remains open. This workaround can also cause an error if sounds are played to quickly in succession or overlap. Error: I/ExoPlayerImpl( 7743): Release 26b0552 [ExoPlayerLib/2.12.1] [generic_x86_arm, sdk_gphone_x86_arm, Google, 30] [goog.exo.core] |
same for me on android simulator: E/flutter (23956): at kotlin.collections.EmptyMap.put(Unknown Source:4) |
I'm also seeing this when upgrading from 0.16.1 to 0.17.3, #734 (comment) does work (i.e. send MEDIA_PLAYER instead of LOW_LATENCY) but I would like to use LOW_LATENCY on Android. I'm getting tired that there are so many bugs in this repo. Can anyone recommend alternative solutions for playing sound effects and short mp3 files in Flutter (must work well in iOS)? |
Closing this due to reports of this being fixed on newer versions. Feel free to open a new issue in case of this still happening |
Does not work on 0.20.1 on Android. Changing to type MediaPlayer works but not what I'd like to have. Platform android version 31. |
I'm not sure if this is worthy of a new issue but: I just saw this issue when testing
|
I personally don't plan to fix Android specific bugs, until we have ExoPlayer landed, which again depends on Flutter. We're happy for Pull-Requests though. |
Playing an audio file causes a Platform Exception Error.
Full Description
Playing an audio file
_player.play('BG.mp3', mode: PlayerMode.LOW_LATENCY);
causes a the following error.Exception has occurred.
PlatformException (PlatformException(Unexpected error!, Operation is not supported for read-only collection, java.lang.UnsupportedOperationException: Operation is not supported for read-only collection
at kotlin.collections.EmptyMap.put(Unknown Source:4)
at java.util.Collections$SynchronizedMap.put(Collections.java:2639)
at xyz.luan.audioplayers.WrappedSoundPool.setUrl(WrappedSoundPool.kt:247)
at xyz.luan.audioplayers.AudioplayersPlugin.handleMethodCall(AudioplayersPlugin.kt:62)
at xyz.luan.audioplayers.AudioplayersPlugin.onMethodCall(AudioplayersPlugin.kt:37)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
, null))
Code to Reproduce
Play any audio file with the play method.
Log Errors
Exception has occurred.
PlatformException (PlatformException(Unexpected error!, Operation is not supported for read-only collection, java.lang.UnsupportedOperationException: Operation is not supported for read-only collection
at kotlin.collections.EmptyMap.put(Unknown Source:4)
at java.util.Collections$SynchronizedMap.put(Collections.java:2639)
at xyz.luan.audioplayers.WrappedSoundPool.setUrl(WrappedSoundPool.kt:247)
at xyz.luan.audioplayers.AudioplayersPlugin.handleMethodCall(AudioplayersPlugin.kt:62)
at xyz.luan.audioplayers.AudioplayersPlugin.onMethodCall(AudioplayersPlugin.kt:37)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
, null))
Platforms
Android only.
Flutter Doctor Output
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.1 20C69 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
[!] Android Studio (version 4.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.52.1)
[✓] Connected device (2 available)
! Error: iPhone is busy: Copying cache files from device. Xcode will continue when Paul’s iPhone is finished. (code -10)
! Doctor found issues in 1 category.
immergenmac2@Pauls-MacBook-Pro mobile-flutter-afx2020 % flutter doctor -v
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.1 20C69 darwin-x64, locale en-US)
• Flutter version 1.22.6 at /Users/development/flutter
• Framework revision 9b2d32b605 (11 days ago), 2021-01-22 14:36:39 -0800
• Engine revision 2f0af37152
• Dart version 2.10.5
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/immergenmac2/Library/Android/sdk
• Platform android-30, build-tools 30.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_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.0
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality. (FYI this is know VScode issue with Flutter doctor has always been this way even when build was working).
✗ Dart plugin not installed; this adds Dart specific functionality. (FYI this is know VScode issue with Flutter doctor has always been this way even when build was working).
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.52.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.19.0
The text was updated successfully, but these errors were encountered: