3

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

daksh bhardwaj
  • 315
  • 4
  • 12
BejanCorneliu
  • 65
  • 3
  • 13

1 Answers1

0

It might not like the .setTag(null) part; either remove that or provide String.

And I also find it strange that you access playerView ...and not player; for comparison:

player.setMediaSource(adsMediaSource)
player.prepare()
Martin Zeitler
  • 1
  • 19
  • 155
  • 216