Skip to content

Commit

Permalink
Fix to cap very large position values
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Baron authored and ArkinSolomon committed Feb 21, 2024
1 parent f6a77cf commit a55fed5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/src/video_player/method_channel_video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> enablePictureInPicture(int? textureId, double? top, double? left,
double? width, double? height) async {
Expand Down

1 comment on commit a55fed5

@ArkinSolomon
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fix from jhomlala#1206

Please sign in to comment.