diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 4b2923c976..7646e4f42a 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -31,6 +31,10 @@
* Fix `StyledPlayerControlView` to stay in full mode (rather than minimal
mode) when possible
([#8763](https://github.com/google/ExoPlayer/issues/8763)).
+ * Remove `setUseSensorRotation` from `PlayerView` and `StyledPlayerView`.
+ Instead, cast the view returned by `getVideoSurfaceView` to
+ `SphericalGLSurfaceView`, and then call `setUseSensorRotation` on the
+ `SphericalGLSurfaceView` directly.
* Audio:
* Report unexpected discontinuities in
`AnalyticsListener.onAudioSinkError`
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 90f6a31d3e..0191c7c6b5 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
@@ -146,12 +146,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
*
Corresponding method: None
* Default: {@code surface_view}
*
- * {@code use_sensor_rotation} - Whether to use the orientation sensor for rotation
- * during spherical playbacks (if available).
- *
- * - Corresponding method: {@link #setUseSensorRotation(boolean)}
- *
- Default: {@code true}
- *
* {@code shutter_background_color} - The background color of the {@code exo_shutter}
* view.
*
@@ -315,7 +309,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
@Nullable private Drawable defaultArtwork;
private @ShowBuffering int showBuffering;
private boolean keepContentOnPlayerReset;
- private boolean useSensorRotation;
@Nullable private ErrorMessageProvider super ExoPlaybackException> errorMessageProvider;
@Nullable private CharSequence customErrorMessage;
private int controllerShowTimeoutMs;
@@ -375,7 +368,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
boolean controllerAutoShow = true;
boolean controllerHideDuringAds = true;
int showBuffering = SHOW_BUFFERING_NEVER;
- useSensorRotation = true;
if (attrs != null) {
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.PlayerView, 0, 0);
try {
@@ -399,8 +391,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
R.styleable.PlayerView_keep_content_on_player_reset, keepContentOnPlayerReset);
controllerHideDuringAds =
a.getBoolean(R.styleable.PlayerView_hide_during_ads, controllerHideDuringAds);
- useSensorRotation =
- a.getBoolean(R.styleable.PlayerView_use_sensor_rotation, useSensorRotation);
} finally {
a.recycle();
}
@@ -433,7 +423,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
case SURFACE_TYPE_SPHERICAL_GL_SURFACE_VIEW:
SphericalGLSurfaceView sphericalGLSurfaceView = new SphericalGLSurfaceView(context);
sphericalGLSurfaceView.setSingleTapListener(componentListener);
- sphericalGLSurfaceView.setUseSensorRotation(useSensorRotation);
surfaceView = sphericalGLSurfaceView;
break;
case SURFACE_TYPE_VIDEO_DECODER_GL_SURFACE_VIEW:
@@ -742,22 +731,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
}
}
- /**
- * Sets whether to use the orientation sensor for rotation during spherical playbacks (if
- * available)
- *
- * @param useSensorRotation Whether to use the orientation sensor for rotation during spherical
- * playbacks.
- */
- public void setUseSensorRotation(boolean useSensorRotation) {
- if (this.useSensorRotation != useSensorRotation) {
- this.useSensorRotation = useSensorRotation;
- if (surfaceView instanceof SphericalGLSurfaceView) {
- ((SphericalGLSurfaceView) surfaceView).setUseSensorRotation(useSensorRotation);
- }
- }
- }
-
/**
* Sets whether a buffering spinner is displayed when the player is in the buffering state. The
* buffering spinner is not displayed by default.
diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java
index 7e87b662f1..cd9adf7421 100644
--- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java
+++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java
@@ -148,12 +148,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
* - Corresponding method: None
*
- Default: {@code surface_view}
*
- * {@code use_sensor_rotation} - Whether to use the orientation sensor for rotation
- * during spherical playbacks (if available).
- *
- * - Corresponding method: {@link #setUseSensorRotation(boolean)}
- *
- Default: {@code true}
- *
* {@code shutter_background_color} - The background color of the {@code exo_shutter}
* view.
*
@@ -317,7 +311,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
@Nullable private Drawable defaultArtwork;
private @ShowBuffering int showBuffering;
private boolean keepContentOnPlayerReset;
- private boolean useSensorRotation;
@Nullable private ErrorMessageProvider super ExoPlaybackException> errorMessageProvider;
@Nullable private CharSequence customErrorMessage;
private int controllerShowTimeoutMs;
@@ -377,7 +370,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
boolean controllerAutoShow = true;
boolean controllerHideDuringAds = true;
int showBuffering = SHOW_BUFFERING_NEVER;
- useSensorRotation = true;
if (attrs != null) {
TypedArray a =
context.getTheme().obtainStyledAttributes(attrs, R.styleable.StyledPlayerView, 0, 0);
@@ -406,8 +398,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
keepContentOnPlayerReset);
controllerHideDuringAds =
a.getBoolean(R.styleable.StyledPlayerView_hide_during_ads, controllerHideDuringAds);
- useSensorRotation =
- a.getBoolean(R.styleable.StyledPlayerView_use_sensor_rotation, useSensorRotation);
} finally {
a.recycle();
}
@@ -440,7 +430,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
case SURFACE_TYPE_SPHERICAL_GL_SURFACE_VIEW:
SphericalGLSurfaceView sphericalGLSurfaceView = new SphericalGLSurfaceView(context);
sphericalGLSurfaceView.setSingleTapListener(componentListener);
- sphericalGLSurfaceView.setUseSensorRotation(useSensorRotation);
surfaceView = sphericalGLSurfaceView;
break;
case SURFACE_TYPE_VIDEO_DECODER_GL_SURFACE_VIEW:
@@ -751,22 +740,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
}
}
- /**
- * Sets whether to use the orientation sensor for rotation during spherical playbacks (if
- * available)
- *
- * @param useSensorRotation Whether to use the orientation sensor for rotation during spherical
- * playbacks.
- */
- public void setUseSensorRotation(boolean useSensorRotation) {
- if (this.useSensorRotation != useSensorRotation) {
- this.useSensorRotation = useSensorRotation;
- if (surfaceView instanceof SphericalGLSurfaceView) {
- ((SphericalGLSurfaceView) surfaceView).setUseSensorRotation(useSensorRotation);
- }
- }
- }
-
/**
* Sets whether a buffering spinner is displayed when the player is in the buffering state. The
* buffering spinner is not displayed by default.
diff --git a/library/ui/src/main/res/values/attrs.xml b/library/ui/src/main/res/values/attrs.xml
index f298f10a1e..bb4806db06 100644
--- a/library/ui/src/main/res/values/attrs.xml
+++ b/library/ui/src/main/res/values/attrs.xml
@@ -54,7 +54,6 @@
-
@@ -104,7 +103,6 @@
-
@@ -143,7 +141,6 @@
-