Skip to content

Commit 9cc6f37

Browse files
[video_player_android] Provide the current surface to the new ExoPlayer in TextureVideoPlayer.onSurfaceAvailable (#8818)
Fixes flutter/flutter#164689
1 parent c392bfe commit 9cc6f37

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

packages/video_player/video_player_android/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.8.2
2+
3+
* Fixes a [bug](https://github.com/flutter/flutter/issues/164689) that can cause video to
4+
disappear after an app is suspended and resumed.
5+
16
## 2.8.1
27

38
* Updates compileSdk 34 to flutter.compileSdkVersion.

packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureVideoPlayer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ protected ExoPlayerEventListener createExoPlayerEventListener(@NonNull ExoPlayer
8787
public void onSurfaceAvailable() {
8888
if (savedStateDuring != null) {
8989
exoPlayer = createVideoPlayer();
90+
exoPlayer.setVideoSurface(surfaceProducer.getSurface());
9091
savedStateDuring.restore(exoPlayer);
9192
savedStateDuring = null;
9293
}

packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/TextureVideoPlayerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public void onSurfaceProducerDestroyedAndAvailableReleasesAndThenRecreatesAndRes
102102
mockExoPlayer = mock(ExoPlayer.class);
103103
producerLifecycle.onSurfaceAvailable();
104104

105+
verify(mockExoPlayer).setVideoSurface(any());
105106
verify(mockExoPlayer).seekTo(10L);
106107
verify(mockExoPlayer).setRepeatMode(Player.REPEAT_MODE_ALL);
107108
verify(mockExoPlayer).setVolume(0.5f);

packages/video_player/video_player_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: video_player_android
22
description: Android implementation of the video_player plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
5-
version: 2.8.1
5+
version: 2.8.2
66

77
environment:
88
sdk: ^3.6.0

0 commit comments

Comments
 (0)