Merge pull request #832 from jalieven/upstream
Preventing multiple observers for the same notification
This commit is contained in:
commit
88f6e7d9ac
@ -462,10 +462,17 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
- (void)attachListeners
|
- (void)attachListeners
|
||||||
{
|
{
|
||||||
// listen for end of file
|
// listen for end of file
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||||
|
name:AVPlayerItemDidPlayToEndTimeNotification
|
||||||
|
object:[_player currentItem]];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(playerItemDidReachEnd:)
|
selector:@selector(playerItemDidReachEnd:)
|
||||||
name:AVPlayerItemDidPlayToEndTimeNotification
|
name:AVPlayerItemDidPlayToEndTimeNotification
|
||||||
object:[_player currentItem]];
|
object:[_player currentItem]];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||||
|
name:AVPlayerItemPlaybackStalledNotification
|
||||||
|
object:nil];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(playbackStalled:)
|
selector:@selector(playbackStalled:)
|
||||||
name:AVPlayerItemPlaybackStalledNotification
|
name:AVPlayerItemPlaybackStalledNotification
|
||||||
|
Loading…
Reference in New Issue
Block a user