基本上,SKVideoNode不会尊重AVPlayer的费率。
默认情况下,SKVideoNode无法控制播放速率。但是,可以使用AVPlayer (其本身包含一个AVPlayerItem)来初始化SKVideoNode。该AVPlayer的属性速率可以从0到2 (1表示正常速度)。还有方法setRate:time:atHostTime:。
所以这个速率不起作用。你也遇到过同样的问题吗?如果没有办法解决这个问题呢?有没有其他方法可以播放视频并在SKScene中更改帧率?
func setupVideo() {
// play video
let urlStr = NSBundle.mainBundle().pathForResource("sample", ofType: "mp4")
let url = NSURL(fileURLWithPath: urlStr!)
player = AVPlayer(URL: url)
videoNode = SKVideoNode(AVPlayer: player!)
videoNode?.position = CGPointMake(frame.size.width/2, frame.size.height/2)
videoNode?.size = CGSize(width: frame.size.width, height: frame.size.height)
videoNode?.zPosition = 1
addChild(videoNode!)
player!.rate = 0.25
videoNode!.play()
}我在哪里添加播放器并不重要!.rate= 0.25,它永远不会改变。
发布于 2016-10-26 02:57:59
--更新这是一个苹果应用程序接口问题,已在iOS 10版本中修复。
https://stackoverflow.com/questions/39760432
复制相似问题