Add onPlaybackRateChange callback

This commit is contained in:
Stanisław Chmiela 2016-04-28 14:37:45 +02:00
parent f244f662b6
commit b55f71a29d
2 changed files with 8 additions and 1 deletions

View File

@ -317,6 +317,12 @@ static NSString *const playbackRate = @"rate";
body:@{@"target": self.reactTag}]; body:@{@"target": self.reactTag}];
} }
} }
} else if (object == _player) {
if([keyPath isEqualToString:playbackRate] && [change objectForKey:NSKeyValueChangeNewKey]) {
[_eventDispatcher sendInputEventWithName:@"onPlaybackRateChange"
body:@{@"playbackRate": _player.rate,
@"target": self.reactTag}];
}
} else { } else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
} }

View File

@ -29,7 +29,8 @@ RCT_EXPORT_MODULE();
@"onVideoFullscreenPlayerDidPresent", @"onVideoFullscreenPlayerDidPresent",
@"onVideoFullscreenPlayerWillDismiss", @"onVideoFullscreenPlayerWillDismiss",
@"onVideoFullscreenPlayerDidDismiss", @"onVideoFullscreenPlayerDidDismiss",
@"onReadyForDisplay" @"onReadyForDisplay",
@"onPlaybackRateChange"
]; ];
} }