0

在我的 iPhone 应用程序中,我想在一个小视图中播放视频。

视频应自动开始播放,播放暂停和全屏按钮应隐藏。

在此处输入图像描述

我怎样才能做到这一点?

4

2 回答 2

0

您要做的是手动设置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];
....
于 2012-06-13T09:50:07.303 回答
0
    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

希望,这对你有帮助.... :)

于 2012-06-13T10:07:29.283 回答