开发者

MPMoviePlayerController with UIModalPresentationPageSheet

开发者 https://www.devze.com 2023-04-01 04:08 出处:网络
i have a Movie player drawn onto my view controller on my iPad app. The view is shown modally using the UIModalPresentationPageSheet.

i have a Movie player drawn onto my view controller on my iPad app. The view is shown modally using the UIModalPresentationPageSheet.

The video displays correctly but when full screen, the Done and ratio button seem to do nothing. How do i go about enable these buttons so that the full screen 开发者_如何学JAVAis exited when and ratio changed.

Below is my code that used to create the movie player

NSString *url = [[NSBundle mainBundle] pathForResource:@"Movie" ofType:@"m4v"];
NSURL *strURL =[NSURL URLWithString:url];

player = [[MPMoviePlayerController alloc] initWithContentURL:strURL];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterFullscreen:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willExitFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enteredFullscreen:) name:MPMoviePlayerDidEnterFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[player setMovieSourceType:MPMovieSourceTypeFile];


//---play partial screen---
player.view.frame = CGRectMake(0, 42 , 780, 300);
[player prepareToPlay]; // this had to be in for it to work

[self.view addSubview:player.view];
player.shouldAutoplay = NO;

Thanks

Dan

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号