Skip to content
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

Just audio randomly crash when playing a 1/2s sound #1349

Open
HeropolisDa2ny opened this issue Oct 8, 2024 · 2 comments
Open

Just audio randomly crash when playing a 1/2s sound #1349

HeropolisDa2ny opened this issue Oct 8, 2024 · 2 comments
Assignees
Labels
1 backlog bug Something isn't working

Comments

@HeropolisDa2ny
Copy link

Which API doesn't behave as documented, and how does it misbehave?
The method play: It should play the music without sending any crash exception. This crash makes the plugin not available anymore. It is needed to restart the app to

Minimal reproduction project
The example

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:
Play a sound of 1/2 seconds
Randomly the sound doesn't work anymore because of a package crash

Error messages

E/android.media.AudioTrack( 2856): Error code -20 when initializing AudioTrack.
E/MediaCodecAudioRenderer( 2856): Audio sink error
E/MediaCodecAudioRenderer( 2856): com.google.android.exoplayer2.audio.AudioSink$InitializationException: AudioTrack init failed 0 Config(48000, 4, 30752) Format(null, null, null, audio/raw, null, -1, null, [-1, -1, -1.0], [1, 48000])
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.buildAudioTrack(DefaultAudioSink.java:2136)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.audio.DefaultAudioSink.buildAudioTrack(DefaultAudioSink.java:1073)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.audio.DefaultAudioSink.buildAudioTrackWithRetry(DefaultAudioSink.java:1051)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.audio.DefaultAudioSink.initializeAudioTrack(DefaultAudioSink.java:843)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.audio.DefaultAudioSink.handleBuffer(DefaultAudioSink.java:929)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.processOutputBuffer(MediaCodecAudioRenderer.java:709)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1889)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:782)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1007)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:502)
E/MediaCodecAudioRenderer( 2856): at android.os.Handler.dispatchMessage(Handler.java:102)
E/MediaCodecAudioRenderer( 2856): at android.os.Looper.loopOnce(Looper.java:201)
E/MediaCodecAudioRenderer( 2856): at android.os.Looper.loop(Looper.java:288)
E/MediaCodecAudioRenderer( 2856): at android.os.HandlerThread.run(HandlerThread.java:67)
E/MediaCodecAudioRenderer( 2856): Caused by: java.lang.UnsupportedOperationException: Cannot create AudioTrack
E/MediaCodecAudioRenderer( 2856): at android.media.AudioTrack$Builder.build(AudioTrack.java:1308)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.createAudioTrackV29(DefaultAudioSink.java:2185)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.createAudioTrack(DefaultAudioSink.java:2163)
E/MediaCodecAudioRenderer( 2856): at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.buildAudioTrack(DefaultAudioSink.java:2128)
E/MediaCodecAudioRenderer( 2856): ... 13 more
E/AudioTrack( 2856): createTrack_l(0): AudioFlinger could not create track, status: -12 output 0

Expected behavior
Play a sound

Screenshots
No screenshots

Desktop (please complete the following information):

  • OS: MacOS + 14.6.1 (23G93)
  • Browser: Chrome Version 129.0.6668.90 (Official Build) (arm64)

Smartphone (please complete the following information):

  • Device: Core M5 (mobile)
  • OS: android-arm64 • Android 12 (API 31)

Flutter SDK version

[✓] Flutter (Channel stable, 3.24.0, on macOS 14.6.1 23G93 darwin-arm64, locale en-MX)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.92.2)
[✓] Connected device (5 available)
[✓] Network resources

Additional context
No additional context

@HeropolisDa2ny HeropolisDa2ny added 1 backlog bug Something isn't working labels Oct 8, 2024
@HeropolisDa2ny
Copy link
Author

I dont know if this could help resolving the problem.

Here is the sounds that I'm using :
Archive.zip

To play the sound I want I do :

final AudioPlayer _player = AudioPlayer();

await _player.setAsset(asset, preload: preload);
await _player.play();

await _player.dispose();

These lines are set in a class that I'm calling at multiple places in my code (yes I'm calling multiple time and so initializing multiple time a new AudioPlayer)

@ryanheise
Copy link
Owner

The instructions for submitting a bug report say:

Provide a link here using one of two options:

  1. Fork this repository and modify the example to reproduce the bug, then provide a link here.
  2. If the unmodified official example already reproduces the bug, just write "The > example".

You chose option 2 incorrectly because the "unmodified" example works correctly. When you say you don't know what would help, following option 1 would help. Or, if you have a direct URL to the audio, and if the only modification to the example would be changing the URL to that, then you can just provide the URL as explained in the contributing guidelines linked at the bottom of this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 backlog bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants