Skip to content
Open
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
1 change: 1 addition & 0 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## NEXT

* Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.
* Add new `VideoEventType` type `durationUpdate`

## 2.10.0

Expand Down
4 changes: 4 additions & 0 deletions packages/video_player/video_player/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ flutter:
- assets/bumble_bee_captions.srt
- assets/bumble_bee_captions.vtt
- assets/Audio.mp3
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
video_player_platform_interface: {path: ../../../../packages/video_player/video_player_platform_interface}
2 changes: 2 additions & 0 deletions packages/video_player/video_player/lib/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
value = value.copyWith(isCompleted: true);
case VideoEventType.bufferingUpdate:
value = value.copyWith(buffered: event.buffered);
case VideoEventType.durationUpdate:
value = value.copyWith(duration: event.duration);
case VideoEventType.bufferingStart:
value = value.copyWith(isBuffering: true);
case VideoEventType.bufferingEnd:
Expand Down
4 changes: 4 additions & 0 deletions packages/video_player/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ dev_dependencies:
topics:
- video
- video-player
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
video_player_platform_interface: {path: ../../../packages/video_player/video_player_platform_interface}
24 changes: 24 additions & 0 deletions packages/video_player/video_player/test/video_player_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,30 @@ void main() {
expect(controller.value.isBuffering, isFalse);
await tester.runAsync(controller.dispose);
});

testWidgets('duration update', (WidgetTester tester) async {
final VideoPlayerController controller =
VideoPlayerController.networkUrl(_localhostUri);

await controller.initialize();
const Duration initDuration = Duration(milliseconds: 100);
controller.value = controller.value.copyWith(duration: initDuration);

final StreamController<VideoEvent> fakeVideoEventStream =
fakeVideoPlayerPlatform.streams[controller.playerId]!;

const Duration updatedDuration = Duration(milliseconds: 200);
fakeVideoEventStream.add(
VideoEvent(
eventType: VideoEventType.durationUpdate,
duration: updatedDuration,
),
);

await tester.pumpAndSettle();
expect(controller.value.duration, updatedDuration);
await tester.runAsync(controller.dispose);
});
});
});

Expand Down
4 changes: 4 additions & 0 deletions packages/video_player/video_player_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## NEXT

* Add new `VideoEventType` type `durationUpdate`

## 2.8.17

* Moves video event processing logic to Dart, and fixes an issue where buffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ class MiniController extends ValueNotifier<VideoPlayerValue> {
value = value.copyWith(isBuffering: false);
case VideoEventType.isPlayingStateUpdate:
value = value.copyWith(isPlaying: event.isPlaying);
case VideoEventType.durationUpdate:
value = value.copyWith(duration: event.duration);
case VideoEventType.unknown:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ flutter:
assets:
- assets/flutter-mark-square-64.png
- assets/Butterfly-209.mp4
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
video_player_platform_interface: {path: ../../../../packages/video_player/video_player_platform_interface}
4 changes: 4 additions & 0 deletions packages/video_player/video_player_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ dev_dependencies:
topics:
- video
- video-player
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
video_player_platform_interface: {path: ../../../packages/video_player/video_player_platform_interface}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## NEXT

* Add new `VideoEventType` type `durationUpdate`

## 2.8.5

* Updates minimum supported version to iOS 13 and macOS 10.15.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ class MiniController extends ValueNotifier<VideoPlayerValue> {
value = value.copyWith(isBuffering: false);
case VideoEventType.isPlayingStateUpdate:
value = value.copyWith(isPlaying: event.isPlaying);
case VideoEventType.durationUpdate:
value = value.copyWith(duration: event.duration);
case VideoEventType.unknown:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ flutter:
assets:
- assets/flutter-mark-square-64.png
- assets/Butterfly-209.mp4
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
video_player_platform_interface: {path: ../../../../packages/video_player/video_player_platform_interface}
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ dev_dependencies:
topics:
- video
- video-player
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
video_player_platform_interface: {path: ../../../packages/video_player/video_player_platform_interface}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## NEXT

* Add new `VideoEventType` type `durationUpdate`

## 6.6.0

* Adds `VideoAudioTrack` class and `getAudioTracks()`, `selectAudioTrack()`, `isAudioTrackSupportAvailable()` methods for audio track management.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ enum VideoEventType {
/// The video stopped to buffer.
bufferingEnd,

/// The video duration has updated.
durationUpdate,

/// The playback state of the video has changed.
///
/// This event is fired when the video starts or pauses due to user actions or
Expand Down
4 changes: 4 additions & 0 deletions packages/video_player/video_player_web/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ dev_dependencies:
sdk: flutter
integration_test:
sdk: flutter
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
video_player_platform_interface: {path: ../../../../packages/video_player/video_player_platform_interface}
4 changes: 4 additions & 0 deletions packages/video_player/video_player_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ dev_dependencies:
topics:
- video
- video-player
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
video_player_platform_interface: {path: ../../../packages/video_player/video_player_platform_interface}