class VideoCellNode: ASCellNode {
var videoNode: ASVideoNode!
init(video: Videos?) {
super.init()
backgroundColor = .white
videoNode = ASVideoNode()
if let video = video {
if let file = video.video_files.filter({$0.quality == "hd"}).first {
let asset = AVAsset(url: URL(string: file.link)!)
DispatchQueue.main.async {
self.videoNode.asset = asset
self.videoNode.shouldAutoplay = true
self.videoNode.muted = true
}
}
}
automaticallyManagesSubnodes = true
}
override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
let videoViewAbsolute = ASAbsoluteLayoutSpec(children: [videoNode])
return videoViewAbsolute
}
}
shouldAutoplay это свойство будет автоматически воспроизводить все videoNode в visibleRange
Мои вопросы:
Как я могу автоматически воспроизвести один ASVideoNode за раз?(например, Facebook.Youtube APP)
Или есть ли способ изменить видимый диапазон?