Explorar el Código

VLCMediaPlayer: fix remaining time if current time is 0

Felix Paul Kühne hace 11 años
padre
commit
da0e1e9bef
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      Sources/VLCMediaPlayer.m

+ 5 - 2
Sources/VLCMediaPlayer.m

@@ -1040,8 +1040,11 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
     _cachedTime = [[VLCTime timeWithNumber:newTime] retain];
     [_cachedRemainingTime release];
     double currentTime = [[_cachedTime numberValue] doubleValue];
-    double remaining = currentTime / _position * (1 - _position);
-    _cachedRemainingTime = [[VLCTime timeWithNumber:@(-remaining)] retain];
+    if (currentTime > 0) {
+        double remaining = currentTime / _position * (1 - _position);
+        _cachedRemainingTime = [[VLCTime timeWithNumber:@(-remaining)] retain];
+    } else
+        _cachedRemainingTime = [[VLCTime nullTime] retain];
     [self didChangeValueForKey:@"remainingTime"];
     [self didChangeValueForKey:@"time"];
 }