I want to make an app that can playing audios in Android TV using just_audio Flutter package. I want to use try-catch in Flutter to handle the error when I using audio that cannot play due of com.google.android.exoplayer2.ExoPlaybackException: Source error
. But it didn’t work when I try using try-catch in .durationStream.listen
, .positionStream.listen
, .currentIndexStream.listen
and anywhere I try to put try-catch.
After I playing this audio in Android TV, when I click next/previous audio, and even change the song playlist index (using seek(Duration.zero, index : newIndex)
), the next/previous audio or changed song playlist index cannot playing and only changing artist and title. Only can playing normally if I start the audio from audio list in files. Strangely, there is no problem when I playing in Android phone and can skip this song without problem.
So, how can I handle this error below?
Error code :
D/CompatibilityChangeReporter(19436): Compat change id reported: 147798919; UID 10280; state: ENABLED
E/ExoPlayerImplInternal(19436): Playback error
E/ExoPlayerImplInternal(19436): com.google.android.exoplayer2.ExoPlaybackException: Source error
E/ExoPlayerImplInternal(19436): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:644)
E/ExoPlayerImplInternal(19436): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:614)
E/ExoPlayerImplInternal(19436): at android.os.Handler.dispatchMessage(Handler.java:102)
E/ExoPlayerImplInternal(19436): at android.os.Looper.loop(Looper.java:223)
E/ExoPlayerImplInternal(19436): at android.os.HandlerThread.run(HandlerThread.java:67)
E/ExoPlayerImplInternal(19436): Caused by: com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (FlvExtractor, FlacExtractor, WavExtractor, FragmentedMp4Extractor, Mp4Extractor, AmrExtractor, PsExtractor, OggExtractor, TsExtractor, MatroskaExtractor, AdtsExtractor, Ac3Extractor, Ac4Extractor, Mp3Extractor, AviExtractor, JpegExtractor) could read the stream.
E/ExoPlayerImplInternal(19436): at com.google.android.exoplayer2.source.BundledExtractorsAdapter.init(BundledExtractorsAdapter.java:92)
E/ExoPlayerImplInternal(19436): at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1017)
E/ExoPlayerImplInternal(19436): at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412)
E/ExoPlayerImplInternal(19436): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/ExoPlayerImplInternal(19436): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/ExoPlayerImplInternal(19436): at java.lang.Thread.run(Thread.java:923)
E/AudioPlayer(19436): TYPE_SOURCE: None of the available extractors (FlvExtractor, FlacExtractor, WavExtractor, FragmentedMp4Extractor, Mp4Extractor, AmrExtractor, PsExtractor, OggExtractor, TsExtractor, MatroskaExtractor, AdtsExtractor, Ac3Extractor, Ac4Extractor, Mp3Extractor, AviExtractor, JpegExtractor) could read the stream.
E/flutter (19436): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(0, Source error, {index: 8}, null)
E/flutter (19436):
W/libEGL (19436): EGLNativeWindowType 0x93df1808 disconnect failed
Package used :
just_audio: ^0.9.39
just_audio_background: ^0.0.1-beta.13
audio_service: ^0.18.14