[Android TV] How to avoid the Ads pause while pressing enter button from remote

“I’m currently utilizing Bitmovin’s latest SDK version 3.34.0 and facing an issue where pressing the ‘Enter’ button on the remote causes ads to pause. While I need to retain the ‘Enter’ button control for skipping ads, I also need to find a way to prevent ads from pausing. How can I achieve this?”

Hi @malviya.software,

thanks for reaching out. When calling “Player.pause”, the content being played back is paused, no matter if it is an ad or not. You can work around this by checking for Player.isAd before calling pause on the player.

May I ask if you are using the default Bitmovin Player Web UI or a custom UI? Depending on that the way of intercepting the “pause” call is different.

I’m currently utilizing the Android Bitmovin SDK version 3.30.0 to create a customized player user interface( Used Bitmovin Custom UI Player Kotlin Demo) on AndroidTV.
I tried with

 if(!playerUi.player.isAd) {

it didn’t work

In that case I assume the “enter” button is potentially triggering a click on the IMA ads ui - which in return pauses playback.
Could you please provide a reproducible example with steps to reproduce the issue? This will make it easier to determine the root cause.
Thanks in advance,

One way to replicate the problem is by utilizing the ‘BasicAdsKotlin’ sample application. Follow this step:

While running Ads, attempt to pause it by tapping on the screen in the emulator or by pressing the Enter button on a Sony TV. Upon examination, it becomes evident that the Ads will pause, but they will not resume upon tapping the screen or pressing the enter button again.

Can you please suggest a fix for this?

Thank you for your patience @malviya.software. I managed to reproduce the issue. To my surprise the same code does work on a phone emulator but not on a TV emulator.

We will investigate internally. For now I would suggest to add a key event handler intercepting the enter, something similar to this:

    override fun dispatchKeyEvent(event: KeyEvent): Boolean {
        if (event.action == KeyEvent.ACTION_DOWN) {
            playerView?.player?.let { player ->
                if (event.keyCode == KeyEvent.KEYCODE_DPAD_CENTER || event.keyCode == KeyEvent.KEYCODE_ENTER) {
                    if (!player.isPlaying && player.isAd) {
                        return true
        return super.dispatchKeyEvent(event)

Thank you for the suggestion, but unfortunately, it did not work. It appears that the player handlers may pause internally, as even after the ads pause, the player did not resume based on the code mentioned above.

For me the above solution worked (tested on Android TV emulator). Seems like we are potentially observing different scenarios here. Let me create a sample to get to a common ground.

I created a fork of the public samples that you can test here.

Steps to reproduce:

  • add your license key to the manifest of the BasicAdsKotlin sample
  • run BasicAdsKotlin sample on and Android TV emulator
  • during the pre-roll ad click the ad
  • observe the ad being paused
  • click the dpad center button
  • observe the ad resuming

Please be aware that we do have a sample that showcases how to utilize the Player on TV’s here.

I hope this workaround helps you. We are tracking this issue internally and will get back to this once we have any updates.

I’ll mark this as solved for now as a workaround was provided. As mentioned, we are tracking the unexpected behaviour internally and will follow up here once we work on it.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.