From 153eb59c413f2930fb34cb1a5a8af3abbf0da1a1 Mon Sep 17 00:00:00 2001 From: David Peek Date: Fri, 10 Jul 2015 16:15:13 +0100 Subject: [PATCH] Call setRate instead of pause/play as they are equivalent (fixes #75) Video was resuming after seek when setRate was called after play/pause in applyModifiers. According to Apple's docs play/pause are equivalent to setRate:1.0 and setRate:0.0, meaning that if rate was 1.0 the video resumed after seeking completed. --- RCTVideo.m | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/RCTVideo.m b/RCTVideo.m index 73d3a361..2e7d4d61 100644 --- a/RCTVideo.m +++ b/RCTVideo.m @@ -297,12 +297,12 @@ static NSString *const statusKeyPath = @"status"; if (paused) { [self stopProgressTimer]; dispatch_async(dispatch_get_main_queue(), ^{ - [_player pause]; + [_player setRate:0.0]; }); } else { [self startProgressTimer]; dispatch_async(dispatch_get_main_queue(), ^{ - [_player play]; + [_player setRate:_rate]; }); } @@ -379,9 +379,6 @@ static NSString *const statusKeyPath = @"status"; [self setResizeMode:_resizeMode]; [self setRepeat:_repeat]; [self setPaused:_paused]; - dispatch_async(dispatch_get_main_queue(), ^{ - [_player setRate:_rate]; - }); } - (void)setRepeat:(BOOL)repeat {