DRM Dash Support
@marcbaechinger is already working on this.
Since Apr 27, 2023.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
Im adding Media 3 to a tester app since we have an app that is on a very old version of Exoplayer.
Since we need to update soon im testing DRM with our widevine streams
i imported from our older app and getting issues with
DefaultHttpDataSourceFactory() Not found what replaced it?
and in old code we hade
..........
return new DashMediaSource.Factory(BuildHttpDataSourceFactoryWithToken(context))
.setDrmSessionManager(drmSessionManager)
.createMediaSource(MediaItem.fromUri(mediaSourceUri));
private static DefaultHttpDataSourceFactory BuildHttpDataSourceFactoryWithToken(Context context) {
DefaultBandwidthMeter BANDWIDTH_METER = new DefaultBandwidthMeter(); //deprecated
String userAgent = Util.getUserAgent(context, "App Name");
DefaultHttpDataSourceFactory httpDataSourceFactory = new DefaultHttpDataSourceFactory(userAgent,
BANDWIDTH_METER); //deprecated
String token = AuthenticationHelper.getToken(context);
httpDataSourceFactory.getDefaultRequestProperties().set("Authorization", "token);
return httpDataSourceFactory;
}
What do i use to replace this?
.........
other issue:
return headers(context!!)?.let {
DashMediaSource.Factory(it)
.setDrmSessionManager(drmSessionManager). ///Not found?
.createMediaSource(MediaItem.fromUri(mediaSourceUri))
}
//This is to get the Media Source
// then we
mPlayer.setMediaSource(mediaSource);....
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
fun getDashMediaSource(mediaSourceUri: Uri, context: Context?): MediaSource? {
var drmSchemeUuid: UUID? = null
val drmSessionManager: DrmSessionManager
try {
drmSchemeUuid = DemoUtil.getDrmUuid(DRM_SCHEME)
} catch (e: UnsupportedDrmException) {
e.printStackTrace()
}
val licenseDataSourceFactory: HttpDataSource.Factory = DefaultHttpDataSourceFactory()
val drmCallback = HttpMediaDrmCallback(DRM_LICENSE_URL, licenseDataSourceFactory)
drmSessionManager = DefaultDrmSessionManager.Builder()
.setUuidAndExoMediaDrmProvider(drmSchemeUuid!!, FrameworkMediaDrm.DEFAULT_PROVIDER)
.setMultiSession(true)
.build(drmCallback)
return headers(context!!)?.let {
DashMediaSource.Factory(it)
.setDrmSessionManager(drmSessionManager)
.createMediaSource(MediaItem.fromUri(mediaSourceUri))
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.