Playback error on using ClearKey DRM Schema in Exoplayer 2 android
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
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
android exoplayer drm mpeg-dash exoplayer2.x
add a comment |
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
android exoplayer drm mpeg-dash exoplayer2.x
add a comment |
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
android exoplayer drm mpeg-dash exoplayer2.x
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
android exoplayer drm mpeg-dash exoplayer2.x
android exoplayer drm mpeg-dash exoplayer2.x
edited Nov 26 '18 at 5:39
Kushal
asked Nov 22 '18 at 7:48
KushalKushal
642518
642518
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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 '18 at 5:43
add a comment |
It is working fine after removing n from the keyString.. :)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 '18 at 5:43
add a comment |
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 '18 at 5:43
add a comment |
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 '18 at 12:24
MickMick
12.6k12463
12.6k12463
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 '18 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 '18 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 '18 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 '18 at 5:43
add a comment |
It is working fine after removing n from the keyString.. :)
add a comment |
It is working fine after removing n from the keyString.. :)
add a comment |
It is working fine after removing n from the keyString.. :)
It is working fine after removing n from the keyString.. :)
answered Nov 26 '18 at 13:04
KushalKushal
642518
642518
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.
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