Commit cd405a39 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Fix remaining time display for live streams

(cherry picked from commit 712fbbcd)
parent c27bcb20
......@@ -1295,7 +1295,7 @@ static void HandleMediaPlayerSnapshot(const libvlc_event_t * event, void * self)
[self willChangeValueForKey:@"remainingTime"];
_cachedTime = [VLCTime timeWithNumber:newTime];
double currentTime = [[_cachedTime numberValue] doubleValue];
if (currentTime > 0) {
if (currentTime > 0 && _position > 0.) {
double remaining = currentTime / _position * (1 - _position);
_cachedRemainingTime = [VLCTime timeWithNumber:@(-remaining)];
} else
......
......@@ -79,7 +79,12 @@
- (NSString *)stringValue
{
if (_value) {
long long duration = [_value longLongValue] / 1000;
long long duration = [_value longLongValue];
if (duration == INT_MAX || duration == INT_MIN) {
// Return a string that represents an undefined time.
return @"--:--";
}
duration = duration / 1000;
long long positiveDuration = llabs(duration);
if (positiveDuration > 3600)
return [NSString stringWithFormat:@"%s%01ld:%02ld:%02ld",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment