我不想全屏播放视频,是否可以在视图内播放视频?
这是我的代码。它确实创建了一个框架并在其中播放视频。问题是我不知道如何在屏幕上居中框架(它出现在屏幕的右侧)
NSBundle *bundle = [NSBundle mainBundle];
NSURL *url = [NSURL fileURLWithPath:[bundle pathForResource:@"movie" ofType:@"mov"]];
_moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:_moviePlayer];
_moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
_moviePlayer.view.frame = CGRectMake(184, 200, 400, 300);
[self.view addSubview:_moviePlayer.view];
_moviePlayer.shouldAutoplay = YES;