From 5408fafff8c97e314e6b7055b85bf0b543de258d Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Mon, 30 Mar 2015 23:29:15 -0700 Subject: [PATCH] Add support for `repeat` prop --- RCTVideo.m | 10 +++++++++- RCTVideoManager.m | 1 + README.md | 7 ++++--- Video.ios.js | 3 ++- package.json | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/RCTVideo.m b/RCTVideo.m index 0e23da0f..f211f4e3 100644 --- a/RCTVideo.m +++ b/RCTVideo.m @@ -23,7 +23,6 @@ [_player setContentURL:videoURL]; [_player setControlStyle:MPMovieControlStyleNone]; [_player setScalingMode:MPMovieScalingModeNone]; - [_player setRepeatMode:MPMovieRepeatModeOne]; [_player prepareToPlay]; [_player play]; } @@ -33,6 +32,15 @@ [_player setScalingMode:mode]; } +- (void)setRepeat:(BOOL)repeat +{ + if (repeat) { + [_player setRepeatMode:MPMovieRepeatModeOne]; + } else { + [_player setRepeatMode:MPMovieRepeatModeNone]; + } +} + - (NSArray *)reactSubviews { NSArray *subviews = @[_player.view]; diff --git a/RCTVideoManager.m b/RCTVideoManager.m index 86f7d849..08acd0fc 100644 --- a/RCTVideoManager.m +++ b/RCTVideoManager.m @@ -14,6 +14,7 @@ RCT_EXPORT_VIEW_PROPERTY(src, NSString); RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSInteger); +RCT_EXPORT_VIEW_PROPERTY(repeat, BOOL); - (NSDictionary *)constantsToExport { diff --git a/README.md b/README.md index 20102b52..cbb7663e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ A