Skip to content

Commit 6ece587

Browse files
creativecreatorormaybenotEgor
authored and
Egor
committed
[video_player] fix Timer Leak (flutter#3119)
1 parent 7d115a3 commit 6ece587

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

packages/video_player/video_player/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.11.1+1
2+
3+
* Fixed uncanceled timers when calling `play` on the controller multiple times before `pause`, which
4+
caused value listeners to be called indefinitely (after `pause`) and more often than needed.
5+
16
## 0.11.1
27

38
* Enable TLSv1.1 & TLSv1.2 for API 19 and below.

packages/video_player/video_player/lib/video_player.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
391391
}
392392
if (value.isPlaying) {
393393
await _videoPlayerPlatform.play(_textureId);
394+
395+
// Cancel previous timer.
396+
_timer?.cancel();
394397
_timer = Timer.periodic(
395398
const Duration(milliseconds: 500),
396399
(Timer timer) async {

packages/video_player/video_player/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Flutter plugin for displaying inline video with other Flutter
44
# 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump
55
# the version to 2.0.0.
66
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
7-
version: 0.11.1
7+
version: 0.11.1+1
88
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player
99

1010
flutter:

0 commit comments

Comments
 (0)