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

Using Lock Exoplayer Response Code 500 / Proxy Status Error: 400 #832

Closed
matecode opened this issue Oct 6, 2022 · 11 comments
Closed

Using Lock Exoplayer Response Code 500 / Proxy Status Error: 400 #832

matecode opened this issue Oct 6, 2022 · 11 comments
Assignees
Labels
1 backlog bug Something isn't working

Comments

@matecode
Copy link

matecode commented Oct 6, 2022

Thanks for your great libraries 🧡 . I found an issue with the experimental LockCachingAudioSource in combination with background audio and headers. I tried my best to fulfil the Bug Report requirements :)

Which API doesn't behave as documented, and how does it misbehave?
LockCachingAudioSource does not work in combination with headers set, at least if you use Just_audio_background (didnt try without background use)
If you don't set headers everything works fine.

Minimal reproduction project
https://github.com/matecode/just_audio/tree/LockCachingAudioSource-Header-Issue

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

  1. Clone repo
  2. Start playing -> Error from proxy (see below)
  3. Try plying without headers (has be null not an empty map)
  4. works as expected

Error messages

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...
Building with Flutter multidex support enabled.
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Debug service listening on ws://127.0.0.1:59027/zQKtBz6Lsss=/ws
Syncing files to device sdk gphone64 arm64...
I/ExoPlayerImpl( 7646): Init 58239c3 [ExoPlayerLib/2.17.1] [emulator64_arm64, sdk_gphone64_arm64, Google, 31]
W/t_audio_exampl( 7646): Accessing hidden method Landroid/media/AudioTrack;->getLatency()I (unsupported, reflection, allowed)
I/flutter ( 7646): Proxy request failed: Exception: HTTP Status Error: 400
I/flutter ( 7646): #0      LockCachingAudioSource._fetch (package:just_audio/just_audio.dart:2794:7)
I/flutter ( 7646): <asynchronous suspension>
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: HTTP Status Error: 400
E/flutter ( 7646): #0      LockCachingAudioSource._fetch (package:just_audio/just_audio.dart:2794:7)
E/flutter ( 7646): <asynchronous suspension>
E/flutter ( 7646): 
D/EGL_emulation( 7646): app_time_stats: avg=15.17ms min=2.92ms max=94.08ms count=55
I/flutter ( 7646): Proxy request failed: Exception: HTTP Status Error: 400
I/flutter ( 7646): #0      LockCachingAudioSource._fetch (package:just_audio/just_audio.dart:2794:7)
I/flutter ( 7646): <asynchronous suspension>
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: HTTP Status Error: 400
E/flutter ( 7646): #0      LockCachingAudioSource._fetch (package:just_audio/just_audio.dart:2794:7)
E/flutter ( 7646): <asynchronous suspension>
E/flutter ( 7646): 
D/EGL_emulation( 7646): app_time_stats: avg=4.48ms min=2.26ms max=5.97ms count=59
I/flutter ( 7646): Proxy request failed: Exception: HTTP Status Error: 400
I/flutter ( 7646): #0      LockCachingAudioSource._fetch (package:just_audio/just_audio.dart:2794:7)
I/flutter ( 7646): <asynchronous suspension>
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: HTTP Status Error: 400
E/flutter ( 7646): #0      LockCachingAudioSource._fetch (package:just_audio/just_audio.dart:2794:7)
E/flutter ( 7646): <asynchronous suspension>
E/flutter ( 7646): 
D/EGL_emulation( 7646): app_time_stats: avg=4.42ms min=2.54ms max=5.76ms count=60
D/EGL_emulation( 7646): app_time_stats: avg=4.00ms min=2.17ms max=6.65ms count=59
I/flutter ( 7646): Proxy request failed: Exception: HTTP Status Error: 400
I/flutter ( 7646): #0      LockCachingAudioSource._fetch (package:just_audio/just_audio.dart:2794:7)
I/flutter ( 7646): <asynchronous suspension>
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: HTTP Status Error: 400
E/flutter ( 7646): #0      LockCachingAudioSource._fetch (package:just_audio/just_audio.dart:2794:7)
E/flutter ( 7646): <asynchronous suspension>
E/flutter ( 7646): 
E/ExoPlayerImplInternal( 7646): Playback error
E/ExoPlayerImplInternal( 7646):   com.google.android.exoplayer2.ExoPlaybackException: Source error
E/ExoPlayerImplInternal( 7646):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:641)
E/ExoPlayerImplInternal( 7646):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:613)
E/ExoPlayerImplInternal( 7646):       at android.os.Handler.dispatchMessage(Handler.java:102)
E/ExoPlayerImplInternal( 7646):       at android.os.Looper.loopOnce(Looper.java:201)
E/ExoPlayerImplInternal( 7646):       at android.os.Looper.loop(Looper.java:288)
E/ExoPlayerImplInternal( 7646):       at android.os.HandlerThread.run(HandlerThread.java:67)
E/ExoPlayerImplInternal( 7646):   Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 500
E/ExoPlayerImplInternal( 7646):       at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:396)
E/ExoPlayerImplInternal( 7646):       at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:258)
E/ExoPlayerImplInternal( 7646):       at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84)
E/ExoPlayerImplInternal( 7646):       at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1009)
E/ExoPlayerImplInternal( 7646):       at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412)
E/ExoPlayerImplInternal( 7646):       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/ExoPlayerImplInternal( 7646):       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/ExoPlayerImplInternal( 7646):       at java.lang.Thread.run(Thread.java:920)
E/AudioPlayer( 7646): TYPE_SOURCE: Response code: 500
I/ExoPlayerImpl( 7646): Release 58239c3 [ExoPlayerLib/2.17.1] [emulator64_arm64, sdk_gphone64_arm64, Google, 31] [goog.exo.core, goog.exo.exoplayer, goog.exo.decoder, goog.exo.datasource]
I/flutter ( 7646): Error loading playlist: (0) Source error
I/flutter ( 7646): #0      AudioPlayer._load (package:just_audio/just_audio.dart:840:9)
I/flutter ( 7646): <asynchronous suspension>
I/flutter ( 7646): #1      AudioPlayer._setPlatformActive.setPlatform (package:just_audio/just_audio.dart:1421:28)
I/flutter ( 7646): <asynchronous suspension>
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(0, Source error, null, null)
E/flutter ( 7646): 
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(0, Source error, null, null)
E/flutter ( 7646): 
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(0, Source error, null, null)
E/flutter ( 7646): 
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(0, Source error, null, null)
E/flutter ( 7646): 
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(abort, Connection aborted, null, null)
E/flutter ( 7646): 
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(abort, Connection aborted, null, null)
E/flutter ( 7646): 
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(abort, Connection aborted, null, null)
E/flutter ( 7646): 
E/flutter ( 7646): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(abort, Connection aborted, null, null)
E/flutter ( 7646): 
D/EGL_emulation( 7646): app_time_stats: avg=4.17ms min=2.24ms max=13.27ms count=58

