Skip to content

Commit 041dcb3

Browse files
committed
clean up
1 parent aa9fbbd commit 041dcb3

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

packages/video_player/video_player/example/integration_test/video_player_test.dart

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,6 @@ void main() {
102102
},
103103
);
104104

105-
testWidgets(
106-
'can seek to end',
107-
(WidgetTester tester) async {
108-
await controller.initialize();
109-
110-
await controller.seekTo(controller.value.duration);
111-
112-
expect(controller.value.duration, controller.value.position);
113-
},
114-
);
115-
116105
testWidgets(
117106
'can be paused',
118107
(WidgetTester tester) async {

packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -422,20 +422,14 @@ - (int64_t)duration {
422422
- (void)seekTo:(int)location completionHandler:(void (^)(BOOL))completionHandler {
423423
CMTime locationCMT = CMTimeMake(location, 1000);
424424
CMTimeValue duration = _player.currentItem.asset.duration.value;
425-
CMTimeValue locationCM = locationCMT.value;
426-
if (duration == locationCM) {
427425
// Without adding tolerance when seeking to duration,
428426
// seekToTime will never complete, and this call will hang.
429-
[_player seekToTime:_player.currentItem.currentTime
430-
toleranceBefore:CMTimeMake(1, 1000)
431-
toleranceAfter:CMTimeMake(1, 1000)
427+
// see issue https://github.com/flutter/flutter/issues/124475.
428+
CMTime tolerance = location == duration ? CMTimeMake(1, 1000) : kCMTimeZero;
429+
[_player seekToTime:locationCMT
430+
toleranceBefore:tolerance
431+
toleranceAfter:tolerance
432432
completionHandler:completionHandler];
433-
return;
434-
}
435-
[_player seekToTime:locationCMT
436-
toleranceBefore:kCMTimeZero
437-
toleranceAfter:kCMTimeZero
438-
completionHandler:completionHandler];
439433
}
440434

441435
- (void)setIsLooping:(BOOL)isLooping {

0 commit comments

Comments
 (0)