Skip to content

Commit

Permalink
code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMoch committed Jan 4, 2024
1 parent a7cb41c commit 088949e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ios/Video/Features/RCTPlayerObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RCTPlayerObserver: NSObject, AVPlayerItemMetadataOutputPushDelegate {
removePlayerItemObservers()
}
didSet {
guard let playerItem = playerItem else { return }
guard let playerItem else { return }

addPlayerItemObservers()

Expand Down Expand Up @@ -110,7 +110,7 @@ class RCTPlayerObserver: NSObject, AVPlayerItemMetadataOutputPushDelegate {
}

func addPlayerObservers() {
guard let player = player, let _handlers = _handlers else {
guard let player, let _handlers else {
return
}

Expand All @@ -125,7 +125,7 @@ class RCTPlayerObserver: NSObject, AVPlayerItemMetadataOutputPushDelegate {
}

func addPlayerItemObservers() {
guard let playerItem = playerItem, let _handlers = _handlers else { return }
guard let playerItem, let _handlers else { return }
_playerItemStatusObserver = playerItem.observe(\.status, options: [.new, .old], changeHandler: _handlers.handlePlayerItemStatusChange)
_playerPlaybackBufferEmptyObserver = playerItem.observe(
\.isPlaybackBufferEmpty,
Expand All @@ -147,7 +147,7 @@ class RCTPlayerObserver: NSObject, AVPlayerItemMetadataOutputPushDelegate {
}

func addPlayerViewControllerObservers() {
guard let playerViewController = playerViewController, let _handlers = _handlers else { return }
guard let playerViewController, let _handlers else { return }

_playerViewControllerReadyForDisplayObserver = playerViewController.observe(
\.isReadyForDisplay,
Expand All @@ -168,7 +168,7 @@ class RCTPlayerObserver: NSObject, AVPlayerItemMetadataOutputPushDelegate {
}

func addPlayerLayerObserver() {
guard let _handlers = _handlers else { return }
guard let _handlers else { return }
_playerLayerReadyForDisplayObserver = playerLayer?.observe(\.isReadyForDisplay, options: [.new], changeHandler: _handlers.handleReadyForDisplay)
}

Expand All @@ -177,7 +177,7 @@ class RCTPlayerObserver: NSObject, AVPlayerItemMetadataOutputPushDelegate {
}

func addPlayerTimeObserver() {
guard let _handlers = _handlers else { return }
guard let _handlers else { return }
removePlayerTimeObserver()
let progressUpdateIntervalMS: Float64 = _progressUpdateInterval / 1000
// @see endScrubbing in AVPlayerDemoPlaybackViewController.m
Expand Down Expand Up @@ -213,7 +213,7 @@ class RCTPlayerObserver: NSObject, AVPlayerItemMetadataOutputPushDelegate {
}

func attachPlayerEventListeners() {
guard let _handlers = _handlers else { return }
guard let _handlers else { return }
NotificationCenter.default.removeObserver(_handlers,
name: NSNotification.Name.AVPlayerItemDidPlayToEndTime,
object: player?.currentItem)
Expand Down Expand Up @@ -252,7 +252,7 @@ class RCTPlayerObserver: NSObject, AVPlayerItemMetadataOutputPushDelegate {
func clearPlayer() {
player = nil
playerItem = nil
if let _handlers = _handlers {
if let _handlers {
NotificationCenter.default.removeObserver(_handlers)
}
}
Expand Down

0 comments on commit 088949e

Please sign in to comment.