2 vikeytoy vikeyToy 于 2013.06.19 17:30 提问

默认图片加载完后播放视频

应用在默认图片加载后播放4秒的视频。如何实现?

-(void)viewWillAppear:(BOOL)animated

{
    NSString* moviePath = [[NSBundle mainBundle] pathForResource:@"intro_anim" ofType:@"mov"];

    NSURL* movieURL = [NSURL fileURLWithPath:moviePath];
    NSLog(@"%@",movieURL );
    playerCtrl =  [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

    [playerCtrl prepareToPlay];

    playerCtrl.scalingMode = MPMovieScalingModeFill;

    playerCtrl.controlStyle = MPMovieControlStyleNone;

    playerCtrl.view.frame = CGRectMake(0, 0, 480, 320);
    [playerCtrl.view setCenter:CGPointMake(240, 160)];
    [playerCtrl.view setFrame:CGRectMake(0, 0, 480, 320)];
    [[NSNotificationCenter defaultCenter] addObserver:self                                            selector:@selector(moviePlayBackDidFinish:)                                               name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
    [playerCtrl play];
    [self presentMoviePlayerViewControllerAnimated:playerCtrl.view];
    [self.view addSubview:playerCtrl.view];
}
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!