Dash stream with DAI, no overlay
@marcbaechinger is already working on this.
Since Jul 10, 2025.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
Version
Media3 1.7.1 (same as 1.6.1)
More version details
No response
Devices that reproduce the issue
Pixel 8 pro
Samsung S21
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Dont know how to test it
Reproduction steps
Starting DASH stream with DAI
My code i use :
fun PlayerServiceCore.initExoPlayerForPreRoll(): ExoPlayer {
initExoPlayerListener()
return ExoPlayer.Builder(this)
.setSeekBackIncrementMs(20000)
.setSeekForwardIncrementMs(20000)
.setVideoScalingMode(C.VIDEO_SCALING_MODE_DEFAULT)
.setTrackSelector(initDefaultTrackSelector())
.setRenderersFactory(initRenderersFactory())
.setAudioAttributes(initAudioAttributes(), true)
.setHandleAudioBecomingNoisy(true)
.setMediaSourceFactory(setMediaSourceForPreRoll())
.build()
}
fun PlayerServiceCore.setMediaSourceForPreRoll(): DefaultMediaSourceFactory {
Log.d(PLAYER_LOG, "(attached=${(MediaItemSettings.mBau as FrameLayout)?.isAttachedToWindow})")
mImaDai = ImaServerSideAdInsertionMediaSource.AdsLoader.Builder(this, AdViewProvider {
Log.d(PLAYER_LOG, "AdViewProvider.getAdViewGroup() called!")
val container = MediaItemSettings.mBau as FrameLayout
Log.d(PLAYER_LOG, "Container dimensions: ${container.width}x${container.height}")
Log.d(PLAYER_LOG, "Container visibility: ${container.visibility}")
Log.d(PLAYER_LOG, "Container attached: ${container.isAttachedToWindow}")
container
})
.setAdEventListener { adEvent ->
Log.d(PLAYER_LOG, "Ad event: ${adEvent.type}")
Log.d(PLAYER_LOG, "Ad position: ${adEvent.ad?.adPodInfo?.adPosition} - ${adEvent.ad?.adPodInfo?.totalAds}")
Log.d(PLAYER_LOG, "Ad title: ${adEvent.ad?.title}")
}
.setAdErrorListener { adError ->
Log.d(PLAYER_LOG, "Ad ERROR: ${adError.error.message} / ${adError.error.errorCode} / ${adError.error.errorType}")
}
.setImaSdkSettings(ImaSdkFactory.getInstance().createImaSdkSettings().apply {
isDebugMode = true
playerType = "ExoPlayer"
playerVersion = "1.7.1"
})
.build()
Log.d(PLAYER_LOG, "mImaDai created: ${mImaDai != null}")
val daiFactory = ImaServerSideAdInsertionMediaSource.Factory(mImaDai!!, DefaultMediaSourceFactory(this))
Log.d(PLAYER_LOG, "DAI Factory created: ${daiFactory != null}")
return DefaultMediaSourceFactory(this)
.setDataSourceFactory(DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true))
.setServerSideAdInsertionMediaSourceFactory(daiFactory)
// .setLocalAdInsertionComponents(
// this::initImaAds ,
// AdViewProvider {
// val container = MediaItemSettings.mBau as FrameLayout
// container
// }
// )
}
If i switch setServerSideAdInsertionMediaSourceFactory() with setLocalAdInsertionComponents() and test with preroll, everthings works fine. The preroll overlay shows up. Also testest provinding PlayerView or playerview.adviewgroup
When testing like above ( with DASH stream with DAI) all logs above looks fine withount those regarding mImaDai ; None of the logs from mImaDai listeners ar showing
Providing other view non FrameLayout to ImaServerSideAdInsertionMediaSource results in crash ( so the code is somehow triggered)
i create the media Item with :
fun getDASH(nMediaData: MediaMetadata.Builder, nContent: String, nProxy: String): MediaItem {
var mMediaItemDrmConfiguration = MediaItem.DrmConfiguration.Builder(C.WIDEVINE_UUID).apply {
setLicenseUri(nProxy)
}
val mMediaItem = MediaItem.Builder()
.setUri(nContent.toUri())
.setMimeType(MimeTypes.APPLICATION_MPD)
.setDrmConfiguration(mMediaItemDrmConfiguration.build())
.setMediaMetadata(nMediaData.build())
.setAdsConfiguration(
MediaItem.AdsConfiguration.Builder(nContent.toUri())
.build()
)
val builtItem = mMediaItem.build()
Timber.tag(PLAYER_LOG).d("MediaItem created with AdsConfiguration: ${builtItem.localConfiguration?.adsConfiguration != null}")
return builtItem
}
and the stream is like : https://dai.google.com/linear/dash/event/...../manifest.mpd
Expected result
When asd (DAI) start rolling no overlay and no ad events
Actual result
Ads rolling and are different from other platform using same stream, but no overlay "ads 1 of..." or any ads events
Media
stream is like : https://dai.google.com/linear/dash/event/...../manifest.mpd
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.
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.