SKVideoNode播放声音但不显示视频

时间:2016-03-18 09:19:07

标签: sprite-kit skvideonode

大家好我想在场景中添加视频 我可以听到它,但没有看到它,任何想法我做错了什么?

我的设置是:

导入AVFoundation / AVFoundation.h

添加了AVFoundation库

-(void)didMoveToView:(SKView *)view {

    fileURL = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource:@"bait" ofType:@"m4v"]];
    NSLog(@"FileName %@",fileURL.path);
    AVPlayer* _player = [AVPlayer playerWithURL: fileURL];

   SKVideoNode* _videoNode = [[SKVideoNode alloc] initWithAVPlayer:_player];
    _videoNode.size = CGSizeMake(self.frame.size.width,self.frame.size.height);
    NSLog(@"SKVideoNode W:%f H:%f",_videoNode.size.width,_videoNode.size.height);
    _videoNode.position = CGPointMake(self.frame.size.width/2.0f,self.frame.size.height/2.0f);
    _videoNode.zPosition = 1000;

    [self addChild:_videoNode];

    _player.volume = 0.5;
    [_videoNode play];
}

0 个答案:

没有答案