Thanks to visit codestin.com
Credit goes to github.com

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
5 changes: 5 additions & 0 deletions packages/video_player/video_player_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.8.6

* Fixes a [bug](https://github.com/flutter/flutter/issues/165149) where the `isBuffering` flag
always returns true after seeking to any position.

## 2.8.5

* Replaces deprecated `onSurfaceDestroyed` with `onSurfaceCleanup`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ public void onPlaybackStateChanged(final int playbackState) {
events.onBufferingUpdate(exoPlayer.getBufferedPosition());
break;
case Player.STATE_READY:
if (isInitialized) {
return;
if (!isInitialized) {
isInitialized = true;
sendInitialized();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes in theory seems reasonable to me! Can you please add a test for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will add test case.

}
isInitialized = true;
sendInitialized();
break;
case Player.STATE_ENDED:
events.onCompleted();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ public void onPlaybackStateChangedEndedAfterBufferingSendsBufferingEndAndOnCompl
verifyNoMoreInteractions(mockCallbacks);
}

@Test
public void onPlaybackStateChangedReadyAfterBufferingSendsBufferingEnd() {
when(mockExoPlayer.getBufferedPosition()).thenReturn(10L);
eventListener.onPlaybackStateChanged(Player.STATE_BUFFERING);
verify(mockCallbacks).onBufferingStart();
verify(mockCallbacks).onBufferingUpdate(10L);

eventListener.onPlaybackStateChanged(Player.STATE_READY);
verify(mockCallbacks).onBufferingEnd();

verifyNoMoreInteractions(mockCallbacks);
}

@Test
public void onPlaybackStateChangedIdleDoNothing() {
eventListener.onPlaybackStateChanged(Player.STATE_IDLE);
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.8.5
version: 2.8.6

environment:
sdk: ^3.7.0
Expand Down