Skip to content

Commit 855f502

Browse files
authored
[video_player_platform_interface] synchronize isPlaying state (flutter#3361)
[video_player_platform_interface] synchronize isPlaying state
1 parent 55515f6 commit 855f502

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

packages/video_player/video_player_platform_interface/AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ Aleksandr Yurkovskiy <[email protected]>
6464
Anton Borries <[email protected]>
6565
6666
Rahul Raj <[email protected]>
67+
Márton Matuz <[email protected]>

packages/video_player/video_player_platform_interface/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
## NEXT
1+
## 6.1.0
22

33
* Aligns Dart and Flutter SDK constraints.
4+
* Adds the `VideoEventType.isPlayingStateUpdate` event to track changes in play / pause state with
5+
the underlying video player.
46

57
## 6.0.2
68

packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ class VideoEvent {
212212
this.size,
213213
this.rotationCorrection,
214214
this.buffered,
215+
this.isPlaying,
215216
});
216217

217218
/// The type of the event.
@@ -237,6 +238,11 @@ class VideoEvent {
237238
/// Only used if [eventType] is [VideoEventType.bufferingUpdate].
238239
final List<DurationRange>? buffered;
239240

241+
/// Whether the video is currently playing.
242+
///
243+
/// Only used if [eventType] is [VideoEventType.isPlayingStateUpdate].
244+
final bool? isPlaying;
245+
240246
@override
241247
bool operator ==(Object other) {
242248
return identical(this, other) ||
@@ -246,7 +252,8 @@ class VideoEvent {
246252
duration == other.duration &&
247253
size == other.size &&
248254
rotationCorrection == other.rotationCorrection &&
249-
listEquals(buffered, other.buffered);
255+
listEquals(buffered, other.buffered) &&
256+
isPlaying == other.isPlaying;
250257
}
251258

252259
@override
@@ -256,13 +263,14 @@ class VideoEvent {
256263
size,
257264
rotationCorrection,
258265
buffered,
266+
isPlaying,
259267
);
260268
}
261269

262270
/// Type of the event.
263271
///
264272
/// Emitted by the platform implementation when the video is initialized or
265-
/// completed or to communicate buffering events.
273+
/// completed or to communicate buffering events or play state changed.
266274
enum VideoEventType {
267275
/// The video has been initialized.
268276
initialized,
@@ -279,6 +287,12 @@ enum VideoEventType {
279287
/// The video stopped to buffer.
280288
bufferingEnd,
281289

290+
/// The playback state of the video has changed.
291+
///
292+
/// This event is fired when the video starts or pauses due to user actions or
293+
/// phone calls, or other app media such as music players.
294+
isPlayingStateUpdate,
295+
282296
/// An unknown event has been received.
283297
unknown,
284298
}

packages/video_player/video_player_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/video_player/
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 6.0.2
7+
version: 6.1.0
88

99
environment:
1010
sdk: ">=2.17.0 <3.0.0"

0 commit comments

Comments
 (0)