AnonymHK / betterplayer

Bug fix version for betterplayer
Apache License 2.0
42 stars 32 forks source link

Fix to cap very large position values #2

Closed RtypeStudios closed 1 year ago

RtypeStudios commented 1 year ago

Note: This is a copy of the PR I created for the original player.

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

RtypeStudios commented 1 year ago

Thanks!

AnonymHK commented 1 year ago

You're welcome, I also love this plugin. Let's maintain it together!