I had a similar problem and solved it like this:
I exported the first frame of the video as PNG. Then I added a SKSpriteNode
with that PNG in front of the SKVideoNode
. When I start the video, I set the hidden
property of the SKSpriteNode
to YES
.
Here is an simplified example of my code with the relevant parts:
-(void)didMoveToView:(SKView *)view {
// add first frame on top of the SKVideoNode
firstFrame = [SKSpriteNode spriteNodeWithImageNamed:@"firstFrame"];
firstFrame.zPosition = 1;
[self addChild:firstFrame];
// here I add the SKVideoNode with AVPlayer
......
// Add KVO
[playerItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (object == player.currentItem && [keyPath isEqualToString:@"status"]) {
if (player.currentItem.status == AVPlayerItemStatusReadyToPlay) {
[introVideo play];
firstFrame.hidden = YES;
}
}
}
This is the best solution I've found so far. I hope that helps you!