Unverified Commit 88f6e7d9 authored by Hampton Maxwell's avatar Hampton Maxwell Committed by GitHub
Browse files

Merge pull request #832 from jalieven/upstream

Preventing multiple observers for the same notification
parents cc823e3f 2ae99bd4
Loading
Loading
Loading
Loading
+7 −0
Changes for ios/RCTVideo.m: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -462,10 +462,17 @@ static NSString *const timedMetadata = @"timedMetadata";
- (void)attachListeners
{
  // listen for end of file
  [[NSNotificationCenter defaultCenter] removeObserver:self
                                                  name:AVPlayerItemDidPlayToEndTimeNotification
                                                object:[_player currentItem]];
  [[NSNotificationCenter defaultCenter] addObserver:self
                                           selector:@selector(playerItemDidReachEnd:)
                                               name:AVPlayerItemDidPlayToEndTimeNotification
                                             object:[_player currentItem]];

  [[NSNotificationCenter defaultCenter] removeObserver:self
                                                  name:AVPlayerItemPlaybackStalledNotification
                                                object:nil];
  [[NSNotificationCenter defaultCenter] addObserver:self
                                           selector:@selector(playbackStalled:)
                                               name:AVPlayerItemPlaybackStalledNotification