Playback error on using ClearKey DRM Schema in Exoplayer 2 android
up vote
1
down vote
favorite
I am trying to play the .MPD file, which is using
DRMSchema : clearKey
For playing it i am creating a DefaultDrmSessionManager in the following way
String keyString = "{"keys":[{"kty":"oct","k":"y1QQhMmXMa70__dFAMEurQn" +
" ","kid":"bXbyXLF_Xha46u9rv1gtjgn" +
" "},{"kty":"oct","k":"pGMaFTpEPfnu0FkwQ9t1GQn" +
" ","kid":"88XgNh5mVLKPgEnHeLI5Rgn" +
" "}],'type':"temporary"}";
LogMgr.i("DRMCallback JSON : " + keyString);
drmCallback = new LocalMediaDrmCallback(keyString.getBytes());
mediaDrm = FrameworkMediaDrm.newInstance(uuid);
DefaultDrmSessionManager<FrameworkMediaCrypto> drmSessionManager = new DefaultDrmSessionManager<>(uuid, mediaDrm, drmCallback, null, multiSession);
After that, when i am trying to use this DefaultDrmSessionManager for playing the video, i am getting ExoPlayerImplInternal: Playback error, i am attaching the Log for reference.
E/ExoPlayerImplInternal: **Playback error**.
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:780)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:583)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:518)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:301)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: android.media.MediaCodec$CryptoException: **Crypto key not available**
at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2547)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:771)
Please guide me, what i am doing wrong
add a comment |
up vote
1
down vote
favorite
I am trying to play the .MPD file, which is using
DRMSchema : clearKey
For playing it i am creating a DefaultDrmSessionManager in the following way
String keyString = "{"keys":[{"kty":"oct","k":"y1QQhMmXMa70__dFAMEurQn" +
" ","kid":"bXbyXLF_Xha46u9rv1gtjgn" +
" "},{"kty":"oct","k":"pGMaFTpEPfnu0FkwQ9t1GQn" +
" ","kid":"88XgNh5mVLKPgEnHeLI5Rgn" +
" "}],'type':"temporary"}";
LogMgr.i("DRMCallback JSON : " + keyString);
drmCallback = new LocalMediaDrmCallback(keyString.getBytes());
mediaDrm = FrameworkMediaDrm.newInstance(uuid);
DefaultDrmSessionManager<FrameworkMediaCrypto> drmSessionManager = new DefaultDrmSessionManager<>(uuid, mediaDrm, drmCallback, null, multiSession);
After that, when i am trying to use this DefaultDrmSessionManager for playing the video, i am getting ExoPlayerImplInternal: Playback error, i am attaching the Log for reference.
E/ExoPlayerImplInternal: **Playback error**.
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:780)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:583)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:518)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:301)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: android.media.MediaCodec$CryptoException: **Crypto key not available**
at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2547)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:771)
Please guide me, what i am doing wrong
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am trying to play the .MPD file, which is using
DRMSchema : clearKey
For playing it i am creating a DefaultDrmSessionManager in the following way
String keyString = "{"keys":[{"kty":"oct","k":"y1QQhMmXMa70__dFAMEurQn" +
" ","kid":"bXbyXLF_Xha46u9rv1gtjgn" +
" "},{"kty":"oct","k":"pGMaFTpEPfnu0FkwQ9t1GQn" +
" ","kid":"88XgNh5mVLKPgEnHeLI5Rgn" +
" "}],'type':"temporary"}";
LogMgr.i("DRMCallback JSON : " + keyString);
drmCallback = new LocalMediaDrmCallback(keyString.getBytes());
mediaDrm = FrameworkMediaDrm.newInstance(uuid);
DefaultDrmSessionManager<FrameworkMediaCrypto> drmSessionManager = new DefaultDrmSessionManager<>(uuid, mediaDrm, drmCallback, null, multiSession);
After that, when i am trying to use this DefaultDrmSessionManager for playing the video, i am getting ExoPlayerImplInternal: Playback error, i am attaching the Log for reference.
E/ExoPlayerImplInternal: **Playback error**.
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:780)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:583)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:518)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:301)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: android.media.MediaCodec$CryptoException: **Crypto key not available**
at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2547)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:771)
Please guide me, what i am doing wrong
I am trying to play the .MPD file, which is using
DRMSchema : clearKey
For playing it i am creating a DefaultDrmSessionManager in the following way
String keyString = "{"keys":[{"kty":"oct","k":"y1QQhMmXMa70__dFAMEurQn" +
" ","kid":"bXbyXLF_Xha46u9rv1gtjgn" +
" "},{"kty":"oct","k":"pGMaFTpEPfnu0FkwQ9t1GQn" +
" ","kid":"88XgNh5mVLKPgEnHeLI5Rgn" +
" "}],'type':"temporary"}";
LogMgr.i("DRMCallback JSON : " + keyString);
drmCallback = new LocalMediaDrmCallback(keyString.getBytes());
mediaDrm = FrameworkMediaDrm.newInstance(uuid);
DefaultDrmSessionManager<FrameworkMediaCrypto> drmSessionManager = new DefaultDrmSessionManager<>(uuid, mediaDrm, drmCallback, null, multiSession);
After that, when i am trying to use this DefaultDrmSessionManager for playing the video, i am getting ExoPlayerImplInternal: Playback error, i am attaching the Log for reference.
E/ExoPlayerImplInternal: **Playback error**.
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:780)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:583)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:518)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:301)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: android.media.MediaCodec$CryptoException: **Crypto key not available**
at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2547)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:771)
Please guide me, what i am doing wrong
edited Nov 26 at 5:39
asked Nov 22 at 7:48
Kushal
634518
634518
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Looking at the length of the key string, the most likely problem is that the key has not been base64URL encoded in the call to LocalMediaDrmCallback.
An AES 128-bit key will be:
- 32 characters as a hex key
- 24 characters when base64 encoded
Assuming that a4631a153a443df9eed0593043db7519 is the key in hex format then you need to convert it (and the keyID also) to base64 and then pass them this way to LocalMediaDrmCallback.
Using one of the common online convertors you can see this would give:
- hex key: a4631a153a443df9eed0593043db7519
- base64 encoded pGMaFTpEPfnu0FkwQ9t1GQ==
You can see an example of doing this programmatically also in this GitHub issue answer: https://github.com/google/ExoPlayer/issues/3856#issuecomment-366197586
Thanks @Mick, your answer really helps me to work on right Base64Url key implementation. But, after implementing it also i am getting the same error. In my logcat i am getting Crypto key not available, can you please help me with this.
– Kushal
Nov 26 at 5:43
add a comment |
up vote
0
down vote
It is working fine after removing n from the keyString.. :)
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Looking at the length of the key string, the most likely problem is that the key has not been base64URL encoded in the call to LocalMediaDrmCallback.
An AES 128-bit key will be:
- 32 characters as a hex key
- 24 characters when base64 encoded
Assuming that a4631a153a443df9eed0593043db7519 is the key in hex format then you need to convert it (and the keyID also) to base64 and then pass them this way to LocalMediaDrmCallback.
Using one of the common online convertors you can see this would give:
- hex key: a4631a153a443df9eed0593043db7519
- base64 encoded pGMaFTpEPfnu0FkwQ9t1GQ==
You can see an example of doing this programmatically also in this GitHub issue answer: https://github.com/google/ExoPlayer/issues/3856#issuecomment-366197586
Thanks @Mick, your answer really helps me to work on right Base64Url key implementation. But, after implementing it also i am getting the same error. In my logcat i am getting Crypto key not available, can you please help me with this.
– Kushal
Nov 26 at 5:43
add a comment |
up vote
1
down vote
accepted
Looking at the length of the key string, the most likely problem is that the key has not been base64URL encoded in the call to LocalMediaDrmCallback.
An AES 128-bit key will be:
- 32 characters as a hex key
- 24 characters when base64 encoded
Assuming that a4631a153a443df9eed0593043db7519 is the key in hex format then you need to convert it (and the keyID also) to base64 and then pass them this way to LocalMediaDrmCallback.
Using one of the common online convertors you can see this would give:
- hex key: a4631a153a443df9eed0593043db7519
- base64 encoded pGMaFTpEPfnu0FkwQ9t1GQ==
You can see an example of doing this programmatically also in this GitHub issue answer: https://github.com/google/ExoPlayer/issues/3856#issuecomment-366197586
Thanks @Mick, your answer really helps me to work on right Base64Url key implementation. But, after implementing it also i am getting the same error. In my logcat i am getting Crypto key not available, can you please help me with this.
– Kushal
Nov 26 at 5:43
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Looking at the length of the key string, the most likely problem is that the key has not been base64URL encoded in the call to LocalMediaDrmCallback.
An AES 128-bit key will be:
- 32 characters as a hex key
- 24 characters when base64 encoded
Assuming that a4631a153a443df9eed0593043db7519 is the key in hex format then you need to convert it (and the keyID also) to base64 and then pass them this way to LocalMediaDrmCallback.
Using one of the common online convertors you can see this would give:
- hex key: a4631a153a443df9eed0593043db7519
- base64 encoded pGMaFTpEPfnu0FkwQ9t1GQ==
You can see an example of doing this programmatically also in this GitHub issue answer: https://github.com/google/ExoPlayer/issues/3856#issuecomment-366197586
Looking at the length of the key string, the most likely problem is that the key has not been base64URL encoded in the call to LocalMediaDrmCallback.
An AES 128-bit key will be:
- 32 characters as a hex key
- 24 characters when base64 encoded
Assuming that a4631a153a443df9eed0593043db7519 is the key in hex format then you need to convert it (and the keyID also) to base64 and then pass them this way to LocalMediaDrmCallback.
Using one of the common online convertors you can see this would give:
- hex key: a4631a153a443df9eed0593043db7519
- base64 encoded pGMaFTpEPfnu0FkwQ9t1GQ==
You can see an example of doing this programmatically also in this GitHub issue answer: https://github.com/google/ExoPlayer/issues/3856#issuecomment-366197586
answered Nov 23 at 12:24
Mick
11.8k12458
11.8k12458
Thanks @Mick, your answer really helps me to work on right Base64Url key implementation. But, after implementing it also i am getting the same error. In my logcat i am getting Crypto key not available, can you please help me with this.
– Kushal
Nov 26 at 5:43
add a comment |
Thanks @Mick, your answer really helps me to work on right Base64Url key implementation. But, after implementing it also i am getting the same error. In my logcat i am getting Crypto key not available, can you please help me with this.
– Kushal
Nov 26 at 5:43
Thanks @Mick, your answer really helps me to work on right Base64Url key implementation. But, after implementing it also i am getting the same error. In my logcat i am getting Crypto key not available, can you please help me with this.
– Kushal
Nov 26 at 5:43
Thanks @Mick, your answer really helps me to work on right Base64Url key implementation. But, after implementing it also i am getting the same error. In my logcat i am getting Crypto key not available, can you please help me with this.
– Kushal
Nov 26 at 5:43
add a comment |
up vote
0
down vote
It is working fine after removing n from the keyString.. :)
add a comment |
up vote
0
down vote
It is working fine after removing n from the keyString.. :)
add a comment |
up vote
0
down vote
up vote
0
down vote
It is working fine after removing n from the keyString.. :)
It is working fine after removing n from the keyString.. :)
answered Nov 26 at 13:04
Kushal
634518
634518
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426119%2fplayback-error-on-using-clearkey-drm-schema-in-exoplayer-2-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown