mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Set correct Content-Type for ClearKey requests
Issue: #3138 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=164434858
This commit is contained in:
parent
1f66f30ccd
commit
df05195f5f
@ -38,14 +38,6 @@ import java.util.UUID;
|
|||||||
@TargetApi(18)
|
@TargetApi(18)
|
||||||
public final class HttpMediaDrmCallback implements MediaDrmCallback {
|
public final class HttpMediaDrmCallback implements MediaDrmCallback {
|
||||||
|
|
||||||
private static final Map<String, String> PLAYREADY_KEY_REQUEST_PROPERTIES;
|
|
||||||
static {
|
|
||||||
PLAYREADY_KEY_REQUEST_PROPERTIES = new HashMap<>();
|
|
||||||
PLAYREADY_KEY_REQUEST_PROPERTIES.put("Content-Type", "text/xml");
|
|
||||||
PLAYREADY_KEY_REQUEST_PROPERTIES.put("SOAPAction",
|
|
||||||
"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense");
|
|
||||||
}
|
|
||||||
|
|
||||||
private final HttpDataSource.Factory dataSourceFactory;
|
private final HttpDataSource.Factory dataSourceFactory;
|
||||||
private final String defaultUrl;
|
private final String defaultUrl;
|
||||||
private final Map<String, String> keyRequestProperties;
|
private final Map<String, String> keyRequestProperties;
|
||||||
@ -124,10 +116,15 @@ public final class HttpMediaDrmCallback implements MediaDrmCallback {
|
|||||||
url = defaultUrl;
|
url = defaultUrl;
|
||||||
}
|
}
|
||||||
Map<String, String> requestProperties = new HashMap<>();
|
Map<String, String> requestProperties = new HashMap<>();
|
||||||
requestProperties.put("Content-Type", "application/octet-stream");
|
// Add standard request properties for supported schemes.
|
||||||
|
String contentType = C.PLAYREADY_UUID.equals(uuid) ? "text/xml"
|
||||||
|
: (C.CLEARKEY_UUID.equals(uuid) ? "application/json" : "application/octet-stream");
|
||||||
|
requestProperties.put("Content-Type", contentType);
|
||||||
if (C.PLAYREADY_UUID.equals(uuid)) {
|
if (C.PLAYREADY_UUID.equals(uuid)) {
|
||||||
requestProperties.putAll(PLAYREADY_KEY_REQUEST_PROPERTIES);
|
requestProperties.put("SOAPAction",
|
||||||
|
"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense");
|
||||||
}
|
}
|
||||||
|
// Add additional request properties.
|
||||||
synchronized (keyRequestProperties) {
|
synchronized (keyRequestProperties) {
|
||||||
requestProperties.putAll(keyRequestProperties);
|
requestProperties.putAll(keyRequestProperties);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user