question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting a 403 response code error from exoplayer

See original GitHub issue

Issue description

When playing an http mp4 stream in my activity I get a 403 response code from exoplayer. When I plug the same url in the demo app it plays immediately. I have checked my code against the demo’s player activity and I can’t see any difference or missing code that would result in me getting the 403 and the demo app working. Can someone with better trained eyes check it out for me and point me in the right direction?

Reproduction steps

Pass url to custom exoplayer player activity. results in 403 response code. Demo app plays stream fine.

Link to test content

email sent to dev.exoplayer@gmail.com

Version of ExoPlayer being used

2.5.4

Device(s) and version(s) of Android being used

Pixel C 7.1.1

A full bug report captured from the device

E/EventLogger: internalError [3.76, loadError]
                                                                          com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403
                                                                              at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:211)
                                                                              at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:137)
                                                                              at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:692)
                                                                              at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:315)
                                                                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                              at java.lang.Thread.run(Thread.java:761)

E/EventLogger: playerFailed [3.78]
                                                                          com.google.android.exoplayer2.ExoPlaybackException
                                                                              at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:399)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                              at android.os.Looper.loop(Looper.java:154)
                                                                              at android.os.HandlerThread.run(HandlerThread.java:61)
                                                                           Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403
                                                                              at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:211)
                                                                              at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:137)
                                                                              at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:692)
                                                                              at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:315)
                                                                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                              at java.lang.Thread.run(Thread.java:761)```

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:30 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
devnullpointercommented, Nov 17, 2017

@AquilesCanta Yes I am.

    private static final CookieManager DEFAULT_COOKIE_MANAGER;
    static
    {
        DEFAULT_COOKIE_MANAGER = new CookieManager();
        DEFAULT_COOKIE_MANAGER.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
    }
...

    if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER)
    {
        CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER);
    }
0reactions
devnullpointercommented, Nov 20, 2017

Seems like it was the cookie handler/manager after all. I made sure I was using the same CookieHandler in both my okhttp service class and the exo player activity and its working perfectly now.

Thanks for the time and help. Greatly appreciated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting a 403 response code error from ExoPlayer
Based from this thread, there might be an issue with the cookie handler/manager. Make sure that you are using the same CookieHandler in...
Read more >
ExoPlayer Error 403 | B4X Programming Forum
403 means forbidden. same error using a standard browser. you may have to start over to track down the playlist. many possible explanations....
Read more >
1705472 - ExoPlayer should send cookies with HTTP requests
HttpDataSource$InvalidResponseCodeException: Response code: 403 E ExoPlayerImplInternal: at org.mozilla.thirdparty.com.google.android.exoplayer2.upstream.
Read more >
Troubleshooting - ExoPlayer
This error will occur if your app requests cleartext HTTP traffic (i.e., http:// rather than https:// ) when its Network Security Configuration does...
Read more >
Developers - Getting a 403 response code error from exoplayer -
When playing an http mp4 stream in my activity I get a 403 response code from exoplayer. When I plug the same url...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found