iPhone应用程序:仅在小视图中播放视频

问题描述 投票:0回答:2

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

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

我怎样才能做到这一点?

iphone ios5 video uiwebview mpmovieplayercontroller
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];
....

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

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

© www.soinside.com 2019 - 2024. All rights reserved.