From b55f71a29d92543230d8ea948c1def1ab5478286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Chmiela?= Date: Thu, 28 Apr 2016 14:37:45 +0200 Subject: [PATCH] Add onPlaybackRateChange callback --- RCTVideo.m | 6 ++++++ RCTVideoManager.m | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RCTVideo.m b/RCTVideo.m index 14dbf5bc..446eef04 100644 --- a/RCTVideo.m +++ b/RCTVideo.m @@ -317,6 +317,12 @@ static NSString *const playbackRate = @"rate"; 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 { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } diff --git a/RCTVideoManager.m b/RCTVideoManager.m index e6d93670..2e69ea0c 100644 --- a/RCTVideoManager.m +++ b/RCTVideoManager.m @@ -29,7 +29,8 @@ RCT_EXPORT_MODULE(); @"onVideoFullscreenPlayerDidPresent", @"onVideoFullscreenPlayerWillDismiss", @"onVideoFullscreenPlayerDidDismiss", - @"onReadyForDisplay" + @"onReadyForDisplay", + @"onPlaybackRateChange" ]; }