0

如何自动播放视频而无需按下播放按钮。

4

1 回答 1

1
 MPMoviePlayerController *player = [[MPMoviePlayerController alloc]initWithContentURL:[NSURL fileURLWithPath:@"yourVideoPath"]];
player.shouldAutoplay=YES;
player.view.frame = CGRectMake(0.0, 0.0, 480.0, 320.0);
player.movieSourceType = MPMovieSourceTypeFile;    
player.controlStyle = MPMovieControlStyleEmbedded;

[self.view  addSubview:player.view];

这应该可以解决您的问题。久经考验

于 2012-07-16T08:26:50.153 回答