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

[video_player]fix video play() not update VideoPlayerValue when isInitialized is false #4295

Closed
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
7 changes: 6 additions & 1 deletion packages/video_player/video_player/lib/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,12 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
} else if (position < const Duration()) {
position = const Duration();
}
await _videoPlayerPlatform.seekTo(_textureId, position);

try {
await _videoPlayerPlatform.seekTo(_textureId, position);
} catch (e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silently discarding all exceptions is not a fix, it's hiding the problem—and a variety of other possible problems as well, which is not okay.

seekTo isn't doing the same up-front isInitialized check that other methods are doing, which seems like the actual bug here. It looks like this flow throwing is a regression from #3727 (@cc @KyleFin)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @stuartmorgan! Yes, this issue was mentioned in #3727 (comment). @jerryzhoujw let me know if there's anything I can do to help. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this change I believe you could just change line 397 to be
if (value.position == value.duration && value.isInitialized) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close this since #4300 much better.

//
}
_updatePosition(position);
}

Expand Down