首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SKVideoNode.pause()不暂停视频

SKVideoNode.pause()不暂停视频
EN

Stack Overflow用户
提问于 2016-02-24 09:10:30
回答 1查看 569关注 0票数 1

我有SKVideoNode,就像.

代码语言:javascript
复制
let path = "videoURL";
let url = NSURL(string: path);
let asset = AVURLAsset(URL: url!,options: nil);
let playerItem = AVPlayerItem(asset: asset);
let playerThree = AVPlayer(playerItem: playerItem);
let videoNode = SKVideoNode(AVPlayer: playerThree);

我想在按钮上暂停一下,按钮看起来是这样的-

代码语言:javascript
复制
var isPausedThreeSixty : Bool = false;

@IBAction func threesixty(sender: AnyObject){
    if (videoPlayer == 1) { // check if video player is the 360 videoplayer
        if(isPausedThreeSixty == false){ //check if video is paused, if not pause video on click
            videoNode?.pause(); // pause video node
            print("pause player");
            isPausedThreeSixty == true;
        }else{ //if app runs else, video is paused, proceed to unpause.
            videoNode?.play();
            print("play player");
            isPausedThreeSixty = false;
        }
    }
}

我的代码确实打印了pause playerplay player,但是它不会暂停视频,我还读到应该暂停AVPlayer,但是当调用playerThree.pause();时,视频也不会暂停。

见- How do I control playback of a video in an iOS Sprite Kit SKVideoNode?

AVPlayer play SKVideoNode video ,I just can not control the playback

为什么多个答案说调用.pause.play在SKVideoNode上是有效的,即使在实现它时,它实际上不起作用。

在暂停了这段视频之后,我想换到一个新的视频播放器,我已经开始工作了。只是我不能删除或暂停这个视频播放器。

见- https://forums.developer.apple.com/thread/28470根据这个帖子AVPlayer率正在被覆盖,因此SKVideoNode不能暂停。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-03-30 13:10:05

我不得不暂停AVPlayerItem所以-

代码语言:javascript
复制
playerThree.pause();

成功了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35597734

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档