H!我正在使用 SKVideoNode 在项目中播放视频。问题是,当我试图阻止它并回到当前的操作时,有时它会起作用,但有时却不起作用。
这是我播放它的代码。提前致谢。
SKAction *actionPlayVideo = [SKAction runBlock:^{
SKVideoNode *introVideoLevel1 = [SKVideoNode videoNodeWithVideoFileNamed:@"escenario_intermedio.mov"];
introVideoLevel1.position = CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame));
[introVideoLevel1 setName:@"IntroVideo"];
introVideoLevel1.size = CGSizeMake(ipad_2_width, ipad_2_height);
[self addChild: introVideoLevel1];
[introVideoLevel1 play];
}];
SKAction *actionStopVideo = [SKAction runBlock:^{
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
usleep(6900000);
//[[self childNodeWithName:@"IntroVideo"] stop];
[[self childNodeWithName:@"IntroVideo"] removeFromParent];
});
}];
[self runAction:[SKAction sequence:@[actionPlayVideo, actionStopVideo]]];