【发布时间】:2017-03-16 00:45:39
【问题描述】:
我想在 ios 中播放直播/流媒体视频。我正在尝试使用 AsyncDisplayKit,但没有播放视频。有没有这方面的图书馆?
DispatchQueue.global(qos: DispatchQoS.QoSClass.background).async(execute: {
if self.mainNode == nil {
self.mainNode = ASDisplayNode()
self.videoNode = ASVideoNode()
self.videoNode!.frame = CGRect(x: 0.0, y: 0.0, width: self.bounds.width, height: self.bounds.height)
self.videoNode!.gravity = AVLayerVideoGravityResizeAspectFill
self.videoNode!.shouldAutoplay = true
self.videoNode!.shouldAutorepeat = false
self.videoNode!.muted = false
self.videoNode.delegate = self
self.videoNode.isUserInteractionEnabled = true
self.videoNode!.placeholderEnabled = true
DispatchQueue.main.async(execute: {
self.mainNode!.addSubnode(self.videoNode!)
self.addSubview(self.mainNode!.view)
})
}
self.videoNode?.asset = AVAsset(url: self.url)
DispatchQueue.main.async(execute: {
self.videoNode?.placeholderImage()
})
})
【问题讨论】:
标签: ios swift video live-streaming