Experimental hls implementation

This commit is contained in:
Isaac
2024-09-27 20:27:11 +08:00
parent d70a0cf0e0
commit 69bb337f6f
20 changed files with 30578 additions and 319 deletions

View File

@@ -1141,7 +1141,7 @@ private final class StickerVideoDecoration: UniversalVideoDecoration {
private var contentNode: (ASDisplayNode & UniversalVideoContentNode)?
private var validLayoutSize: CGSize?
private var validLayout: (size: CGSize, actualSize: CGSize)?
public init() {
self.contentContainerNode = ASDisplayNode()
@@ -1161,9 +1161,9 @@ private final class StickerVideoDecoration: UniversalVideoDecoration {
if let contentNode = contentNode {
if contentNode.supernode !== self.contentContainerNode {
self.contentContainerNode.addSubnode(contentNode)
if let validLayoutSize = self.validLayoutSize {
contentNode.frame = CGRect(origin: CGPoint(), size: validLayoutSize)
contentNode.updateLayout(size: validLayoutSize, transition: .immediate)
if let validLayout = self.validLayout {
contentNode.frame = CGRect(origin: CGPoint(), size: validLayout.size)
contentNode.updateLayout(size: validLayout.size, actualSize: validLayout.actualSize, transition: .immediate)
}
}
}
@@ -1221,8 +1221,8 @@ private final class StickerVideoDecoration: UniversalVideoDecoration {
public func updateContentNodeSnapshot(_ snapshot: UIView?) {
}
public func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) {
self.validLayoutSize = size
public func updateLayout(size: CGSize, actualSize: CGSize, transition: ContainedViewLayoutTransition) {
self.validLayout = (size, actualSize)
let bounds = CGRect(origin: CGPoint(), size: size)
if let backgroundNode = self.backgroundNode {
@@ -1237,7 +1237,7 @@ private final class StickerVideoDecoration: UniversalVideoDecoration {
}
if let contentNode = self.contentNode {
transition.updateFrame(node: contentNode, frame: CGRect(origin: CGPoint(), size: size))
contentNode.updateLayout(size: size, transition: transition)
contentNode.updateLayout(size: size, actualSize: actualSize, transition: transition)
}
}