相关疑难解决方法(0)

在iOS 3.2(iPad)中正确显示和关闭全屏MPMoviePlayerController

我在iPad应用程序中显示全屏电影时遇到了很多麻烦,然后允许用户使用完成按钮或播放器控件上的"取消全屏"按钮来解除它.

最初我MPMoviePlayerViewController用于电影演示,但我没有从其MPMoviePlayerController对象接收进入/退出全屏通知,所以我自己切换到了.

我可以让电影看起来是全屏的(尽管过渡很简陋)但是当按下"完成"或"非全屏"按钮时,播放器不会采取任何动作.我在下面发布了我的代码:

- (void)startPlayingMovieWithURLString:(NSString *)movieURLString {
    // I get all of these callbacks **EXCEPT** the "willExitFullScreen:" callback.
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterFullScreen:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willExitFullScreen:) name:MPMoviePlayerWillExitFullscreenNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishPlayback:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];

    [self.moviePlayerController setContentURL:someExistingURL];

        // "self" is a UIViewController subclass, and is presented as a "fullscreen" modal view controller from its parent
        // I'm setting the movie player's view's frame to take up the full rectangle of my view controller, but really …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch mpmovieplayercontroller ipad ios

22
推荐指数
1
解决办法
4万
查看次数

标签 统计

cocoa-touch ×1

ios ×1

ipad ×1

iphone ×1

mpmovieplayercontroller ×1