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

Redirections (302) doesn't work #1190

Closed
icastell opened this issue Jan 26, 2016 · 4 comments
Closed

Redirections (302) doesn't work #1190

icastell opened this issue Jan 26, 2016 · 4 comments
Labels

Comments

@icastell
Copy link

Hi,

I try to play the following mp3: http://www.ivoox.com/03-nuestros-horrores-favoritos-h-p-lovecraft-el-templo_mn_10103734_api_1.mp3 and the demo app don't play it. It seems that a Response code: 302 (redirection) doesn't like. Following I paste the logcat:

Internal track renderer error.
    com.google.android.exoplayer.ExoPlaybackException: com.google.android.exoplayer.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 302
    at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:154)
    at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:145)
    at com.google.android.exoplayer.ExoPlayerImplInternal.incrementalPrepareInternal(ExoPlayerImplInternal.java:283)
    at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:205)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.os.HandlerThread.run(HandlerThread.java:61)
    at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
Caused by: com.google.android.exoplayer.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 302
    at com.google.android.exoplayer.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:210)
    at com.google.android.exoplayer.upstream.DefaultUriDataSource.open(DefaultUriDataSource.java:135)
    at com.google.android.exoplayer.extractor.ExtractorSampleSource$ExtractingLoadable.load(ExtractorSampleSource.java:741)
    at com.google.android.exoplayer.upstream.Loader$LoadTask.run(Loader.java:209)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:841)

Thanks!

@ojw28
Copy link
Contributor

ojw28 commented Jan 26, 2016

It's working as intended that ExoPlayer doesn't follow cross-protocol redirects by default. In this case there are three redirects (not ideal to start with). The second one is a cross-protocol http->https redirect.

http://www.ivoox.com/03-nuestros-horrores-favoritos-h-p-lovecraft-el-templo_mn_10103734_api_1.mp3
-> http://files.ivoox.com/listen/10103734
-> https://archive.org/download/TyNM2015Otros/03NuestrosHorroresFavoritosH.p.lovecraft-ElTemplo.mp3
-> https://ia801505.us.archive.org/13/items/TyNM2015Otros/03NuestrosHorroresFavoritosH.p.lovecraft-ElTemplo.mp3

Ideally I think you should fix your serving infrastructure to not perform cross-protocol redirects. However if you can't do this, you can enable following of cross-protocol redirects in ExoPlayer by passing allowCrossProtocolRedirects=true to the DefaultUriDataSource constructor.

@ojw28 ojw28 added the question label Jan 26, 2016
@icastell
Copy link
Author

Yes, it works. I have to use the allowCrossProtocolRedirects param because the link is from a external server.

Thanks!

@winnerawan
Copy link

winnerawan commented Dec 17, 2016

@icastell how you use allowCrossProtocolRedirects param ? can i look to your code ?
i get HttpDataSource$InvalidResponseCodeException: Response code: 302 too, please

@DJphy
Copy link

DJphy commented May 9, 2017

I am using ExoPlayer1
@ojw28 I use a HLS Renderer and as suggested I have passed true in the constructor

new ManifestFetcher<>(url, new DefaultUriDataSource(context, null, userAgent, true),
                    parser);

I get this error:

Throwing OutOfMemoryError "Failed to allocate a 28 byte allocation with 6 free bytes and 6B until OOM" (recursive case)
 "JDWP" daemon prio=5 tid=4 Runnable
| group="system" sCount=0 dsCount=0 obj=0x22c18100 self=0x567ee008
| sysTid=16936 nice=0 cgrp=default sched=0/0 handle=0x56444008
| state=R schedstat=( 0 0 0 ) utm=337 stm=15 core=1 HZ=100
| stack=0x5593f000-0x55941000 stackSize=1012KB
| held mutexes= "mutator lock"(shared held)
at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95)
at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:146)
at java.lang.StringBuilder.append(StringBuilder.java:216)
at java.lang.Throwable.toString(Throwable.java:360)
at java.lang.Throwable.printStackTrace(Throwable.java:315)
at java.lang.Throwable.printStackTrace(Throwable.java:282)
at java.lang.Throwable.printStackTrace(Throwable.java:236)
JNI WARNING: java.lang.OutOfMemoryError thrown while calling printStackTrace
Clamp target GC heap from 99MB to 96MB

If i dont pass true, it gives me 301

@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
Projects
None yet
Development

No branches or pull requests

4 participants