Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[video_player] fix Timer Leak #3119

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/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.11.1+1

* Fixed uncanceled timers when calling `play` on the controller multiple times before `pause`, which
caused value listeners to be called indefinitely (after `pause`) and more often than needed.

## 0.11.1

* Enable TLSv1.1 & TLSv1.2 for API 19 and below.
Expand Down
3 changes: 3 additions & 0 deletions packages/video_player/video_player/lib/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
}
if (value.isPlaying) {
await _videoPlayerPlatform.play(_textureId);

// Cancel previous timer.
_timer?.cancel();
_timer = Timer.periodic(
const Duration(milliseconds: 500),
(Timer timer) async {
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Flutter plugin for displaying inline video with other Flutter
# 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.11.1
version: 0.11.1+1
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player

flutter:
Expand Down