ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Injecting DrmSessionManager via DownloadHelper.createMediaSource()

Open gvidda opened this issue 6 years ago • 4 comments

With the 2.11.0 change of injecting the DrmSessionManager into the MediaSource (with the .setDrmSessionManager() ) there doesn't seem to be a way to set this when creating the mediasource for offline playback with DownloadHelper.

I have until now created a CacheDataSourceFactory and injected that and the DownloadRequest. Like this:

mediaSource = DownloadHelper.createMediaSource(download.request, cacheDataSourceFactory)

But I can't see a way to set the DrmSessionManager here. The demo app doesn't help either.

What am I missing?

gvidda avatar Dec 19 '19 13:12 gvidda

Is this what you want (in the dev-v2 branch): https://github.com/google/ExoPlayer/commit/61c43c30ac1ec26bdfd25757a0ac6ccee7c25fc2#diff-59e559b77cbc205ad4f12135c122ffb5

ojw28 avatar Dec 19 '19 14:12 ojw28

Looks like exactly what I needed. Sorry, didn't look at the dev branch, just tested the release.

gvidda avatar Dec 19 '19 14:12 gvidda

Note that in the meantime, you can just put an equivalent method in your own code (it's just a small helper method; as far as I can see. I don't think it does anything particularly smart).

ojw28 avatar Dec 19 '19 15:12 ojw28

Yeah I fixed it, thanks.

gvidda avatar Dec 20 '19 09:12 gvidda