diff --git a/library/core/src/main/java/com/google/android/exoplayer2/video/spherical/CameraMotionListener.java b/library/core/src/main/java/com/google/android/exoplayer2/video/spherical/CameraMotionListener.java index 33fc639412..3e9362c227 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/video/spherical/CameraMotionListener.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/video/spherical/CameraMotionListener.java @@ -27,6 +27,6 @@ public interface CameraMotionListener { */ void onCameraMotion(long timeUs, float[] rotation); - /** Called when the camera motion track position is reset. */ + /** Called when the camera motion track position is reset or the track is disabled. */ void onCameraMotionReset(); } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/video/spherical/CameraMotionRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/video/spherical/CameraMotionRenderer.java index 5fab84ed8d..7b355b0ad9 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/video/spherical/CameraMotionRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/video/spherical/CameraMotionRenderer.java @@ -72,15 +72,12 @@ public class CameraMotionRenderer extends BaseRenderer { @Override protected void onPositionReset(long positionUs, boolean joining) throws ExoPlaybackException { - lastTimestampUs = 0; - if (listener != null) { - listener.onCameraMotionReset(); - } + reset(); } @Override protected void onDisabled() { - lastTimestampUs = 0; + reset(); } @Override @@ -126,4 +123,11 @@ public class CameraMotionRenderer extends BaseRenderer { } return result; } + + private void reset() { + lastTimestampUs = 0; + if (listener != null) { + listener.onCameraMotionReset(); + } + } }