mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Work around a bug in the Android 13 ClearKey implementation
The ClearKey CDM will attach an 'invalid' URL in `KeyRequest` objects, when the documentation states this should be an empty string if a default URL is not known. #minor-release PiperOrigin-RevId: 476113513
This commit is contained in:
parent
cfc0eef24e
commit
331d4d626f
1 changed files with 12 additions and 5 deletions
|
|
@ -218,11 +218,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||||
mediaDrm.getKeyRequest(scope, initData, mimeType, keyType, optionalParameters);
|
mediaDrm.getKeyRequest(scope, initData, mimeType, keyType, optionalParameters);
|
||||||
|
|
||||||
byte[] requestData = adjustRequestData(uuid, request.getData());
|
byte[] requestData = adjustRequestData(uuid, request.getData());
|
||||||
|
String licenseServerUrl = adjustLicenseServerUrl(request.getDefaultUrl());
|
||||||
String licenseServerUrl = request.getDefaultUrl();
|
|
||||||
if (MOCK_LA_URL_VALUE.equals(licenseServerUrl)) {
|
|
||||||
licenseServerUrl = "";
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(licenseServerUrl)
|
if (TextUtils.isEmpty(licenseServerUrl)
|
||||||
&& schemeData != null
|
&& schemeData != null
|
||||||
&& !TextUtils.isEmpty(schemeData.licenseServerUrl)) {
|
&& !TextUtils.isEmpty(schemeData.licenseServerUrl)) {
|
||||||
|
|
@ -236,6 +232,17 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||||
return new KeyRequest(requestData, licenseServerUrl, requestType);
|
return new KeyRequest(requestData, licenseServerUrl, requestType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String adjustLicenseServerUrl(String licenseServerUrl) {
|
||||||
|
if (MOCK_LA_URL.equals(licenseServerUrl)) {
|
||||||
|
return "";
|
||||||
|
} else if (Util.SDK_INT == 33 && "https://default.url".equals(licenseServerUrl)) {
|
||||||
|
// Work around b/247808112
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return licenseServerUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public byte[] provideKeyResponse(byte[] scope, byte[] response)
|
public byte[] provideKeyResponse(byte[] scope, byte[] response)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue