Merge pull request #56 from isair/fix/playable-duration-edge-cases

Fix 'Invalid number value (NaN) in JSON write' crash
This commit is contained in:
Brent Vatne 2015-06-17 22:24:37 -07:00
commit bd755d88c4

View File

@ -96,9 +96,12 @@ static NSString *const statusKeyPath = @"status";
*stop = YES; *stop = YES;
} }
}]; }];
return [NSNumber numberWithFloat:CMTimeGetSeconds(CMTimeRangeGetEnd(effectiveTimeRange))]; Float64 playableDuration = CMTimeGetSeconds(CMTimeRangeGetEnd(effectiveTimeRange));
if (playableDuration > 0) {
return [NSNumber numberWithFloat:playableDuration];
} }
return [NSNumber numberWithFloat:CMTimeGetSeconds(kCMTimeInvalid)]; }
return [NSNumber numberWithInteger:0];
} }
- (void)stopProgressTimer - (void)stopProgressTimer