我将视频加载到Sprite Kit SKVideoNode中,但是如何停止并重新开始播放或转到视频中的特定时间?我所看到的只是播放和暂停方法。
// AVPlayer
NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"HowToPlay" ofType:@"mp4"]];
_avPlayer = [AVPlayer playerWithURL:fileURL];
// SKVideoNode
_videoNode = [SKVideoNode videoNodeWithAVPlayer:_avPlayer];
[_videoNode play];
原来对我有用。
重新开始:
[_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;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句