Android - How to get CLEARKEY_UUID from MediaDrm

1.3k Views Asked by At

Is there any way to extract CLEARKEY_UUID (unique id) from MediaDrm, like we are doing it for WIDEVINE_UUID. I can share the sample code in which we are getting WIDEVINE_UUID, so someone may get idea that what I am asking for.

UUID wideVineUuid = new UUID(-0x121074568629b532L, -0x5c37d8232ae2de13L);
MediaDrm mediaDrm = new MediaDrm(wideVineUuid);` 
byte[] wideVineId = new byte[0];
wideVineId = mediaDrm.getPropertyByteArray(MediaDrm.PROPERTY_DEVICE_UNIQUE_ID);
android.util.Base64.encodeToString(wideVineId, Base64.NO_WRAP);
1

There are 1 best solutions below

5
Anonymous Coward On

As described at https://dashif.org/identifiers/content_protection/, the Clearkey UUID is e2719d58-a985-b3c9-781a-b030af78d30e, so you would need to use UUID(-0x1d8e62a7567a4c37L, 0x781AB030AF78D30EL) when you create the MediaDrm in order to to access the MediaDrm.PROPERTY_DEVICE_UNIQUE_ID property.

Note there is also the W3C Common PSSH UUID which was used back in the day, which is 1077efec-c0b2-4d02-ace3-3c1e52e2fb4b (UUID(0x1077EFECC0B24D02L, 0xACE33C1E52E2FB4BL)), but you almost certainly want the first one.