-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ExoPlayer ClearKey Issue #777
Comments
Please provide the code you're using to configure ExoPlayer for this clearkey playback. Note that you need to be careful to use URL safe base64 when encoding your keys (see also google/ExoPlayer#4075 (comment)). In particular your Key ID converts to the following non-URL-safe base64 (source) |
Thanks for the reply. This is my code. I tried the Key ID both ways. val drmCallback = LocalMediaDrmCallback("{\"keys\":[{\"kty\":\"oct\",\"k\":\"yu5FeREwJHhIfmaAvws9Gw\",\"kid\":\"oHxdSZ3OrQ-0Fv7VkTlnvg\"}],'type':\"temporary\"}".toByteArray())
val drmSessionManager = DefaultDrmSessionManager.Builder()
.setPlayClearSamplesWithoutKeys(true)
.setMultiSession(false)
.setKeyRequestParameters(HashMap())
.setUuidAndExoMediaDrmProvider(C.CLEARKEY_UUID, FrameworkMediaDrm.DEFAULT_PROVIDER)
.build(drmCallback)
DashMediaSource.Factory(DownloadUtil.getHttpDataSourceFactory(requireContext()))
.setDrmSessionManagerProvider { drmSessionManager }
.createMediaSource(dashMediaItem) The error I'm getting is this.
|
The provided code is incomplete - please also include the interactions with |
You may also want to take a look at this (untested) example: #780 (comment) |
This is the complete code. val dashMediaItem = MediaItem.Builder()
.setUri("https://cdnapisec.kaltura.com/p/2433871/sp/243387100/playManifest/protocol/https//entryId/1_pgssezc1/format/mpegdash/tags/mbr/f/a.mpd")
.setMimeType(MimeTypes.APPLICATION_MPD)
.setMediaMetadata(MediaMetadata.Builder().setTitle(defaultVideoTitle).build())
.setTag(MediaItemTag(-1, defaultVideoTitle))
.build()
val trackSelector = DefaultTrackSelector(requireContext())
val loadControl = DefaultLoadControl()
val drmCallback = LocalMediaDrmCallback("{\"keys\":[{\"kty\":\"oct\",\"k\":\"yu5FeREwJHhIfmaAvws9Gw\",\"kid\":\"oHxdSZ3OrQ-0Fv7VkTlnvg\"}],'type':\"temporary\"}".toByteArray())
val drmSessionManager = DefaultDrmSessionManager.Builder()
.setPlayClearSamplesWithoutKeys(true)
.setMultiSession(false)
.setKeyRequestParameters(HashMap())
.setUuidAndExoMediaDrmProvider(C.CLEARKEY_UUID, FrameworkMediaDrm.DEFAULT_PROVIDER)
.build(drmCallback)
val mediaSource = DashMediaSource.Factory(DownloadUtil.getHttpDataSourceFactory(requireContext()))
.setDrmSessionManagerProvider { drmSessionManager }
.createMediaSource(dashMediaItem)
val simpleExoPlayer = ExoPlayer.Builder(requireContext())
.setTrackSelector(trackSelector)
.setLoadControl(loadControl)
.setSeekForwardIncrementMs(10000L)
.setSeekBackIncrementMs(10000L)
.build()
val playerView = view.findViewById(R.id.player_view)
playerView.player = simpleExoPlayer
simpleExoPlayer.setMediaSource(mediaSource, true)
simpleExoPlayer.prepare()
simpleExoPlayer.play() |
Some observations: In the DASH manifest you've linked, the ClearKey In your JSON clearkey response you're using single quotes around
|
Unfortunately we can't fail any more obviously at this point, because manifests often contain config for multiple DRM schemes, and when parsing the manifest we don't know which scheme is going to be used for playback. It would be unreasonable to fail playback due to incomplete ClearKey config if playback was otherwise going to succeed using e.g. Widevine. * Issue: #777 * Issue: #563 * Issue: google/ExoPlayer#9169 #minor-release PiperOrigin-RevId: 578491484
Unfortunately we can't fail any more obviously at this point, because manifests often contain config for multiple DRM schemes, and when parsing the manifest we don't know which scheme is going to be used for playback. It would be unreasonable to fail playback due to incomplete ClearKey config if playback was otherwise going to succeed using e.g. Widevine. * Issue: androidx/media#777 * Issue: androidx/media#563 * Issue: #9169 #minor-release PiperOrigin-RevId: 578491484
For those who have issue playing dash media with clearkey cause by no supported DRM or no default_KID can try this out. Create CustomDashManifetParser class that extend to DashManifestParser. Then override parseContentProtection value. Add your code to feed default_KID if no default value found. Then on player activity create mediasource using DashMediaSource and setManifetParser with CustomDashManifestParser earlier. |
Thanks for the reply. I will try this Is there any example like this which I can refer? |
Just as the example given above, add something like this.
|
please check this:) |
I figured it out and it worked. Thanks for the help. Closing the issue. |
I have a sample dash video stream which does not work with the ExoPlayer with ClearKey. But it does work without an issue in the JW Stream Tester (Link) with ClearKey. I have mentioned below the stream link and the keys.
Stream Link: https://cdnapisec.kaltura.com/p/2433871/sp/243387100/playManifest/protocol/https//entryId/1_pgssezc1/format/mpegdash/tags/mbr/f/a.mpd
Key ID: a07c5d499dcead0fb416fed5913967be
Key: caee457911302478487e6680bf0b3d1b
Hoping for a solution.
Thank you
The text was updated successfully, but these errors were encountered: