我将视频加载到我的 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;
关于ios - 如何在 iOS Sprite Kit SKVideoNode 中控制视频的播放?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27027648/