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

ExoPlayer doesn't follow http->https / https->http redirects #423

Closed
Ood-Tsen opened this issue Apr 29, 2015 · 6 comments
Closed

ExoPlayer doesn't follow http->https / https->http redirects #423

Ood-Tsen opened this issue Apr 29, 2015 · 6 comments

Comments

@Ood-Tsen
Copy link
Contributor

In the latest dev branch, I cannot play some dash links.

It seems the Default Http DataSource does not handle http redirect (http status code 301).

The log is as follows:

E/EventLogger(20003): com.google.android.exoplayer.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 301
E/EventLogger(20003): at com.google.android.exoplayer.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:168)
E/EventLogger(20003): at com.google.android.exoplayer.upstream.DataSourceInputStream.checkOpened(DataSourceInputStream.java:94)
E/EventLogger(20003): at com.google.android.exoplayer.upstream.DataSourceInputStream.open(DataSourceInputStream.java:56)
E/EventLogger(20003): at com.google.android.exoplayer.upstream.UriLoadable.load(UriLoadable.java:92)
E/EventLogger(20003): at com.google.android.exoplayer.upstream.Loader$LoadTask.run(Loader.java:241)

@ojw28
Copy link
Contributor

ojw28 commented Apr 29, 2015

Hmm. Do they work on master? Are you sure that there isn't a redirect loop (which would cause this to occur after some limit on the number of redirects is reached)?

@Ood-Tsen
Copy link
Contributor Author

Only redirect once.
It redirects from http to https.
This is the test link:

http://www.test.com/D2-Service/D2-SB/D2-US/dash.mpd

@ojw28
Copy link
Contributor

ojw28 commented Apr 29, 2015

HttpURLConnection doesn't follow redirects that change the protocol. See here, in particular: "This implementation doesn't follow redirects from HTTPS to HTTP or vice versa."

Whether we should follow them ourselves is an open question. I suspect we probably should, but it needs more thought.

@ojw28 ojw28 changed the title Can not handle dash url redirect,(dev branch) ExoPlayer doesn't follow http->https redirects Apr 29, 2015
@ojw28 ojw28 changed the title ExoPlayer doesn't follow http->https redirects ExoPlayer doesn't follow http->https / https->http redirects May 1, 2015
@ojw28
Copy link
Contributor

ojw28 commented May 1, 2015

Note that this is currently breaking the "Dizzy (https->http redirect)" sample in the ExoPlayer demo app on the dev branch.

ojw28 added a commit that referenced this issue May 8, 2015
@ojw28
Copy link
Contributor

ojw28 commented May 8, 2015

This is now supported, but you have to turn it on explicitly when creating a HttpDataSource or UriDataSource (there are new constructors that have an allowCrossDomainRedirects argument).

@ojw28 ojw28 closed this as completed May 8, 2015
@TheCoinTosser
Copy link

I've created a StackOverflow post asking how exactly can I add that flag using an ExtractorMediaSource: http://stackoverflow.com/questions/41517440/exoplayer2-how-can-i-make-a-http-301-redirect-work

Could any of you please help me?

@google google locked and limited conversation to collaborators Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants