Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/video_player/video_player_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.7.12

* Fixes a [bug](https://github.com/flutter/flutter/issues/156451) where
additional harmless but annoying warnings in the form of native stack traces
would be printed when the app was backgrounded. There may be additional
warnings that are not yet fixed, but this should address the
most common case.

## 2.7.11

* Fixes a [bug](https://github.com/flutter/flutter/issues/156158) where a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public void onSurfaceCreated() {

@RestrictTo(RestrictTo.Scope.LIBRARY)
public void onSurfaceDestroyed() {
exoPlayer.stop();
// Intentionally do not call pause/stop here, because the surface has already been released
// at this point (see https://github.com/flutter/flutter/issues/156451).
savedStateDuring = ExoPlayerState.save(exoPlayer);
exoPlayer.release();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,21 @@ public void onSurfaceProducerDestroyedAndRecreatedReleasesAndThenRecreatesAndRes
videoPlayer.dispose();
}

@Test
public void onSurfaceProducerDestroyedDoesNotStopOrPauseVideo() {
VideoPlayer videoPlayer = createVideoPlayer();

verify(mockProducer).setCallback(callbackCaptor.capture());
TextureRegistry.SurfaceProducer.Callback producerLifecycle = callbackCaptor.getValue();
producerLifecycle.onSurfaceDestroyed();

verify(mockExoPlayer, never()).stop();
verify(mockExoPlayer, never()).pause();
verify(mockExoPlayer, never()).setPlayWhenReady(anyBoolean());

videoPlayer.dispose();
}

@Test
public void onDisposeSurfaceProducerCallbackIsDisconnected() {
// Regression test for https://github.com/flutter/flutter/issues/156158.
Expand Down Expand Up @@ -289,7 +304,7 @@ public void disposeReleasesExoPlayerBeforeTexture() {

// TODO(matanlurey): Replace with inline calls to onSurfaceAvailable once
// available on stable; see https://github.com/flutter/flutter/issues/155131.
// This seperate method only exists to scope the suppression.
// This separate method only exists to scope the suppression.
@SuppressWarnings({"deprecation", "removal"})
void simulateSurfaceCreation(TextureRegistry.SurfaceProducer.Callback producerLifecycle) {
producerLifecycle.onSurfaceCreated();
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player/video_player_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: video_player_android
description: Android implementation of the video_player plugin.
repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
version: 2.7.11
version: 2.7.12

environment:
sdk: ^3.5.0
Expand Down