1
基本上SKVideoNode不会尊重AVPlayer的速率。SKVideoNode帧速率
默认情况下,SKVideoNode无法控制播放速率。然而,SKVideoNode可以用一个AVPlayer(它本身包含一个AVPlayerItem)来初始化。这个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,它都不会改变。
你可以显示一些代码或项目? –
sure @RhythmicFistman http://collabedit.com/f4a7j – utiq
你试过改变节点的速度吗? – Knight0fDragon