Skip to content

Commit

Permalink
Fixed invalid usage of JS-like OR
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneslumpe committed May 11, 2015
1 parent 1cbe182 commit 9900a9c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion RCTVideo.m
Expand Up @@ -135,8 +135,14 @@ - (AVPlayerItem*)playerItemForSource:(NSDictionary *)source {
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (object == _playerItem) {
if (_playerItem.status == AVPlayerItemStatusReadyToPlay) {
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],
Expand Down

0 comments on commit 9900a9c

Please sign in to comment.