Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
990decf
video_player Fix pause loop on completed
ToddZeil Jan 18, 2024
cccf9d3
video_player Fix pause infinite loop on completed (fix typo)
ToddZeil Jan 18, 2024
546e37f
Fix test calling twice when not needed
ToddZeil Jan 18, 2024
05d8479
Update version
ToddZeil Jan 18, 2024
3d71c14
Update changelog
ToddZeil Jan 18, 2024
5842263
Update changelog after review
ToddZeil Jan 18, 2024
d02d031
Fix logic after review
ToddZeil Jan 18, 2024
7de2626
Update broken test and add new test as requested
ToddZeil Jan 24, 2024
1abfd73
Merge branch 'main' into video_player_fix_pause_loop_on_completed
ToddZeil Feb 1, 2024
b65c9dc
Remove un needed test
ToddZeil Feb 14, 2024
47de4f9
Remove fix that could cause regression
ToddZeil Feb 14, 2024
5b54f4b
Update change logs and versions
ToddZeil Feb 14, 2024
0da37df
Don't seek if already at the position
ToddZeil Feb 14, 2024
5ea0689
Update packages/video_player/video_player_web/lib/src/video_player.dart
ToddZeil Feb 14, 2024
73077fd
Don't seek if already in the end position
ToddZeil Feb 14, 2024
b2b9748
Don't update video_player package
ToddZeil Feb 14, 2024
5a82692
Update comments and add private helper for milliseconds
ToddZeil Feb 14, 2024
c4a5c9d
Add extra comments, update function to a get
ToddZeil Feb 16, 2024
e9d6fbe
Remove changes to video_player
ToddZeil Feb 19, 2024
4f7466e
Merge branch 'main' into video_player_fix_pause_loop_on_completed
ToddZeil Feb 19, 2024
30162ec
Updates after review
ToddZeil Feb 20, 2024
af527eb
Update version and changelog
ToddZeil Feb 20, 2024
50ee253
Merge branch 'main' into video_player_fix_pause_loop_on_completed
ToddZeil Feb 20, 2024
dda2702
Update packages/video_player/video_player_web/lib/src/video_player.dart
ToddZeil Feb 20, 2024
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
4 changes: 4 additions & 0 deletions packages/video_player/video_player_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.2.1

* Fixes infinite pause loop caused by `seekTo` marking the video as completed when already completed.

## 2.2.0

* Updates SDK version to Dart `^3.3.0`. Flutter `^3.19.0`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,33 @@ class VideoPlayer {
/// Moves the playback head to a new `position`.
///
/// `position` cannot be negative.
///
/// Does nothing if the new position is the same as the current position.
void seekTo(Duration position) {
assert(!position.isNegative);
// Don't seek if video is already at target position.
//
// This is needed because the core plugin will pause and seek to the end of
// the video when it finishes, and that causes an infinite loop of `ended`
// events on the web.
//
// See: https://github.com/flutter/flutter/issues/77674
if (position.inMilliseconds == _videoCurrentTimeInMilliseconds) {
return;
}

_videoElement.currentTime = position.inMilliseconds.toDouble() / 1000;
}

/// Returns the current playback head position as a [Duration].
Duration getPosition() {
_sendBufferingRangesUpdate();
return Duration(milliseconds: (_videoElement.currentTime * 1000).round());
return Duration(milliseconds: _videoCurrentTimeInMilliseconds);
}

int get _videoCurrentTimeInMilliseconds =>
(_videoElement.currentTime * 1000).round();

/// Sets options
Future<void> setOptions(VideoPlayerWebOptions options) async {
// In case this method is called multiple times, reset options.
Expand Down
3 changes: 2 additions & 1 deletion packages/video_player/video_player_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: video_player_web
description: Web platform implementation of video_player.
repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
version: 2.2.0

version: 2.2.1

environment:
sdk: ^3.3.0
Expand Down