From 0927cee27b014f064a6c390c6ab872365ff920ae Mon Sep 17 00:00:00 2001 From: Baris Sencan Date: Wed, 17 Jun 2015 22:08:01 -0700 Subject: [PATCH] Fix 'Invalid number value (NaN) in JSON write' crash --- RCTVideo.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/RCTVideo.m b/RCTVideo.m index 52486890..b6956ed3 100644 --- a/RCTVideo.m +++ b/RCTVideo.m @@ -96,9 +96,12 @@ static NSString *const statusKeyPath = @"status"; *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