mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Remove unnecessary API level check in PlayerActivity of the demo app
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=164271226
This commit is contained in:
parent
c449bae51a
commit
f502171e5f
@ -264,13 +264,19 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi
|
|||||||
if (drmSchemeUuid != null) {
|
if (drmSchemeUuid != null) {
|
||||||
String drmLicenseUrl = intent.getStringExtra(DRM_LICENSE_URL);
|
String drmLicenseUrl = intent.getStringExtra(DRM_LICENSE_URL);
|
||||||
String[] keyRequestPropertiesArray = intent.getStringArrayExtra(DRM_KEY_REQUEST_PROPERTIES);
|
String[] keyRequestPropertiesArray = intent.getStringArrayExtra(DRM_KEY_REQUEST_PROPERTIES);
|
||||||
try {
|
int errorStringId = R.string.error_drm_unknown;
|
||||||
drmSessionManager = buildDrmSessionManager(drmSchemeUuid, drmLicenseUrl,
|
if (Util.SDK_INT < 18) {
|
||||||
keyRequestPropertiesArray);
|
errorStringId = R.string.error_drm_not_supported;
|
||||||
} catch (UnsupportedDrmException e) {
|
} else {
|
||||||
int errorStringId = Util.SDK_INT < 18 ? R.string.error_drm_not_supported
|
try {
|
||||||
: (e.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
|
drmSessionManager = buildDrmSessionManagerV18(drmSchemeUuid, drmLicenseUrl,
|
||||||
? R.string.error_drm_unsupported_scheme : R.string.error_drm_unknown);
|
keyRequestPropertiesArray);
|
||||||
|
} catch (UnsupportedDrmException e) {
|
||||||
|
errorStringId = e.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
|
||||||
|
? R.string.error_drm_unsupported_scheme : R.string.error_drm_unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (drmSessionManager == null) {
|
||||||
showToast(errorStringId);
|
showToast(errorStringId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -372,11 +378,8 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(UUID uuid,
|
private DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManagerV18(UUID uuid,
|
||||||
String licenseUrl, String[] keyRequestPropertiesArray) throws UnsupportedDrmException {
|
String licenseUrl, String[] keyRequestPropertiesArray) throws UnsupportedDrmException {
|
||||||
if (Util.SDK_INT < 18) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
HttpMediaDrmCallback drmCallback = new HttpMediaDrmCallback(licenseUrl,
|
HttpMediaDrmCallback drmCallback = new HttpMediaDrmCallback(licenseUrl,
|
||||||
buildHttpDataSourceFactory(false));
|
buildHttpDataSourceFactory(false));
|
||||||
if (keyRequestPropertiesArray != null) {
|
if (keyRequestPropertiesArray != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user