I want to make work my DASH stream with preroll and DAI. For now, I was able to make: DASH + preroll working and DASH + dai. But all three not
dash + dai :
val dashMediaSource = DashMediaSource.Factory(dashChunkSourceFactory, manifestDataSourceFactory)
.createMediaSource(
MediaItem.Builder()
.setUri(Uri.parse(URLDAI)) //diff
.setDrmConfiguration(
MediaItem.DrmConfiguration.Builder(drmSchemeUuid)
.setLicenseUri(DRM_LICENSE_URL).build()
)
.setMimeType(MimeTypes.APPLICATION_MPD)
.setTag(null)
.build()
)
playerView.setMediaSource(adsMediaSource)
playerView.prepare()
dash + preroll
val dashMediaSource = DashMediaSource.Factory(dashChunkSourceFactory, manifestDataSourceFactory)
.createMediaSource(
MediaItem.Builder()
.setUri(Uri.parse(URL)) //diff
.setDrmConfiguration(
MediaItem.DrmConfiguration.Builder(drmSchemeUuid)
.setLicenseUri(DRM_LICENSE_URL).build()
)
.setMimeType(MimeTypes.APPLICATION_MPD)
.setTag(null)
.build()
)
val dataSpec = DataSpec(Uri.parse(PREROLL))
val imaSdkSettings = ImaSdkFactory.getInstance().createImaSdkSettings()
val imaAdsLoader = ImaAdsLoader.Builder(this).setImaSdkSettings(imaSdkSettings).build()
imaAdsLoader.setPlayer(playerView)
val adsMediaSource = AdsMediaSource(mediaSource, dataSpec, 0, DefaultMediaSourceFactory(this), imaAdsLoader, binding.playerView)
playerView.setMediaSource(adsMediaSource)
playerView.prepare()
But if I combine both I get :
com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected IllegalArgumentException: null
How can I have all three workings: preroll + dai + dash ( drm widevine) in exoplayer 2.18.1?
Thanks
Unfortunately no. They stated it here: https://developer.android.com/guide/topics/media/exoplayer/ad-insertion#:~:text=.release()-,Note,-%3A%20Currently%20only
These stream types are incompatible but you still can combine the features:
So if you want to request ads (like non paid users) use this media source, if not, just keep the original content media source. This is the only wrapper that worked for me to handle different types of sources like Cronet, Hls, Dash, Akamai, Clippable and DRM