androidx / androidx/media

Android TV D-pad forward/rewind do not jump over the adbreak

Open
#1,723 0 comments 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Sep 12, 2024.

needs triage question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

I am facing this issue when user presses the fast-forward/rewind button on their AndroidTV remote. We are doing ff/rw programmatically. What we want is to jump over the AdBreak (similar to scrubbing on a mobile device's seek bar) and play the adBreak just before the user stops and starts playing instead of playing ad whenever it comes on ad point even while scrubbing through.

To match the forward and rewind behaviour between all different TVs I had update d-pad left right for chrome cast and for other devices something like this

 if (isDpadRightAction) {
      if (Build.MODEL.contains("Chromecast")) {
           exoplayer.fastForward();
       } else {
            findViewById(R.id.exo_progress).dispatchKeyEvent(
                    new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_RIGHT));
      } return true;
}
        
And we have fast forward method that will handle +10/-10 seconds to match the default forward and rewind behaviour
        
public void fastForward() {
      playerView.showController();
      forwardRewindPosition = exoPlayer.getContentPosition() +
            (defaultFFSpeedMs ? (exoPlayer.getDuration() / 100) : ffSpeedMs);
      forwardRewindPosition = Math.min(forwardRewindPosition, exoPlayer.getDuration());
      exoPlayer.seekTo(exoPlayer.getCurrentMediaItemIndex(), forwardRewindPosition);
}

However, I currently when I seek fast-forward like this, the player starts playing ads as soon as we hit the ad break. Is there any native support available to achieve the desired behavior?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.