Expected behavior
The headers should be used for the request and there should be no error if using headers.

Smartphone (please complete the following information):
Tested on

  • Device: iPhone XS max iOs 16
  • Device: Android Emulator different API Versions
  • Device: Samsung A53 5G Android 12

Flutter SDK version

[✓] Flutter (Channel stable, 3.3.4, on macOS 12.6 21G115 darwin-arm, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.71.2)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

• No issues found!

@matecode matecode added 1 backlog bug Something isn't working labels Oct 6, 2022
@ryanheise
Copy link
Owner

Hi @matecode is this a duplicate of #594 ?

@matecode
Copy link
Author

matecode commented Oct 7, 2022

@ryanheise After reading through #594 im not 100% if it is duplicate because #594 is really hard to follow. I try my best to understand it, at the moment i think it could be another impact of the bug. I'm not 100% sure because on #594 it looks like the proxy is dying at some point, but for my error it seem to never work.

@ryanheise
Copy link
Owner

I have just tested regular just_audio without the background (since that's more minimal and helps narrow it down), and it also does reproduce the issue.

@ryanheise
Copy link
Owner

I've committed a fix to the fix/cache_headers branch if you'd like to test it.

@matecode
Copy link
Author

matecode commented Oct 11, 2022

Hallo @ryanheise ! I can confirm that headers are now working in the fix branch. Great work, thank you. 🦄🌈

@ryanheise
Copy link
Owner

Thanks for confirming that.

P.S. Nice edit on your comment ;-)

@ryanheise
Copy link
Owner

Note that I will need to do some further refactoring before I release this. I will let you know once that's done in case I break things again.

@matecode
Copy link
Author

Sounds good! I use the fix branch in a MVP which is fine for me, would be nice if you can keep it running until you release the fix.

@ryanheise
Copy link
Owner

I've just done the refactoring. This may or may not break things. Would you like to test?

@ryanheise
Copy link
Owner

The refactored version has now been merged and published.

@github-actions
Copy link

github-actions bot commented Nov 7, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 backlog bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants