diff --git a/lib/src/video_player/method_channel_video_player.dart b/lib/src/video_player/method_channel_video_player.dart index a4066d5f0..cb5f7542b 100644 --- a/lib/src/video_player/method_channel_video_player.dart +++ b/lib/src/video_player/method_channel_video_player.dart @@ -217,11 +217,16 @@ class MethodChannelVideoPlayer extends VideoPlayerPlatform { ) ?? 0; + // Sometimes the media server returns a absolute position far greater than + // the datetime instance can handle. This caps the value to the maximum the datetime + // can use. + if (milliseconds > 8640000000000000 || milliseconds < -8640000000000000) return null; + if (milliseconds <= 0) return null; return DateTime.fromMillisecondsSinceEpoch(milliseconds); } - + @override Future enablePictureInPicture(int? textureId, double? top, double? left, double? width, double? height) async {