mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add an overlay FrameLayout for ad UI
This will be used instead of the current overlay FrameLayout (which apps can interact with directly). PiperOrigin-RevId: 233077175
This commit is contained in:
parent
c16af73717
commit
e7687764a1
3 changed files with 17 additions and 1 deletions
|
|
@ -221,6 +221,11 @@ import java.util.List;
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Type: {@link PlayerControlView}
|
* <li>Type: {@link PlayerControlView}
|
||||||
* </ul>
|
* </ul>
|
||||||
|
* <li><b>{@code exo_ad_overlay}</b> - A {@link FrameLayout} positioned on top of the player which
|
||||||
|
* is used to show ad UI (if applicable).
|
||||||
|
* <ul>
|
||||||
|
* <li>Type: {@link FrameLayout}
|
||||||
|
* </ul>
|
||||||
* <li><b>{@code exo_overlay}</b> - A {@link FrameLayout} positioned on top of the player which
|
* <li><b>{@code exo_overlay}</b> - A {@link FrameLayout} positioned on top of the player which
|
||||||
* the app can access via {@link #getOverlayFrameLayout()}, provided for convenience.
|
* the app can access via {@link #getOverlayFrameLayout()}, provided for convenience.
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|
@ -280,7 +285,8 @@ public class PlayerView extends FrameLayout {
|
||||||
@Nullable private final TextView errorMessageView;
|
@Nullable private final TextView errorMessageView;
|
||||||
private final PlayerControlView controller;
|
private final PlayerControlView controller;
|
||||||
private final ComponentListener componentListener;
|
private final ComponentListener componentListener;
|
||||||
private final FrameLayout overlayFrameLayout;
|
@Nullable private final FrameLayout adOverlayFrameLayout;
|
||||||
|
@Nullable private final FrameLayout overlayFrameLayout;
|
||||||
|
|
||||||
private Player player;
|
private Player player;
|
||||||
private boolean useController;
|
private boolean useController;
|
||||||
|
|
@ -317,6 +323,7 @@ public class PlayerView extends FrameLayout {
|
||||||
errorMessageView = null;
|
errorMessageView = null;
|
||||||
controller = null;
|
controller = null;
|
||||||
componentListener = null;
|
componentListener = null;
|
||||||
|
adOverlayFrameLayout = null;
|
||||||
overlayFrameLayout = null;
|
overlayFrameLayout = null;
|
||||||
ImageView logo = new ImageView(context);
|
ImageView logo = new ImageView(context);
|
||||||
if (Util.SDK_INT >= 23) {
|
if (Util.SDK_INT >= 23) {
|
||||||
|
|
@ -411,6 +418,9 @@ public class PlayerView extends FrameLayout {
|
||||||
surfaceView = null;
|
surfaceView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ad overlay frame layout.
|
||||||
|
adOverlayFrameLayout = findViewById(R.id.exo_ad_overlay);
|
||||||
|
|
||||||
// Overlay frame layout.
|
// Overlay frame layout.
|
||||||
overlayFrameLayout = findViewById(R.id.exo_overlay);
|
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
|
* @return The overlay {@link FrameLayout}, or {@code null} if the layout has been customized and
|
||||||
* the overlay is not present.
|
* the overlay is not present.
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
public FrameLayout getOverlayFrameLayout() {
|
public FrameLayout getOverlayFrameLayout() {
|
||||||
return overlayFrameLayout;
|
return overlayFrameLayout;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@
|
||||||
|
|
||||||
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
|
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
|
||||||
|
|
||||||
|
<FrameLayout android:id="@id/exo_ad_overlay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
<FrameLayout android:id="@id/exo_overlay"
|
<FrameLayout android:id="@id/exo_overlay"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
<item name="exo_artwork" type="id"/>
|
<item name="exo_artwork" type="id"/>
|
||||||
<item name="exo_controller_placeholder" type="id"/>
|
<item name="exo_controller_placeholder" type="id"/>
|
||||||
<item name="exo_controller" type="id"/>
|
<item name="exo_controller" type="id"/>
|
||||||
|
<item name="exo_ad_overlay" type="id"/>
|
||||||
<item name="exo_overlay" type="id"/>
|
<item name="exo_overlay" type="id"/>
|
||||||
<item name="exo_play" type="id"/>
|
<item name="exo_play" type="id"/>
|
||||||
<item name="exo_pause" type="id"/>
|
<item name="exo_pause" type="id"/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue