Skip to content

Commit

Permalink
fix(ios): fix pip memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMoch committed Jan 29, 2024
1 parent 2094dbd commit 850a4e6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ios/Video/RCTVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,14 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
_eventDispatcher = eventDispatcher

#if os(iOS)
_pip = RCTPictureInPicture(self._onPictureInPictureStatusChanged, self._onRestoreUserInterfaceForPictureInPictureStop)
_pip = RCTPictureInPicture(
{ [weak self] in

Check failure on line 144 in ios/Video/RCTVideo.swift

View workflow job for this annotation

GitHub Actions / Swift-Lint

Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration (opening_brace)
self?._onPictureInPictureStatusChanged()
},
{ [weak self] in

Check failure on line 147 in ios/Video/RCTVideo.swift

View workflow job for this annotation

GitHub Actions / Swift-Lint

Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration (opening_brace)
self?._onRestoreUserInterfaceForPictureInPictureStop()
}
)
#endif

NotificationCenter.default.addObserver(
Expand Down Expand Up @@ -193,6 +200,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
deinit {
NotificationCenter.default.removeObserver(self)
self.removePlayerLayer()
_pip = nil
_playerObserver.clearPlayer()
}

Expand Down

0 comments on commit 850a4e6

Please sign in to comment.