ja2375/FluTube

Player crashes with InvalidResponseCodeException sometimes

Closed this issue · 6 comments

PiN73 commented

I tried to play example video. It works well, but about in 5% cases it prints the following exception

E/ExoPlayerImplInternal(25866): Source error.
E/ExoPlayerImplInternal(25866): com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403
E/ExoPlayerImplInternal(25866): 	at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:300)
E/ExoPlayerImplInternal(25866): 	at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:83)
E/ExoPlayerImplInternal(25866): 	at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:885)
E/ExoPlayerImplInternal(25866): 	at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381)
E/ExoPlayerImplInternal(25866): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/ExoPlayerImplInternal(25866): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/ExoPlayerImplInternal(25866): 	at java.lang.Thread.run(Thread.java:764)

and the video is loading infinitely showing on-screen error

Full output when video is crashed

Output when video works

Tried on different networks, different emulators and physical devices, debug and release versions.

PiN73 commented

Just made number of tests (launch app, press play, wait until playing started or error occurred, close app, repeat). Used the following parameters

FluTube(
  'https://www.youtube.com/watch?v=nPt8bK2gbaU',
  aspectRatio: 16 / 9,
  autoInitialize: true,
)

the result is ++++++++-+-++---++-++++++-++++-+ (+ means worked, - means error)

I'm aware of this. But unfortunately i think there is not too much i can do since this error occurs in the video_player plugin :(
I hope they will fix it one day...
I know it is not a flutube error because i did some debug and all URLs are loading well before creating the player, but it sometimes just crashes because, i believe, there is a race condition somewhere in the video_player plugin code.
Sorry not to be more helpful. If you know what the error is and where it happens, you could open an issue in the video_player plugin repo.

PiN73 commented

So it is not related to copyrighted videos and encryption? From readme:

PLEASE NOTE: Embedding copyrighted videos is actually not possible.

Nope. This error happens with all videos.
If you try to embed a copyrighted video, it won't play at anytime. No matter if you retry.

PiN73 commented

OK, thank you for explanation

You are welcome :)