Loading RCTVideo.m +18 −0 Changes for RCTVideo.m: 18 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ NSString *const RNVideoEventLoading = @"videoLoading"; NSString *const RNVideoEventProgress = @"videoProgress"; NSString *const RNVideoEventSeek = @"videoSeek"; NSString *const RNVideoEventLoadingError = @"videoLoadError"; NSString *const RNVideoEventEnd = @"videoEnd"; static NSString *const statusKeyPath = @"status"; Loading Loading @@ -84,6 +85,12 @@ static NSString *const statusKeyPath = @"status"; [_progressUpdateTimer addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; } - (void)notifyEnd: (NSNotification *)notification { [_eventDispatcher sendInputEventWithName:RNVideoEventEnd body:@{ @"target": self.reactTag }]; } #pragma mark - Player and source - (void)setSrc:(NSDictionary *)source { Loading Loading @@ -149,6 +156,7 @@ static NSString *const statusKeyPath = @"status"; }]; [self startProgressTimer]; [self attachListeners]; [_player play]; [self applyModifiers]; } else if(_playerItem.status == AVPlayerItemStatusFailed) { Loading @@ -165,6 +173,16 @@ static NSString *const statusKeyPath = @"status"; } } - (void)attachListeners { // listen for end of file [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notifyEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:[_player currentItem]]; } - (void)playerItemDidReachEnd:(NSNotification *)notification { AVPlayerItem *item = [notification object]; [item seekToTime:kCMTimeZero]; Loading Loading
RCTVideo.m +18 −0 Changes for RCTVideo.m: 18 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ NSString *const RNVideoEventLoading = @"videoLoading"; NSString *const RNVideoEventProgress = @"videoProgress"; NSString *const RNVideoEventSeek = @"videoSeek"; NSString *const RNVideoEventLoadingError = @"videoLoadError"; NSString *const RNVideoEventEnd = @"videoEnd"; static NSString *const statusKeyPath = @"status"; Loading Loading @@ -84,6 +85,12 @@ static NSString *const statusKeyPath = @"status"; [_progressUpdateTimer addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; } - (void)notifyEnd: (NSNotification *)notification { [_eventDispatcher sendInputEventWithName:RNVideoEventEnd body:@{ @"target": self.reactTag }]; } #pragma mark - Player and source - (void)setSrc:(NSDictionary *)source { Loading Loading @@ -149,6 +156,7 @@ static NSString *const statusKeyPath = @"status"; }]; [self startProgressTimer]; [self attachListeners]; [_player play]; [self applyModifiers]; } else if(_playerItem.status == AVPlayerItemStatusFailed) { Loading @@ -165,6 +173,16 @@ static NSString *const statusKeyPath = @"status"; } } - (void)attachListeners { // listen for end of file [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notifyEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:[_player currentItem]]; } - (void)playerItemDidReachEnd:(NSNotification *)notification { AVPlayerItem *item = [notification object]; [item seekToTime:kCMTimeZero]; Loading