ryanheise / just_audio

Audio Player
1.05k stars 675 forks source link

ExoPlaybackException: Source error from 403 after playing a ( event playlist-type) HLS audio #843

Open jainsanil18 opened 2 years ago

jainsanil18 commented 2 years ago

Which API doesn't behave as documented, and how does it misbehave? HlsAudioSource , im using it to play it to play my hls audios but after completely playing an hls audio , the player throws an exoplayback exception which is not captured in try and catch and the player freezes. Minimal reproduction project Provide a link here using one of two options: the example

To Reproduce (i.e. user steps, not code) Steps to reproduce the behavior:

  1. Go to main.dart in just_audio examples/lib folder .
  2. on line 47,replace the normal audio source with HlsAudioSource(Uri.parse( "https://talker-dev.s3.us-east-2.amazonaws.com/62edb96c-cf99-43ba-b36b-fb6d74612134.m3u8")) );
    1. now run the main.dart file and completely play the hls audio.
  3. See error

Error messages

Playback error
E/ExoPlayerImplInternal( 7029):   com.google.android.exoplayer2.ExoPlaybackException: Source error
E/ExoPlayerImplInternal( 7029):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:641)
E/ExoPlayerImplInternal( 7029):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:613)
E/ExoPlayerImplInternal( 7029):       at android.os.Handler.dispatchMessage(Handler.java:102)
E/ExoPlayerImplInternal( 7029):       at android.os.Looper.loopOnce(Looper.java:226)
E/ExoPlayerImplInternal( 7029):       at android.os.Looper.loop(Looper.java:313)
E/ExoPlayerImplInternal( 7029):       at android.os.HandlerThread.run(HandlerThread.java:67)
E/ExoPlayerImplInternal( 7029):   Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403
E/ExoPlayerImplInternal( 7029):       at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:396)
E/ExoPlayerImplInternal( 7029):       at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:258)
E/ExoPlayerImplInternal( 7029):       at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84)
E/ExoPlayerImplInternal( 7029):       at com.google.android.exoplayer2.source.hls.HlsMediaChunk.prepareExtraction(HlsMediaChunk.java:495)
E/ExoPlayerImplInternal( 7029):       at com.google.android.exoplayer2.source.hls.HlsMediaChunk.feedDataToExtractor(HlsMediaChunk.java:468)
E/ExoPlayerImplInternal( 7029):       at com.google.android.exoplayer2.source.hls.HlsMediaChunk.loadMedia(HlsMediaChunk.java:437)
E/ExoPlayerImplInternal( 7029):       at com.google.android.exoplayer2.source.hls.HlsMediaChunk.load(HlsMediaChunk.java:394)
E/ExoPlayerImplInternal( 7029):       at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412)
E/ExoPlayerImplInternal( 7029):       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
E/ExoPlayerImplInternal( 7029):       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
E/ExoPlayerImplInternal( 7029):       at java.lang.Thread.run(Thread.java:1012)

Expected behavior instead of throwing the above error,player should have simply changed its processing state to completed since the hls audio has been played completely and player shouldnot freeze if tried to seek to a position in the audio.

Smartphone (please complete the following information):

Flutter SDK version

[√] Flutter (Channel unknown, 3.0.0, on Microsoft Windows [Version 10.0.22000.1098], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.72.0)
[√] Connected device (4 available)
[√] HTTP Host Availability
ryanheise commented 2 years ago

Is that your own HLS file and are you in control of the hosting? If so, I suggest you fix the 403 error since that originates from the server, not from this plugin. If you intentionally modified your server to produce the error because you wanted to show how just_audio fails to report errors in a try/catch, I suggest that you listen to errors on the stream since the error occurs asynchronously. The first TS in your HLS playlist is readable, but the last TS file gives a 403.

rahul-yele commented 1 year ago

Is this issue fixed? I'm also facing the same issue.

ryanheise commented 1 year ago

It's not like anything has been kept secret, please read all the comments above before adding your own comment so that you are informed of where the issue is up to. Then if you do want to add a comment, you can continue from what we were just talking about (i.e. whether this is a server issue) rather than pretending not to know anything about what we have discussed so far.