fix(ios): Implicit use of 'self' in closure - use 'self.' to make capture semantics explicit (#3764) (#3881)
* Fix/ensure view drop stop playback startup (#3875) * fix: ensure player doesn't start when view is unmounted * Patch commit to fix the error: Implicit use of 'self' in closure; use 'self.' to make capture semantics explicit --------- Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com>
This commit is contained in:
parent
ff1e24aaad
commit
ac0a9c3e3a
@ -150,7 +150,7 @@ class NowPlayingInfoCenterManager {
|
|||||||
guard let self, let player = self.currentPlayer else {
|
guard let self, let player = self.currentPlayer else {
|
||||||
return .commandFailed
|
return .commandFailed
|
||||||
}
|
}
|
||||||
let newTime = player.currentTime() - CMTime(seconds: SEEK_INTERVAL_SECONDS, preferredTimescale: .max)
|
let newTime = player.currentTime() - CMTime(seconds: self.SEEK_INTERVAL_SECONDS, preferredTimescale: .max)
|
||||||
player.seek(to: newTime)
|
player.seek(to: newTime)
|
||||||
return .success
|
return .success
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ class NowPlayingInfoCenterManager {
|
|||||||
return .commandFailed
|
return .commandFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
let newTime = player.currentTime() + CMTime(seconds: SEEK_INTERVAL_SECONDS, preferredTimescale: .max)
|
let newTime = player.currentTime() + CMTime(seconds: self.SEEK_INTERVAL_SECONDS, preferredTimescale: .max)
|
||||||
player.seek(to: newTime)
|
player.seek(to: newTime)
|
||||||
return .success
|
return .success
|
||||||
}
|
}
|
||||||
@ -266,15 +266,15 @@ class NowPlayingInfoCenterManager {
|
|||||||
|
|
||||||
// case where there is new player that is not paused
|
// case where there is new player that is not paused
|
||||||
// In this case event is triggered by non currentPlayer
|
// In this case event is triggered by non currentPlayer
|
||||||
if rate != 0 && currentPlayer != player {
|
if rate != 0 && self.currentPlayer != player {
|
||||||
setCurrentPlayer(player: player)
|
self.setCurrentPlayer(player: player)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// case where currentPlayer was paused
|
// case where currentPlayer was paused
|
||||||
// In this case event is triggeret by currentPlayer
|
// In this case event is triggeret by currentPlayer
|
||||||
if rate == 0 && currentPlayer == player {
|
if rate == 0 && self.currentPlayer == player {
|
||||||
findNewCurrentPlayer()
|
self.findNewCurrentPlayer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
|||||||
guard let self else { throw NSError(domain: "", code: 0, userInfo: nil) }
|
guard let self else { throw NSError(domain: "", code: 0, userInfo: nil) }
|
||||||
|
|
||||||
let playerItem = try await self.preparePlayerItem()
|
let playerItem = try await self.preparePlayerItem()
|
||||||
try await setupPlayer(playerItem: playerItem)
|
try await self.setupPlayer(playerItem: playerItem)
|
||||||
} catch {
|
} catch {
|
||||||
DebugLog("An error occurred: \(error.localizedDescription)")
|
DebugLog("An error occurred: \(error.localizedDescription)")
|
||||||
|
|
||||||
@ -763,7 +763,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
|||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
self._playerObserver.addTimeObserverIfNotSet()
|
self._playerObserver.addTimeObserverIfNotSet()
|
||||||
self.setPaused(_paused)
|
self.setPaused(self._paused)
|
||||||
self.onVideoSeek?(["currentTime": NSNumber(value: Float(CMTimeGetSeconds(item.currentTime()))),
|
self.onVideoSeek?(["currentTime": NSNumber(value: Float(CMTimeGetSeconds(item.currentTime()))),
|
||||||
"seekTime": seekTime,
|
"seekTime": seekTime,
|
||||||
"target": self.reactTag])
|
"target": self.reactTag])
|
||||||
|
@ -21,7 +21,7 @@ class RCTVideoManager: RCTViewManager {
|
|||||||
let view = self.bridge.uiManager.view(forReactTag: reactTag)
|
let view = self.bridge.uiManager.view(forReactTag: reactTag)
|
||||||
|
|
||||||
guard let videoView = view as? RCTVideo else {
|
guard let videoView = view as? RCTVideo else {
|
||||||
DebugLog("Invalid view returned from registry, expecting RCTVideo, got: \(String(describing: view))")
|
DebugLog("Invalid view returned from registry, expecting RCTVideo, got: \(String(describing: self.view))")
|
||||||
callback(nil)
|
callback(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user