Register the overlay view as non-obstructing

Currently IMA determines that the overlay is obstructing, even
if it's empty. Register it as friendly, which means we're
assuming that anything the apps puts in it is necessary for
playback.

PiperOrigin-RevId: 234963065
This commit is contained in:
andrewlewis 2019-02-21 11:08:11 +00:00 committed by Andrew Lewis
parent af9a0a913f
commit ea49e61b5e

View File

@ -70,6 +70,7 @@ import com.google.android.exoplayer2.video.VideoListener;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
/**
@ -1117,7 +1118,14 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
@Override
public View[] getAdOverlayViews() {
return controller != null ? new View[] {controller} : new View[0];
ArrayList<View> overlayViews = new ArrayList<>();
if (overlayFrameLayout != null) {
overlayViews.add(overlayFrameLayout);
}
if (controller != null) {
overlayViews.add(controller);
}
return overlayViews.toArray(new View[0]);
}
// Internal methods.