3

我们在 SpriteKit 游戏中SKVideoNode添加了一个,mp4 视频在 90% 的情况下播放得很好,10% 的时间它只是渲染透明视频而音频播放得很好。SKScene

我所说的透明是指该视频位于我们的游戏板上方,当它出现故障时,可以在下方清楚地看到游戏,尽管没有任何响应,因为视频节点位于阻止用户交互的所有内容之上. 视频中的音频仍然可以正常播放,所以我知道它正在尝试播放。

它完全不一致。视频在大多数情况下都可以正常播放,但似乎有 10% 的时间,它只是不会将任何视频内容渲染到节点,而只会渲染音频。

我们在所有版本的 iOS 中都看到了这一点。

我们的节点代码:

NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"intro" ofType:@"mp4"]];
AVPlayer* player = [AVPlayer playerWithURL:fileURL];

SKVideoNode* introVideoNode = [[SKVideoNode alloc] initWithAVPlayer:player];
introVideoNode.size = CGSizeMake(self.frame.size.width,self.frame.size.height);
introVideoNode.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
introVideoNode.name = @"introVideo";
// this video plays over top of many other SKSpriteNodes
introVideoNode.zPosition = 8000;
[self addChild:introVideoNode];
[introVideoNode play];

想法?

4

0 回答 0