diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
index 9742d0005a..8871767f49 100644
--- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
+++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
@@ -221,6 +221,11 @@ import java.util.List;
*
* - Type: {@link PlayerControlView}
*
+ * {@code exo_ad_overlay} - A {@link FrameLayout} positioned on top of the player which
+ * is used to show ad UI (if applicable).
+ *
+ * - Type: {@link FrameLayout}
+ *
* {@code exo_overlay} - A {@link FrameLayout} positioned on top of the player which
* the app can access via {@link #getOverlayFrameLayout()}, provided for convenience.
*
@@ -280,7 +285,8 @@ public class PlayerView extends FrameLayout {
@Nullable private final TextView errorMessageView;
private final PlayerControlView controller;
private final ComponentListener componentListener;
- private final FrameLayout overlayFrameLayout;
+ @Nullable private final FrameLayout adOverlayFrameLayout;
+ @Nullable private final FrameLayout overlayFrameLayout;
private Player player;
private boolean useController;
@@ -317,6 +323,7 @@ public class PlayerView extends FrameLayout {
errorMessageView = null;
controller = null;
componentListener = null;
+ adOverlayFrameLayout = null;
overlayFrameLayout = null;
ImageView logo = new ImageView(context);
if (Util.SDK_INT >= 23) {
@@ -411,6 +418,9 @@ public class PlayerView extends FrameLayout {
surfaceView = null;
}
+ // Ad overlay frame layout.
+ adOverlayFrameLayout = findViewById(R.id.exo_ad_overlay);
+
// Overlay frame layout.
overlayFrameLayout = findViewById(R.id.exo_overlay);
@@ -1012,6 +1022,7 @@ public class PlayerView extends FrameLayout {
* @return The overlay {@link FrameLayout}, or {@code null} if the layout has been customized and
* the overlay is not present.
*/
+ @Nullable
public FrameLayout getOverlayFrameLayout() {
return overlayFrameLayout;
}
diff --git a/library/ui/src/main/res/layout/exo_simple_player_view.xml b/library/ui/src/main/res/layout/exo_simple_player_view.xml
index 167ac96222..65dea9271e 100644
--- a/library/ui/src/main/res/layout/exo_simple_player_view.xml
+++ b/library/ui/src/main/res/layout/exo_simple_player_view.xml
@@ -52,6 +52,10 @@
+
+
diff --git a/library/ui/src/main/res/values/ids.xml b/library/ui/src/main/res/values/ids.xml
index 575a2b9c77..e57301f946 100644
--- a/library/ui/src/main/res/values/ids.xml
+++ b/library/ui/src/main/res/values/ids.xml
@@ -21,6 +21,7 @@
+