Fixed invalid usage of JS-like OR

This commit is contained in:
Johannes Lumpe 2015-05-11 09:54:58 +03:00 committed by Brent Vatne
parent 9c2184bd19
commit bcd48b7d21
2 changed files with 7 additions and 2 deletions

View File

@ -144,9 +144,14 @@ static NSString *const statusKeyPath = @"status";
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (object == _playerItem) {
if (_playerItem.status == AVPlayerItemStatusReadyToPlay) {
// NSLog(@"duration: %f",CMTimeGetSeconds(_playerItem.asset.duration));
float duration = CMTimeGetSeconds(_playerItem.asset.duration);
if (isnan(duration)) {
duration = 0.0;
}
[_eventDispatcher sendInputEventWithName:RNVideoEventLoaded body:@{
@"duration": [NSNumber numberWithFloat:(CMTimeGetSeconds(_playerItem.duration) || 0.0)],
@"duration": [NSNumber numberWithFloat:duration],
@"currentTime": [NSNumber numberWithFloat:CMTimeGetSeconds(_playerItem.currentTime)],
@"canPlayReverse": [NSNumber numberWithBool:_playerItem.canPlayReverse],
@"canPlayFastForward": [NSNumber numberWithBool:_playerItem.canPlayFastForward],