Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get a Widevine DEVICE UNIQUE ID by using MediaDrm API in Android (28+)
val WIDEVINE_UUID = UUID(-0x121074568629b532L, -0x5c37d8232ae2de13L)
val wvDrm = try {
MediaDrm(WIDEVINE_UUID)
} catch (e: UnsupportedSchemeException) {
//WIDEVINE is not available
null
}
wvDrm!!.apply {
val widevineId = wvDrm.getPropertyByteArray(MediaDrm.PROPERTY_DEVICE_UNIQUE_ID)
val encodedWidevineId = Base64.getEncoder().encodeToString(widevineId).trim()
Log.d("DRM", "Widevine ID:$encodedWidevineId")
wvDrm.close()
}
@huewu

This comment has been minimized.

Copy link
Owner Author

@huewu huewu commented Apr 18, 2019

Developers can check a Widevine DRM security level by getting the security property value (from ExoPlayer Test)

private static final String WIDEVINE_SECURITY_LEVEL_1 = "L1";
private static final String WIDEVINE_SECURITY_LEVEL_3 = "L3";
private static final String SECURITY_LEVEL_PROPERTY = "securityLevel";

String securityProperty = mediaDrm.getPropertyString(SECURITY_LEVEL_PROPERTY);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment