Commit b0da1f98 by aquilescanta Committed by Oliver Woodman

Remove unnecessary API level check in PlayerActivity of the demo app

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164271226
parent b407b192
...@@ -264,13 +264,19 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi ...@@ -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);
int errorStringId = R.string.error_drm_unknown;
if (Util.SDK_INT < 18) {
errorStringId = R.string.error_drm_not_supported;
} else {
try { try {
drmSessionManager = buildDrmSessionManager(drmSchemeUuid, drmLicenseUrl, drmSessionManager = buildDrmSessionManagerV18(drmSchemeUuid, drmLicenseUrl,
keyRequestPropertiesArray); keyRequestPropertiesArray);
} catch (UnsupportedDrmException e) { } catch (UnsupportedDrmException e) {
int errorStringId = Util.SDK_INT < 18 ? R.string.error_drm_not_supported errorStringId = e.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
: (e.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME ? R.string.error_drm_unsupported_scheme : R.string.error_drm_unknown;
? 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 ...@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment