Skip to content

Need a way to decide if the Skip Button should be focused in real time, not when building ImaAdsLoader. #8565

@victorraft

Description

@victorraft

We have a TV application that has a video player that can transition between fullscreen and collapsed mode. We're using the IMA extension and we want the Ads Skip Button to be focused only when the player is in fullscreen mode, not when it's collapsed. The ImaAdsLoader.Builder().setFocusSkipButtonWhenAvailable()' cannot be used, because:

a) We need to be able to decide whether the button gets focused or not at the time that the ad becomes skippable, not when the ImaAdsLoader is being constructed.
b) setFocusSkipButtonWhenAvailable is buggy and causes weird issues, like the ad container getting focused when the ad is loaded, instead of when the skip button becomes available.

On previous Exoplayer versions (2.11.8 and lower) we used to be able to use the following workaround:

// When building the ImaAdsLoader we capture the adsManager reference
imaAdsLoader.adsLoader?.addAdsLoadedListener { adsManagerLoadedEvent ->
            adsManager = adsManagerLoadedEvent.adsManager
}

// Then when we receive SKIPPABLE_STATE_CHANGED use the adsManager to focus the skip button
override fun onAdEvent(adEvent: AdEvent) {  
    when (adEvent.type) {
        AdEvent.AdEventType.SKIPPABLE_STATE_CHANGED -> adsManager?.focus() 
        else -> Unit
    }
}

In the current versions it is not possible to do that, because imaAdsLoader.adsLoader returns null.
Is there a recommended way of doing what I want, or do you think you could include such functionality into the SDK?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions