【问题标题】:SKVideoNode frame rateSKVideoNode 帧率
【发布时间】:2016-09-29 02:30:28
【问题描述】:

基本上 SKVideoNode 不会尊重 AVPlayer 的速率。

默认情况下,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,它永远不会改变。

【问题讨论】:

  • 你能展示一些代码或项目吗?
  • 确定@RhythmicFistman collabedit.com/f4a7j
  • 你试过改变节点的速度吗?
  • 没有@Knight0fDragon,我该怎么做?
  • .speed 在你的节点上大声笑

标签: swift sprite-kit avplayer skvideonode


【解决方案1】:

-- 更新 这是 Apple API 问题,已在 iOS 10 版本中修复。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-09
    • 1970-01-01
    • 2013-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多