Thanks to visit codestin.com
Credit goes to github.com

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

[video_player] Duration fix #4671

Closed
Closed
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
4 changes: 4 additions & 0 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.2.12

* Fixes incorrect video duration for iOS

## 2.2.11

* Removes dependency on `meta`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,14 @@ - (int64_t)position {
}

- (int64_t)duration {
return FLTCMTimeToMillis([[_player currentItem] duration]);
// [[_player currentItem] duration] initially can return incorrect value kCMTimeIndefinite.
// In this case [self duration] returns TIME_UNSET, which breaks existing [self setupEventSinkIfReadyToPlay] logic.
// Bug is highly reproducible with iOS 12.
//
// [[[_player currentItem] asset] duration] fixes this issue.
// Also works correctly with live streams, which have kCMTimeIndefinite duration.
// Related issue https://openradar.appspot.com/radar?id=4968600712511488
return FLTCMTimeToMillis([[[_player currentItem] asset] duration]);
}

- (void)seekTo:(int)location {
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 @@ -3,7 +3,7 @@ description: Flutter plugin for displaying inline video with other Flutter
widgets on Android, iOS, and web.
repository: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
version: 2.2.11
version: 2.2.12

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down