Skip to content

Commit

Permalink
Add a method to focus the 'skip ad' button, if shown
Browse files Browse the repository at this point in the history
Issue: #8565

PiperOrigin-RevId: 356691251
  • Loading branch information
andrewlewis authored and ojw28 committed Feb 12, 2021
1 parent 19ab087 commit d0dd33e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* Fix a bug where an assertion would fail if the player started to buffer
an ad media period before the ad URI was known then an ad state update
arrived that didn't set the ad URI.
* Add `ImaAdsLoader.focusSkipButton` to allow apps to request that the
skip button should receive UI focus, if shown
([#8565](https://github.com/google/ExoPlayer/issues/8565)).
* DRM:
* Re-use the previous `DrmSessionManager` instance when playing a playlist
(if possible)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ public void skipAd() {
}
}

/**
* Moves UI focus to the skip button (or other interactive elements), if currently shown. See
* {@link AdsManager#focus()}.
*/
public void focusSkipButton() {
if (adsManager != null) {
adsManager.focus();
}
}

/**
* Starts passing events from this instance (including any pending ad playback state) and
* registers obstructions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,16 @@ public void skipAd() {
}
}

/**
* Moves UI focus to the skip button (or other interactive elements), if currently shown. See
* {@link AdsManager#focus()}.
*/
public void focusSkipButton() {
if (currentAdTagLoader != null) {
currentAdTagLoader.focusSkipButton();
}
}

// AdsLoader implementation.

@Override
Expand Down

0 comments on commit d0dd33e

Please sign in to comment.