Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-11-26 01:24:00 +04:00
parent ffed0c5515
commit f6ba6d264c
3 changed files with 6 additions and 12 deletions

View File

@ -367,15 +367,7 @@ public final class MediaPlayerNode: ASDisplayNode {
} }
} }
public var captureProtected: Bool = false { public init(backgroundThread: Bool = false, captureProtected: Bool = false) {
didSet {
if #available(iOS 13.0, *) {
self.videoLayer?.preventsCapture = captureProtected
}
}
}
public init(backgroundThread: Bool = false) {
self.videoNode = MediaPlayerNodeDisplayNode() self.videoNode = MediaPlayerNodeDisplayNode()
if false && backgroundThread { if false && backgroundThread {
@ -406,7 +398,7 @@ public final class MediaPlayerNode: ASDisplayNode {
if let strongSelf = self { if let strongSelf = self {
strongSelf.videoLayer = videoLayer strongSelf.videoLayer = videoLayer
if #available(iOS 13.0, *) { if #available(iOS 13.0, *) {
videoLayer.preventsCapture = strongSelf.captureProtected videoLayer.preventsCapture = captureProtected
} }
strongSelf.updateLayout() strongSelf.updateLayout()

View File

@ -1573,6 +1573,9 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
imageView.contentMode = .scaleToFill imageView.contentMode = .scaleToFill
imageView.image = strongSelf.imageNode.image imageView.image = strongSelf.imageNode.image
imageView.frame = strongSelf.imageNode.frame imageView.frame = strongSelf.imageNode.frame
if imageView.layer.contents == nil {
imageView.layer.contents = imageView.image?.cgImage
}
strongSelf.imageNode.view.superview?.insertSubview(imageView, aboveSubview: strongSelf.imageNode.view) strongSelf.imageNode.view.superview?.insertSubview(imageView, aboveSubview: strongSelf.imageNode.view)
view = self?.view.snapshotContentTree(unhide: true) view = self?.view.snapshotContentTree(unhide: true)

View File

@ -172,8 +172,7 @@ private final class NativeVideoContentNode: ASDisplayNode, UniversalVideoContent
actionAtEndImpl?() actionAtEndImpl?()
}) })
} }
self.playerNode = MediaPlayerNode(backgroundThread: false) self.playerNode = MediaPlayerNode(backgroundThread: false, captureProtected: captureProtected)
self.playerNode.captureProtected = captureProtected
self.player.attachPlayerNode(self.playerNode) self.player.attachPlayerNode(self.playerNode)
self.dimensions = fileReference.media.dimensions?.cgSize self.dimensions = fileReference.media.dimensions?.cgSize