From 4d33bb0f698ebe6ad7cd6ebf8c1ed5187d54efd8 Mon Sep 17 00:00:00 2001 From: Alma Madsen Date: Mon, 29 Aug 2016 12:48:36 -0700 Subject: [PATCH] prevent 'cover' resizeMode animation (#307) --- RCTVideo.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RCTVideo.m b/RCTVideo.m index 304e6537..6964bf34 100644 --- a/RCTVideo.m +++ b/RCTVideo.m @@ -580,6 +580,9 @@ static NSString *const playbackRate = @"rate"; if( _player ) { _playerViewController = [self createPlayerViewController:_player withPlayerItem:_playerItem]; + // to prevent video from being animated when resizeMode is 'cover' + // resize mode must be set before subview is added + [self setResizeMode:_resizeMode]; [self addSubview:_playerViewController.view]; } } @@ -592,6 +595,9 @@ static NSString *const playbackRate = @"rate"; _playerLayer.frame = self.bounds; _playerLayer.needsDisplayOnBoundsChange = YES; + // to prevent video from being animated when resizeMode is 'cover' + // resize mode must be set before layer is added + [self setResizeMode:_resizeMode]; [_playerLayer addObserver:self forKeyPath:readyForDisplayKeyPath options:NSKeyValueObservingOptionNew context:nil]; [self.layer addSublayer:_playerLayer];