1

我一直在寻找其他问题的答案,但发现无法在 iPhone 中以视图而不是全屏播放视频,但可能随着新版本而改变?有人知道吗?

4

1 回答 1

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];
于 2013-07-06T17:37:56.380 回答