我正在寻找其他问题的答案,但发现在视图中不能在iPhone中播放视频而不是全屏,但是新版本可能已经改变了吗?有人知道吗?
答案 0 :(得分:4)
使用MPMoviePlayerController播放视频并设置要在布局中显示的帧。
// Create custom movie player
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:URL];
[moviePlayer setControlStyle:MPMovieControlStyleNone];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(onMSAASDone:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
[moviePlayer setScalingMode:MPMovieScalingModeAspectFill];
[moviePlayer setFullscreen:FALSE];
//---play partial screen---
moviePlayer.view.frame = CGRectMake(0, 0, 200, 300);
[self.view addSubview:moviePlayer.view];