just_audio icon indicating copy to clipboard operation
just_audio copied to clipboard

Attempting to play missing AudioSource.uri causes crash

Open Forander opened this issue 2 years ago • 0 comments

Just_audio is working great for me but I just wanted to flag an issue that I think would be fairly common in practice.

When attempting to play a missing AudioSource.uri (ex: there is a source uri error), this causes just_audio_background to crash (infinite circularprogressindicator). Just_audio_background is then unable to move to another media item. This can easily be reproduced by modifying one of the URIs in the just_audio_background example (https://github.com/ryanheise/just_audio/tree/master/just_audio_background/example).

It seems a better behaviour would be to either display that the source audio URI is missing, and/or allow the user to exit the error loop when selecting a valid audio item in the playlist.

I realise this may not be an error but simply something that I should address in my own just_audio application. I thought I would flag in any case for beginners like me who are playing around with the examples.

Minimal reproduction project "The github just_audio_background example".

To Reproduce Steps to reproduce the behavior:

  1. Clone 'just_audio_background/example/lib/main.dart'
  2. Modify the 4th Audiosource URI from 'Uri.parse("asset:///audio/nature.mp3")' to 'Uri.parse("asset:///audio/natureERROR.mp3"),' (i.e. does not exist)
  3. Run example
  4. Click on 4th audio, 'nature sounds'
  5. Error, unable to play other audio sources, stuck in infinite circularprogressindicator.

Which API doesn't behave as documented, and how does it misbehave? just_audio_background

Minimal reproduction project "The example".

To Reproduce (i.e. user steps, not code) see above

Error messages I/CCodecConfig(19282): query failed after returning 7 values (BAD_INDEX) W/Codec2Client(19282): query -- param skipped: index = 1342179345. W/Codec2Client(19282): query -- param skipped: index = 2415921170. D/AudioTrack(19282): ~AudioTrack(): RelativeVolumeFeature mSessionId:38481, clientId:449 E/ExoPlayerImplInternal(19282): Playback error E/ExoPlayerImplInternal(19282): com.google.android.exoplayer2.ExoPlaybackException: Source error E/ExoPlayerImplInternal(19282): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:624) E/ExoPlayerImplInternal(19282): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:594) E/ExoPlayerImplInternal(19282): at android.os.Handler.dispatchMessage(Handler.java:102) E/ExoPlayerImplInternal(19282): at android.os.Looper.loop(Looper.java:250) E/ExoPlayerImplInternal(19282): at android.os.HandlerThread.run(HandlerThread.java:67) E/ExoPlayerImplInternal(19282): Caused by: com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (Mp3Extractor, FlvExtractor, FlacExtractor, WavExtractor, FragmentedMp4Extractor, Mp4Extractor, AmrExtractor, PsExtractor, OggExtractor, TsExtractor, MatroskaExtractor, AdtsExtractor, Ac3Extractor, Ac4Extractor, JpegExtractor) could read the stream. E/ExoPlayerImplInternal(19282): at com.google.android.exoplayer2.source.BundledExtractorsAdapter.init(BundledExtractorsAdapter.java:92) E/ExoPlayerImplInternal(19282): at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1025) E/ExoPlayerImplInternal(19282): at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409) E/ExoPlayerImplInternal(19282): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/ExoPlayerImplInternal(19282): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/ExoPlayerImplInternal(19282): at java.lang.Thread.run(Thread.java:923) 2 D/CCodecBufferChannel(19282): [c2.android.mp3.decoder#881] MediaCodec discarded an unknown buffer I/chatty (19282): uid=10441(com.ryanheise.just_audio_example) MediaCodec_loop identical 1 line D/CCodecBufferChannel(19282): [c2.android.mp3.decoder#881] MediaCodec discarded an unknown buffer I/hw-BpHwBinder(19282): onLastStrongRef automatically unlinking death recipients

Expected behavior Screenshots Desktop (please complete the following information): Smartphone (please complete the following information): Android Flutter SDK version Additional context

Forander avatar Mar 15 '22 15:03 Forander