From 2be331a7acc501fad0c9a4cdc10c8b46a8dd3688 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 23:40:02 +0000 Subject: [PATCH 1/4] [dependabot]: Bump exoplayer_version Bumps `exoplayer_version` from 1.4.1 to 1.5.1. Updates `androidx.media3:media3-exoplayer` from 1.4.1 to 1.5.1 - [Release notes](https://github.com/androidx/media/releases) - [Changelog](https://github.com/androidx/media/blob/release/RELEASENOTES.md) - [Commits](https://github.com/androidx/media/compare/1.4.1...1.5.1) Updates `androidx.media3:media3-exoplayer-hls` from 1.4.1 to 1.5.1 - [Release notes](https://github.com/androidx/media/releases) - [Changelog](https://github.com/androidx/media/blob/release/RELEASENOTES.md) - [Commits](https://github.com/androidx/media/compare/1.4.1...1.5.1) Updates `androidx.media3:media3-exoplayer-dash` from 1.4.1 to 1.5.1 - [Release notes](https://github.com/androidx/media/releases) - [Changelog](https://github.com/androidx/media/blob/release/RELEASENOTES.md) - [Commits](https://github.com/androidx/media/compare/1.4.1...1.5.1) Updates `androidx.media3:media3-exoplayer-rtsp` from 1.4.1 to 1.5.1 - [Release notes](https://github.com/androidx/media/releases) - [Changelog](https://github.com/androidx/media/blob/release/RELEASENOTES.md) - [Commits](https://github.com/androidx/media/compare/1.4.1...1.5.1) Updates `androidx.media3:media3-exoplayer-smoothstreaming` from 1.4.1 to 1.5.1 - [Release notes](https://github.com/androidx/media/releases) - [Changelog](https://github.com/androidx/media/blob/release/RELEASENOTES.md) - [Commits](https://github.com/androidx/media/compare/1.4.1...1.5.1) Updates `androidx.media3:media3-test-utils` from 1.4.1 to 1.5.1 - [Release notes](https://github.com/androidx/media/releases) - [Changelog](https://github.com/androidx/media/blob/release/RELEASENOTES.md) - [Commits](https://github.com/androidx/media/compare/1.4.1...1.5.1) --- updated-dependencies: - dependency-name: androidx.media3:media3-exoplayer dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: androidx.media3:media3-exoplayer-hls dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: androidx.media3:media3-exoplayer-dash dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: androidx.media3:media3-exoplayer-rtsp dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: androidx.media3:media3-exoplayer-smoothstreaming dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: androidx.media3:media3-test-utils dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- packages/video_player/video_player_android/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/video_player/video_player_android/android/build.gradle b/packages/video_player/video_player_android/android/build.gradle index 92decbdda71..c3f0c143b94 100644 --- a/packages/video_player/video_player_android/android/build.gradle +++ b/packages/video_player/video_player_android/android/build.gradle @@ -40,7 +40,7 @@ android { } dependencies { - def exoplayer_version = "1.4.1" + def exoplayer_version = "1.5.1" implementation "androidx.media3:media3-exoplayer:${exoplayer_version}" implementation "androidx.media3:media3-exoplayer-hls:${exoplayer_version}" implementation "androidx.media3:media3-exoplayer-dash:${exoplayer_version}" From 65e2263c83dd7f84679be1133a476c2ef21aca58 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Mon, 16 Jun 2025 09:53:07 -0700 Subject: [PATCH 2/4] get rid of unappliedRotationDegrees clause --- .../texture/TextureExoPlayerEventListener.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureExoPlayerEventListener.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureExoPlayerEventListener.java index b6e33546cd5..a607270e01b 100644 --- a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureExoPlayerEventListener.java +++ b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureExoPlayerEventListener.java @@ -32,20 +32,7 @@ protected void sendInitialized() { int width = videoSize.width; int height = videoSize.height; if (width != 0 && height != 0) { - if (Build.VERSION.SDK_INT <= 21) { - // On API 21 and below, Exoplayer may not internally handle rotation correction - // and reports it through VideoSize.unappliedRotationDegrees. We may apply it to - // fix the case of upside-down playback. - try { - RotationDegrees unappliedRotation = - RotationDegrees.fromDegrees(videoSize.unappliedRotationDegrees); - rotationCorrection = getRotationCorrectionFromUnappliedRotation(unappliedRotation); - } catch (IllegalArgumentException e) { - // Unapplied rotation other than 0, 90, 180, 270 reported by VideoSize. Because this is - // unexpected, we apply no rotation correction. - rotationCorrection = RotationDegrees.ROTATE_0; - } - } else if (surfaceProducerHandlesCropAndRotation) { + if (surfaceProducerHandlesCropAndRotation) { // When the SurfaceTexture backend for Impeller is used, the preview should already // be correctly rotated. rotationCorrection = RotationDegrees.ROTATE_0; From a6125c06d9bce45afe060e389a8ebc9359fca8f8 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Mon, 23 Jun 2025 09:08:28 -0700 Subject: [PATCH 3/4] fix tests --- .../TextureExoPlayerEventListenerTest.java | 55 +++---------------- 1 file changed, 7 insertions(+), 48 deletions(-) diff --git a/packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/TextureExoPlayerEventListenerTest.java b/packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/TextureExoPlayerEventListenerTest.java index 7e2a3dbf2e7..5dc4502737c 100644 --- a/packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/TextureExoPlayerEventListenerTest.java +++ b/packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/TextureExoPlayerEventListenerTest.java @@ -35,26 +35,13 @@ public class TextureExoPlayerEventListenerTest { @Rule public MockitoRule initRule = MockitoJUnit.rule(); - @Test - @Config(maxSdk = 21) - public void onPlaybackStateChangedReadySendInitialized_belowAndroid21() { - TextureExoPlayerEventListener eventListener = - new TextureExoPlayerEventListener(mockExoPlayer, mockCallbacks, true); - VideoSize size = new VideoSize(800, 400, 0, 0); - when(mockExoPlayer.getVideoSize()).thenReturn(size); - when(mockExoPlayer.getDuration()).thenReturn(10L); - - eventListener.onPlaybackStateChanged(Player.STATE_READY); - verify(mockCallbacks).onInitialized(800, 400, 10L, 0); - } - @Test @Config(minSdk = 22) public void onPlaybackStateChangedReadySendInitialized_whenSurfaceProducerHandlesCropAndRotation() { TextureExoPlayerEventListener eventListener = new TextureExoPlayerEventListener(mockExoPlayer, mockCallbacks, true); - VideoSize size = new VideoSize(800, 400, 0, 0); + VideoSize size = new VideoSize(800, 400, 0); when(mockExoPlayer.getVideoSize()).thenReturn(size); when(mockExoPlayer.getDuration()).thenReturn(10L); @@ -68,7 +55,7 @@ public void onPlaybackStateChangedReadySendInitialized_belowAndroid21() { onPlaybackStateChangedReadySendInitializedWithRotationCorrectionAndWidthAndHeightSwap_whenSurfaceProducerDoesNotHandleCropAndRotation() { TextureExoPlayerEventListener eventListener = new TextureExoPlayerEventListener(mockExoPlayer, mockCallbacks, false); - VideoSize size = new VideoSize(800, 400, 0, 0); + VideoSize size = new VideoSize(800, 400, 0); int rotationCorrection = 90; Format videoFormat = new Format.Builder().setRotationDegrees(rotationCorrection).build(); @@ -80,27 +67,13 @@ public void onPlaybackStateChangedReadySendInitialized_belowAndroid21() { verify(mockCallbacks).onInitialized(800, 400, 10L, rotationCorrection); } - @Test - @Config(maxSdk = 21) - public void - onPlaybackStateChangedReadyInPortraitMode90DegreesSwapWidthAndHeight_belowAndroid21() { - TextureExoPlayerEventListener eventListener = - new TextureExoPlayerEventListener(mockExoPlayer, mockCallbacks, true); - VideoSize size = new VideoSize(800, 400, 90, 0); - when(mockExoPlayer.getVideoSize()).thenReturn(size); - when(mockExoPlayer.getDuration()).thenReturn(10L); - - eventListener.onPlaybackStateChanged(Player.STATE_READY); - verify(mockCallbacks).onInitialized(800, 400, 10L, 0); - } - @Test @Config(minSdk = 22) public void onPlaybackStateChangedReadyInPortraitMode90DegreesDoesNotSwapWidthAndHeight_whenSurfaceProducerHandlesCropAndRotation() { TextureExoPlayerEventListener eventListener = new TextureExoPlayerEventListener(mockExoPlayer, mockCallbacks, true); - VideoSize size = new VideoSize(800, 400, 90, 0); + VideoSize size = new VideoSize(800, 400, 0); when(mockExoPlayer.getVideoSize()).thenReturn(size); when(mockExoPlayer.getDuration()).thenReturn(10L); @@ -115,7 +88,7 @@ public void onPlaybackStateChangedReadySendInitialized_belowAndroid21() { onPlaybackStateChangedReadyInPortraitMode90DegreesSwapWidthAndHeight_whenSurfaceProducerDoesNotHandleCropAndRotation() { TextureExoPlayerEventListener eventListener = new TextureExoPlayerEventListener(mockExoPlayer, mockCallbacks, false); - VideoSize size = new VideoSize(800, 400, 0, 0); + VideoSize size = new VideoSize(800, 400, 0); int rotationCorrection = 90; Format videoFormat = new Format.Builder().setRotationDegrees(rotationCorrection).build(); @@ -127,27 +100,13 @@ public void onPlaybackStateChangedReadySendInitialized_belowAndroid21() { verify(mockCallbacks).onInitialized(800, 400, 10L, 90); } - @Test - @Config(maxSdk = 21) - public void - onPlaybackStateChangedReadyInPortraitMode270DegreesSwapWidthAndHeight_belowAndroid21() { - TextureExoPlayerEventListener eventListener = - new TextureExoPlayerEventListener(mockExoPlayer, mockCallbacks, true); - VideoSize size = new VideoSize(800, 400, 270, 0); - when(mockExoPlayer.getVideoSize()).thenReturn(size); - when(mockExoPlayer.getDuration()).thenReturn(10L); - - eventListener.onPlaybackStateChanged(Player.STATE_READY); - verify(mockCallbacks).onInitialized(800, 400, 10L, 0); - } - @Test @Config(minSdk = 22) public void onPlaybackStateChangedReadyInPortraitMode270DegreesDoesNotSwapWidthAndHeight_whenSurfaceProducerHandlesCropAndRotation() { TextureExoPlayerEventListener eventListener = new TextureExoPlayerEventListener(mockExoPlayer, mockCallbacks, true); - VideoSize size = new VideoSize(800, 400, 270, 0); + VideoSize size = new VideoSize(800, 400, 0); when(mockExoPlayer.getVideoSize()).thenReturn(size); when(mockExoPlayer.getDuration()).thenReturn(10L); @@ -161,7 +120,7 @@ public void onPlaybackStateChangedReadySendInitialized_belowAndroid21() { onPlaybackStateChangedReadyInPortraitMode270DegreesDoesNotSwapWidthAndHeight_whenSurfaceProducerDoesNotHandleCropAndRotation() { TextureExoPlayerEventListener eventListener = new TextureExoPlayerEventListener(mockExoPlayer, mockCallbacks, false); - VideoSize size = new VideoSize(800, 400, 0, 0); + VideoSize size = new VideoSize(800, 400, 0); int rotationCorrection = 270; Format videoFormat = new Format.Builder().setRotationDegrees(rotationCorrection).build(); @@ -178,7 +137,7 @@ public void onPlaybackStateChangedReadySendInitialized_belowAndroid21() { public void onPlaybackStateChangedReadyFlipped180DegreesInformEventHandler_belowAndroid21() { TextureExoPlayerEventListener eventListener = new TextureExoPlayerEventListener(mockExoPlayer, mockCallbacks, true); - VideoSize size = new VideoSize(800, 400, 180, 0); + VideoSize size = new VideoSize(800, 400, 0); when(mockExoPlayer.getVideoSize()).thenReturn(size); when(mockExoPlayer.getDuration()).thenReturn(10L); From c1842484e9890d2b3658390d655a37d84b52a59c Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Mon, 23 Jun 2025 09:17:17 -0700 Subject: [PATCH 4/4] format --- .../videoplayer/texture/TextureExoPlayerEventListener.java | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureExoPlayerEventListener.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureExoPlayerEventListener.java index a607270e01b..f2759827018 100644 --- a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureExoPlayerEventListener.java +++ b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureExoPlayerEventListener.java @@ -4,7 +4,6 @@ package io.flutter.plugins.videoplayer.texture; -import android.os.Build; import androidx.annotation.NonNull; import androidx.annotation.OptIn; import androidx.media3.common.Format;