我将视频加载到雪碧工具包SKVideoNode中,但是如何停止并重新启动播放或进入视频中的特定时间?我看到的只是播放和暂停的方法。
// AVPlayer
NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"HowToPlay" ofType:@"mp4"]];
_avPlayer = [AVPlayer playerWithURL:fileURL];
// SKVideoNode
_videoNode = [SKVideoNode videoNodeWithAVPlayer:_avPlayer];
[_videoNode play];发布于 2014-12-14 11:41:21
这对我来说很管用。
重新启动:
[_videoNode removeFromParent];
_videoNode = [SKVideoNode videoNodeWithVideoFileNamed:@"video.mp4"];
_videoNode.position = ...
_videoNode.size = ...
[self addChild:_videoNode];
[_videoNode play];停顿:
[_videoNode pause];
_videoNode.paused = YES;演奏:
[_videoNode play];
_videoNode.paused = NO;发布于 2014-11-19 23:27:41
SKVideoNode所能做的就是记录在这里。play和pause是唯一支持的回放方法。
没有停止,因为它相当于暂停在这个上下文-什么应该“停止”做,渲染一个黑色的纹理?如果应该删除“停止”上的SKVideoNode,那么只需向它发送removeFromParent消息,它就会“停止”它。
倒带是不必要的,因为您可以简单地再次运行play方法或创建一个新的SKVideoNode。
我假设不支持跳转到特定的时间框架,因为这不可能是即时的,所以在视频播放位置移动到指定的时间戳之前,节点应该在时间内显示什么的问题再次出现?
发布于 2014-11-20 16:07:02
如果您保持对用于初始化视频节点的AVPlayer对象的引用,则可以使用其方法控制播放。
https://stackoverflow.com/questions/27027648
复制相似问题