Skip to content

Commit

Permalink
add back removed code
Browse files Browse the repository at this point in the history
  • Loading branch information
mihailapuste committed Oct 5, 2023
1 parent a4b49b1 commit e976f78
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions ios/Video/Features/RCTPlayerObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,28 +193,29 @@ class RCTPlayerObserver: NSObject {
func attachPlayerEventListeners() {
guard let _handlers = _handlers else {return}

NotificationCenter.default.removeObserver(_handlers,
name:NSNotification.Name.AVPlayerItemDidPlayToEndTime,
object:player?.currentItem)
NotificationCenter.default.addObserver(_handlers,
selector:#selector(RCTPlayerObserverHandler.handlePlayerItemDidReachEnd(notification:)),
name:NSNotification.Name.AVPlayerItemDidPlayToEndTime,
object:player?.currentItem)

NotificationCenter.default.removeObserver(_handlers,
name:NSNotification.Name.AVPlayerItemPlaybackStalled,
object:nil)
NotificationCenter.default.addObserver(_handlers,
selector:#selector(RCTPlayerObserverHandler.handlePlaybackStalled(notification:)),
name:NSNotification.Name.AVPlayerItemPlaybackStalled,
object:nil)
NotificationCenter.default.removeObserver(_handlers,
name: NSNotification.Name.AVPlayerItemFailedToPlayToEndTime,
object:nil)
NotificationCenter.default.addObserver(_handlers,
selector:#selector(RCTPlayerObserverHandler.handleDidFailToFinishPlaying(notification:)),
name: NSNotification.Name.AVPlayerItemFailedToPlayToEndTime,
object:nil)
NotificationCenter.default.removeObserver(
_handlers,
name:NSNotification.Name.AVPlayerItemPlaybackStalled,
object:nil
)
NotificationCenter.default.addObserver(
_handlers,
selector:#selector(RCTPlayerObserverHandler.handlePlaybackStalled(notification:)),
name:NSNotification.Name.AVPlayerItemPlaybackStalled,
object:nil
)

NotificationCenter.default.removeObserver(
_handlers,
name: NSNotification.Name.AVPlayerItemFailedToPlayToEndTime,
object:nil
)
NotificationCenter.default.addObserver(
_handlers,
selector:#selector(RCTPlayerObserverHandler.handleDidFailToFinishPlaying(notification:)),
name: NSNotification.Name.AVPlayerItemFailedToPlayToEndTime,
object:nil
)
}

func clearPlayer() {
Expand Down

0 comments on commit e976f78

Please sign in to comment.