0

我希望我的视频 t0 开始全屏,我正在调用以下方法 [ mp setFullscreen: yes]; 似乎它没有做任何事情,如果我将其注释掉,视频播放器的运行方式相同。当玩家运行时,右侧有一个带有 2 个箭头的图标,似乎按下它会进入全屏状态。

我做错了什么吗?

(void)viewDidLoad {

    // save it in a fix file name for testing documets\ted.mp4
NSURL *url  = [[NSBundle mainBundle]
               URLForResource:@"FredCouplesDriv"
               withExtension:@"mov"];

mp=[[MPMoviePlayerController alloc] initWithContentURL: url];
[mp.view setFrame: self.view.bounds];
[self.view addSubview: mp.view];

// Set movie player layout
[mp setControlStyle:MPMovieControlStyleEmbedded];

// set full screen
[mp setFullscreen:YES];


// May help to reduce latency
[mp prepareToPlay];

[mp play];
  [mp setFullscreen:YES];

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(moviePlayBackDidFinish:) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification 
                                           object:nil];

  [self.view bringSubviewToFront: mStop ];   

}

4

1 回答 1

0

移动[mp setFullscreen:YES];viewDidAppear你会没事的

-(void) viewDidAppear:(BOOL)animated
{
    [mp setFullscreen:YES];
}
于 2012-06-23T15:23:09.987 回答