这是indexloc提供的服务,不要输入任何密码
Skip to content

Dash stream with DAI, no overlay #2597

@BejanCorneliu

Description

@BejanCorneliu

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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions