在我的iPhone应用程序中,我想以小视图播放视频。
视频应自动开始播放,并且应隐藏播放暂停和全屏按钮。
我怎样才能做到这一点?
你要做的是手动设置MPMoviePlayerController
视图的框架,并将控件样式设置为MPMovieControlStyleNone
。很像这样下面..
....
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]];
[player setControlStyle:MPMovieControlStyleNone];
//this is where you create your `embedded` view size
player.view.frame = CGRectMake(0, 0, 200, 300);
[self.view addSubview:player.view];
....
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] init];
[player prepareToPlay];
player.shouldAutoplay = NO;
player.allowsAirPlay = YES;
player.scalingMode = MPMovieScalingModeAspectFit;
[player.view setFrame:CGRectMake(0,0,300,320)];
[viewPlayer addSubview:player.view];
self.moviePlayer = player;//declare MPMoviePlayerController class object globaly for play and push the vedio if you want to add this functionality
希望,这对你有帮助.... :)