diff --git a/packages/video_player/video_player_platform_interface/AUTHORS b/packages/video_player/video_player_platform_interface/AUTHORS index 493a0b4ef9c..fc16c35c4c2 100644 --- a/packages/video_player/video_player_platform_interface/AUTHORS +++ b/packages/video_player/video_player_platform_interface/AUTHORS @@ -64,3 +64,4 @@ Aleksandr Yurkovskiy Anton Borries Alex Li Rahul Raj <64.rahulraj@gmail.com> +Márton Matuz diff --git a/packages/video_player/video_player_platform_interface/CHANGELOG.md b/packages/video_player/video_player_platform_interface/CHANGELOG.md index 05e4201bb68..55b3f5cffde 100644 --- a/packages/video_player/video_player_platform_interface/CHANGELOG.md +++ b/packages/video_player/video_player_platform_interface/CHANGELOG.md @@ -1,6 +1,8 @@ -## NEXT +## 6.1.0 * Aligns Dart and Flutter SDK constraints. +* Adds the `VideoEventType.isPlayingStateUpdate` event to track changes in play / pause state with + the underlying video player. ## 6.0.2 diff --git a/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart b/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart index d3df9b25df5..32410660ce8 100644 --- a/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart +++ b/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart @@ -212,6 +212,7 @@ class VideoEvent { this.size, this.rotationCorrection, this.buffered, + this.isPlaying, }); /// The type of the event. @@ -237,6 +238,11 @@ class VideoEvent { /// Only used if [eventType] is [VideoEventType.bufferingUpdate]. final List? buffered; + /// Whether the video is currently playing. + /// + /// Only used if [eventType] is [VideoEventType.isPlayingStateUpdate]. + final bool? isPlaying; + @override bool operator ==(Object other) { return identical(this, other) || @@ -246,7 +252,8 @@ class VideoEvent { duration == other.duration && size == other.size && rotationCorrection == other.rotationCorrection && - listEquals(buffered, other.buffered); + listEquals(buffered, other.buffered) && + isPlaying == other.isPlaying; } @override @@ -256,13 +263,14 @@ class VideoEvent { size, rotationCorrection, buffered, + isPlaying, ); } /// Type of the event. /// /// Emitted by the platform implementation when the video is initialized or -/// completed or to communicate buffering events. +/// completed or to communicate buffering events or play state changed. enum VideoEventType { /// The video has been initialized. initialized, @@ -279,6 +287,12 @@ enum VideoEventType { /// The video stopped to buffer. bufferingEnd, + /// The playback state of the video has changed. + /// + /// This event is fired when the video starts or pauses due to user actions or + /// phone calls, or other app media such as music players. + isPlayingStateUpdate, + /// An unknown event has been received. unknown, } diff --git a/packages/video_player/video_player_platform_interface/pubspec.yaml b/packages/video_player/video_player_platform_interface/pubspec.yaml index c3ba6960cb8..7a49748e9da 100644 --- a/packages/video_player/video_player_platform_interface/pubspec.yaml +++ b/packages/video_player/video_player_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/video_player/ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 6.0.2 +version: 6.1.0 environment: sdk: ">=2.17.0 <3.0.0"