jhomlala / betterplayer

Better video player for Flutter, with multiple configuration options. Solving typical use cases!
Apache License 2.0
895 stars 938 forks source link

Fix to cap very large position values #1206

Open RtypeStudios opened 1 year ago

RtypeStudios commented 1 year ago

We have seen in some situations when using nimble media server. The position values can come though as what looks like close to max int64 values such as 9223372036850115913

Which causes the following error when flutter tries to convert the value to a using DateTime.fromMillisecondsSinceEpoch().

RangeError (millisecondsSinceEpoch): Invalid value: Not in inclusive range -8640000000000000..8640000000000000: 9223372036850115913

Our guess is this only happens with streams that don't have an end (such as tv).

The below patch checks the value and accordingly returns null if the value for position exceeded what the datetime can handle.

This issue has been raised in the following two reports:

https://github.com/jhomlala/betterplayer/issues/1068 https://github.com/jhomlala/betterplayer/issues/884