Fix memory leak

(cherry picked from commit c178023779ed24a143a00dc5e4ecbec06afa5982)
This commit is contained in:
Isaac 2025-02-13 18:51:54 +04:00
parent c6eb97db02
commit 5642fc6346

View File

@ -1952,17 +1952,17 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
videoNode.isUserInteractionEnabled = false
var firstTime = true
videoNode.ownsContentNodeUpdated = { [weak self] owns in
if let strongSelf = self {
if let strongSelf = self, let videoNode = strongSelf.videoNode {
if firstTime {
firstTime = false
if startFromSavedPosition, let videoTimestamp {
videoNode.seek(Double(videoTimestamp))
}
}
strongSelf.videoNode?.isHidden = !owns
videoNode.isHidden = !owns
if owns {
strongSelf.videoNode?.setBaseRate(1.0)
strongSelf.videoNode?.continuePlayingWithoutSound()
videoNode.setBaseRate(1.0)
videoNode.continuePlayingWithoutSound()
}
}
}