diff --git a/RCTVideo.m b/RCTVideo.m index 3c0fa291..5cf83d27 100644 --- a/RCTVideo.m +++ b/RCTVideo.m @@ -263,6 +263,13 @@ static NSString *const playbackBufferEmptyKeyPath = @"playbackBufferEmpty"; if (isnan(duration)) { duration = 0.0; } + + NSObject *width = @"undefined"; + NSObject *height = @"undefined"; + if ([_playerItem.asset tracksWithMediaType:AVMediaTypeVideo].count > 0) { + width = [NSNumber numberWithFloat:[_playerItem.asset tracksWithMediaType:AVMediaTypeVideo][0].naturalSize.width]; + height = [NSNumber numberWithFloat:[_playerItem.asset tracksWithMediaType:AVMediaTypeVideo][0].naturalSize.height]; + } [_eventDispatcher sendInputEventWithName:@"onVideoLoad" body:@{@"duration": [NSNumber numberWithFloat:duration], @@ -273,6 +280,10 @@ static NSString *const playbackBufferEmptyKeyPath = @"playbackBufferEmpty"; @"canPlaySlowReverse": [NSNumber numberWithBool:_playerItem.canPlaySlowReverse], @"canStepBackward": [NSNumber numberWithBool:_playerItem.canStepBackward], @"canStepForward": [NSNumber numberWithBool:_playerItem.canStepForward], + @"naturalSize": @{ + @"width": width, + @"height": height + }, @"target": self.reactTag}]; [self attachListeners];