use of com.google.android.exoplayer2.drm.ExoMediaDrm.KeyRequest in project ExoPlayer by google.
the class DefaultDrmSessionManager method postKeyRequest.
private void postKeyRequest(byte[] scope, int keyType) {
try {
KeyRequest keyRequest = mediaDrm.getKeyRequest(scope, schemeInitData, schemeMimeType, keyType, optionalKeyRequestParameters);
postRequestHandler.obtainMessage(MSG_KEYS, keyRequest).sendToTarget();
} catch (Exception e) {
onKeysError(e);
}
}
use of com.google.android.exoplayer2.drm.ExoMediaDrm.KeyRequest in project ExoPlayer by google.
the class OfflineLicenseHelperTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(mediaDrm.openSession()).thenReturn(new byte[] { 1, 2, 3 });
when(mediaDrm.getKeyRequest(any(), any(), anyInt(), any())).thenReturn(new KeyRequest(/* data= */
new byte[0], /* licenseServerUrl= */
"", KeyRequest.REQUEST_TYPE_INITIAL));
offlineLicenseHelper = new OfflineLicenseHelper(new DefaultDrmSessionManager.Builder().setUuidAndExoMediaDrmProvider(C.WIDEVINE_UUID, new ExoMediaDrm.AppManagedProvider(mediaDrm)).build(mediaDrmCallback), new DrmSessionEventListener.EventDispatcher());
}
use of com.google.android.exoplayer2.drm.ExoMediaDrm.KeyRequest in project ExoPlayer by google.
the class FrameworkMediaDrm method getKeyRequest.
// Return values of MediaDrm.KeyRequest.getRequestType are equal to KeyRequest.RequestType.
@SuppressLint("WrongConstant")
@Override
public KeyRequest getKeyRequest(byte[] scope, @Nullable List<DrmInitData.SchemeData> schemeDatas, int keyType, @Nullable HashMap<String, String> optionalParameters) throws NotProvisionedException {
SchemeData schemeData = null;
byte[] initData = null;
String mimeType = null;
if (schemeDatas != null) {
schemeData = getSchemeData(uuid, schemeDatas);
initData = adjustRequestInitData(uuid, Assertions.checkNotNull(schemeData.data));
mimeType = adjustRequestMimeType(uuid, schemeData.mimeType);
}
MediaDrm.KeyRequest request = mediaDrm.getKeyRequest(scope, initData, mimeType, keyType, optionalParameters);
byte[] requestData = adjustRequestData(uuid, request.getData());
String licenseServerUrl = request.getDefaultUrl();
if (MOCK_LA_URL_VALUE.equals(licenseServerUrl)) {
licenseServerUrl = "";
}
if (TextUtils.isEmpty(licenseServerUrl) && schemeData != null && !TextUtils.isEmpty(schemeData.licenseServerUrl)) {
licenseServerUrl = schemeData.licenseServerUrl;
}
@KeyRequest.RequestType int requestType = Util.SDK_INT >= 23 ? request.getRequestType() : KeyRequest.REQUEST_TYPE_UNKNOWN;
return new KeyRequest(requestData, licenseServerUrl, requestType);
}
Aggregations