Android : Clearkey in Media3 / Exoplayer not working for base64

475 views Asked by At

Working for one Android application to play clearkey content with Media3 and exoplayer. Build.gradle given below. Problem described below. let me know if more detail is required.

I have two links for Clear key DRM, and both are working fine in https://developer-tools.jwplayer.com/stream-tester

Link 1 is Working in application

Link 1 --> https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p_ClearKey.mpd

CleaeKey FmY0xnWCPCNaSpRG-tUuTQ

ClearKid nrQFDeRLSAKTLifXUIPiZg

Above link is working in Android Exoplayer/Media3.

Link 2 is not the working case, but does work in jwplayer link given above

Link 2 --> https://cdnapisec.kaltura.com/p/2433871/sp/243387100/playManifest/protocol/https//entryId/1_pgssezc1/format/mpegdash/tags/mbr/f/a.mpd

ClearKey caee457911302478487e6680bf0b3d1b

ClearKid a07c5d499dcead0fb416fed5913967be

Encoded Keys: Tried both with and without encoding for base64url.but no help.

ClearKey yu5FeREwJHhIfmaAvws9Gw

Clearkid oHxdSZ3OrQ-0Fv7VkTlnvg

Below is code snippet :

String keyString = "{\"keys\":[{\"kty\":\"oct\",\"k\":\"" + Clearkey + "\",\"kid\":\"" + Clearkid+ "\"}],'type':\"temporary\"}";

LocalMediaDrmCallback drmCallback = new LocalMediaDrmCallback(keyString.getBytes());

DrmSessionManager manager_local = new DefaultDrmSessionManager.Builder()
                    .setUuidAndExoMediaDrmProvider(C.CLEARKEY_UUID,    FrameworkMediaDrm.DEFAULT_PROVIDER)

DashMediaSource.Factory(dataSourceFactory)
                    .setDrmSessionManagerProvider(  mediaItem ->  manager_local)

And with above detail mediaSource is created with DashMediaSource,passed to player.

build.gradle for this:


implementation 'androidx.media3:media3-exoplayer:1.1.0'
implementation 'androidx.media3:media3-exoplayer-dash:1.1.0'
implementation 'androidx.media3:media3-ui:1.1.0'
implementation 'androidx.media3:media3-exoplayer-hls:1.1.0'

Please help with this. Let me know what is missing.

Thanks n Regards, Dev

1

There are 1 answers

0
RealTV Support On

Its fixed, Silly though. there was \n character in final key string..