-
Notifications
You must be signed in to change notification settings - Fork 6k
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
DASH: Keep using redirected URL after 3xx response code #6907
Comments
Thanks for the report, I'll let Olly take a look as he knows the most about DASH. |
We already have a pending internal feature request for this but didn't consider it as high-priority so far because repeated redirects still work. I'll mark this as an enhancement as well to track it publicly. |
Hi @tonihei , |
I think we should fix this for DASH given the explicit recommendation to replace the URL in the DASH-IF guidelines. We do already support |
Thanks @ojw28 . The fix is quite straight forward for this case. |
As a workaround until this is implemented (adding class RedirectCacheInterceptor : Interceptor {
private val redirects = ConcurrentHashMap<String, String>(3)
override fun intercept(chain: Interceptor.Chain): Response {
val originalRequest = chain.request()
val originalUrl = originalRequest.url
val originalUrlHost = originalUrl.host
val redirectedHost = redirects[originalUrlHost]
if (redirectedHost != null) {
Timber.d("Found cached redirect host for $originalUrlHost: $redirectedHost")
return chain.proceed(getNewRequest(originalRequest, redirectedHost))
}
val response = chain.proceed(originalRequest)
val newUrl = response.request.url
val newUrlHost = newUrl.host
val isRedirect = isRedirect(originalUrl, newUrl)
if (isRedirect) {
Timber.d("Redirect detected. Original host: $originalUrlHost New host: $newUrlHost")
redirects[originalUrlHost] = newUrlHost
}
return response
}
fun clearCache() {
redirects.clear()
Timber.d("Redirect cache cleared")
}
private fun isRedirect(originalUrl: HttpUrl, newUrl: HttpUrl): Boolean {
return originalUrl.host != newUrl.host
&& originalUrl.encodedPath == newUrl.encodedPath
&& originalUrl.query == newUrl.query
}
private fun getNewRequest(request: Request, newHost: String): Request {
val newUrl = request.url.newBuilder()
.host(newHost)
.build()
val newRequestBuilder = request.newBuilder().url(newUrl)
return newRequestBuilder.build()
}
} |
If there is a 302, and "redirect stickiness" is enabled/expected but the manifest also has its own I assumed the http redirection takes precedence because the goal is for the CDN to avoid manifest rewrites. I believe #1536 was the same "issue" |
A server cannot respond with both a 302 and an MPD containing a Location element. It must do one or the other. If the MPD returned by the final server (after 3xx redirection) contains a |
@davibe - We made some changes when we merged this. Please check the latest |
I have seen it, thank you |
[REQUIRED] Issue description
When play a DASH Live stream with the MPD file configured as permanently re-direct(http status code 301/308) ExoPlayer still use the original MPD URI to re-fresh, which doesn't follow DASH IF IOP recommendation.
[REQUIRED] Reproduction steps
Use the standard Exo Demo App play a DASH LIVE stream with the MPD file configured as permanently redirect to another URI. The actual ExoPlayer behaves in following sequence:
... after a few seconds to re-fresh the manifest file
...
The step 4 i'm afraid not following the HTTP re-direct and not follow the DASH IF IOP 4.3 chapter 3.2.15.3. Client Requirements and Recommendations:
The source code in DashMediaSource::onManifestLoadCompleted is the place to handle this logic.
BTW, testing with DASH.js and Shaka-Player the re-direct handling is more aligned with DASH IOP.
I'm not quite sure if this is a BUG from your point of view. I open this as a bug mainly referring to DASH IOP spec.
[REQUIRED] Link to test content
The issue is found in production with commercial CDN and dynamic session management. Some CDN open a new session when client first requests MPD file and send back http re-direct to a new URI with sessionID there. When client doesn't follow the re-direct spec it causes CDN opening too many session and failed to server segment request.
[REQUIRED] A full bug report captured from the device
The issue is very clear and i belie you all understand the scenario.
[REQUIRED] Version of ExoPlayer being used
Test with 2.9.3 and 2.11.1 get the same behavior.
[REQUIRED] Device(s) and version(s) of Android being used
Issue can be observed from any devices.
The text was updated successfully, but these errors were encountered: