Pause and resume GLSurfaceView instances in player views
This is the right thing to do, as per the GLSurfaceView documentation. This adds (previously omitted) calls to VideoDecoderGLSurfaceView. PiperOrigin-RevId: 368202523
This commit is contained in:
parent
72c77875e4
commit
ffc2a47d0a
@ -25,6 +25,7 @@ import android.graphics.Matrix;
|
|||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.opengl.GLSurfaceView;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@ -1151,28 +1152,28 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be called when the player is visible to the user and if {@code surface_type} is {@code
|
* Should be called when the player is visible to the user, if the {@code surface_type} extends
|
||||||
* spherical_gl_surface_view}. It is the counterpart to {@link #onPause()}.
|
* {@link GLSurfaceView}. It is the counterpart to {@link #onPause()}.
|
||||||
*
|
*
|
||||||
* <p>This method should typically be called in {@code Activity.onStart()}, or {@code
|
* <p>This method should typically be called in {@code Activity.onStart()}, or {@code
|
||||||
* Activity.onResume()} for API versions <= 23.
|
* Activity.onResume()} for API versions <= 23.
|
||||||
*/
|
*/
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
if (surfaceView instanceof SphericalGLSurfaceView) {
|
if (surfaceView instanceof GLSurfaceView) {
|
||||||
((SphericalGLSurfaceView) surfaceView).onResume();
|
((GLSurfaceView) surfaceView).onResume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be called when the player is no longer visible to the user and if {@code surface_type}
|
* Should be called when the player is no longer visible to the user, if the {@code surface_type}
|
||||||
* is {@code spherical_gl_surface_view}. It is the counterpart to {@link #onResume()}.
|
* extends {@link GLSurfaceView}. It is the counterpart to {@link #onResume()}.
|
||||||
*
|
*
|
||||||
* <p>This method should typically be called in {@code Activity.onStop()}, or {@code
|
* <p>This method should typically be called in {@code Activity.onStop()}, or {@code
|
||||||
* Activity.onPause()} for API versions <= 23.
|
* Activity.onPause()} for API versions <= 23.
|
||||||
*/
|
*/
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
if (surfaceView instanceof SphericalGLSurfaceView) {
|
if (surfaceView instanceof GLSurfaceView) {
|
||||||
((SphericalGLSurfaceView) surfaceView).onPause();
|
((GLSurfaceView) surfaceView).onPause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import android.graphics.Matrix;
|
|||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.opengl.GLSurfaceView;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@ -1169,28 +1170,28 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be called when the player is visible to the user and if {@code surface_type} is {@code
|
* Should be called when the player is visible to the user, if the {@code surface_type} extends
|
||||||
* spherical_gl_surface_view}. It is the counterpart to {@link #onPause()}.
|
* {@link GLSurfaceView}. It is the counterpart to {@link #onPause()}.
|
||||||
*
|
*
|
||||||
* <p>This method should typically be called in {@code Activity.onStart()}, or {@code
|
* <p>This method should typically be called in {@code Activity.onStart()}, or {@code
|
||||||
* Activity.onResume()} for API versions <= 23.
|
* Activity.onResume()} for API versions <= 23.
|
||||||
*/
|
*/
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
if (surfaceView instanceof SphericalGLSurfaceView) {
|
if (surfaceView instanceof GLSurfaceView) {
|
||||||
((SphericalGLSurfaceView) surfaceView).onResume();
|
((GLSurfaceView) surfaceView).onResume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be called when the player is no longer visible to the user and if {@code surface_type}
|
* Should be called when the player is no longer visible to the user, if the {@code surface_type}
|
||||||
* is {@code spherical_gl_surface_view}. It is the counterpart to {@link #onResume()}.
|
* extends {@link GLSurfaceView}. It is the counterpart to {@link #onResume()}.
|
||||||
*
|
*
|
||||||
* <p>This method should typically be called in {@code Activity.onStop()}, or {@code
|
* <p>This method should typically be called in {@code Activity.onStop()}, or {@code
|
||||||
* Activity.onPause()} for API versions <= 23.
|
* Activity.onPause()} for API versions <= 23.
|
||||||
*/
|
*/
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
if (surfaceView instanceof SphericalGLSurfaceView) {
|
if (surfaceView instanceof GLSurfaceView) {
|
||||||
((SphericalGLSurfaceView) surfaceView).onPause();
|
((GLSurfaceView) surfaceView).onPause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user