Commit 05a79a41 by olly Committed by Andrew Lewis

Fall back to TYPE_ROTATION_VECTOR if TYPE_GAME_ROTATION_VECTOR unavailable

Issue: #5119
PiperOrigin-RevId: 222978448
parent 19a6f904
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
([#4883](https://github.com/google/ExoPlayer/issues/4883)). ([#4883](https://github.com/google/ExoPlayer/issues/4883)).
* DASH: Fix detecting the end of live events * DASH: Fix detecting the end of live events
([#4780](https://github.com/google/ExoPlayer/issues/4780)). ([#4780](https://github.com/google/ExoPlayer/issues/4780)).
* Spherical video: Fall back to `TYPE_ROTATION_VECTOR` if
`TYPE_GAME_ROTATION_VECTOR` is unavailable
([#5119](https://github.com/google/ExoPlayer/issues/5119)).
* Support seeking for a wider range of MPEG-TS streams * Support seeking for a wider range of MPEG-TS streams
([#5097](https://github.com/google/ExoPlayer/issues/5097)). ([#5097](https://github.com/google/ExoPlayer/issues/5097)).
* Support for playing spherical videos on Daydream. * Support for playing spherical videos on Daydream.
......
...@@ -102,12 +102,18 @@ public final class SphericalSurfaceView extends GLSurfaceView { ...@@ -102,12 +102,18 @@ public final class SphericalSurfaceView extends GLSurfaceView {
// Configure sensors and touch. // Configure sensors and touch.
sensorManager = sensorManager =
(SensorManager) Assertions.checkNotNull(context.getSystemService(Context.SENSOR_SERVICE)); (SensorManager) Assertions.checkNotNull(context.getSystemService(Context.SENSOR_SERVICE));
Sensor orientationSensor = null;
if (Util.SDK_INT >= 18) {
// TYPE_GAME_ROTATION_VECTOR is the easiest sensor since it handles all the complex math for // TYPE_GAME_ROTATION_VECTOR is the easiest sensor since it handles all the complex math for
// fusion. It's used instead of TYPE_ROTATION_VECTOR since the latter uses the magnetometer on // fusion. It's used instead of TYPE_ROTATION_VECTOR since the latter uses the magnetometer on
// devices. When used indoors, the magnetometer can take some time to settle depending on the // devices. When used indoors, the magnetometer can take some time to settle depending on the
// device and amount of metal in the environment. // device and amount of metal in the environment.
int type = Util.SDK_INT >= 18 ? Sensor.TYPE_GAME_ROTATION_VECTOR : Sensor.TYPE_ROTATION_VECTOR; orientationSensor = sensorManager.getDefaultSensor(Sensor.TYPE_GAME_ROTATION_VECTOR);
orientationSensor = sensorManager.getDefaultSensor(type); }
if (orientationSensor == null) {
orientationSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR);
}
this.orientationSensor = orientationSensor;
scene = new SceneRenderer(); scene = new SceneRenderer();
renderer = new Renderer(scene); renderer = new Renderer(scene);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment