How to check widevine DRM present on the Android Device

7.8k Views Asked by At

I am making an app in which I have to check whether Google Widevine DRM present in the Android device or not. How to check that programatically?

Thanks in Advance

3

There are 3 best solutions below

0
On

The Android DRM framework provides a method to check which DRM systems are available -

String[] engines = mDrmManager.getAvailableDrmEngines()

The names returned can be a bit confusing but if you play around with it you should see what you are looking for.

Its worth being aware that there are different levels of Widevine depending on how the DRM keys are protected and whether the playback is all secure within hardware.

There are also two general types of Widevine - Widevine classic on older devices and Widevine Modular on newer devices.

You can see some detail on how to determine the level for Widevine Classic here:

1
On

I found the solution the by exploring the ExoPlayer library

private boolean isWideVineDRMAvailable()
{
    return  MediaDrm.isCryptoSchemeSupported(C.WIDEVINE_UUID);
}

C is the constant class available in ExoPlayer library.

0
On

We can use this method for getting the particular widevine security level for any android device https://developer.android.com/reference/android/media/MediaDrm#getPropertyString(java.lang.String)

shortcode snippet to illustrate the documentation.

val widevineKeyDrm = MediaDrm(C.WIDEVINE_UUID)
val securityLevel = widevineKeyDrm.getPropertyString()

PS. the constant C.WIDEVINE_UUID is picked up from here https://github.com/donparapidos/ExoPlayer/blob/master/library/src/main/java/com/google/android/exoplayer2/C.java