Last active
February 12, 2019 00:55
-
-
Save GeekTree0101/d17460c1fff9cc606e9791d0c36ef76e to your computer and use it in GitHub Desktop.
Answer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DisplayNode: ASCellNode { | |
lazy var videoNode: ASVideoNode = { | |
let node = ASVideoNode() | |
node.backgroundColor = UIColor.gray | |
node.shouldAutoplay = true | |
node.shouldAutorepeat = true | |
node.muted = true | |
return videoNode | |
} | |
override init() { | |
super.init() | |
self.automaticallyManagesSubnodes = true | |
guard let url = URL(string: "https://www.radiantmediaplayer.com/media/bbb-360p.mp4") else { return } | |
let asset = AVAsset(url: url) | |
self.videoNode.asset = asset | |
} | |
override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { | |
return ASInsetLayoutSpec(insets: .zero, child: videoNode) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment