2011-08-03 19 views
1

我正在開發一個介紹視頻的iOS遊戲。我如何播放視頻的全屏顯示,無:在iPhone上播放全屏視頻沒有任何用戶控制或交互?

1)用戶控件一樣播放/暫停可見

2)倒是像雙擊或捏改變視頻的規模/縮放?

要禁用視頻上的點擊,我可以在電影播放器​​視圖上添加一個空白的UIView嗎?我會怎麼做?

+0

>>>要禁用在視頻上點擊,我可以在電影播放器​​視圖上添加一個空白的UIView嗎?我會怎麼做? 這可能有效。 嘗試重新關聯事件處理程序通過通知或只是原始的委託方法,只是覆蓋這些方法來處理多點觸摸手勢 – Eugene

回答

1

我加入一個「空白」視圖上層建築的的MPMoviePlayerController去了。這是我設置它的方式。不必與事件處理程序混淆。

mBlankView = [[UIView alloc] initWithFrame:viewFrame]; 
mBlankView.userInteractionEnabled = YES; 
[mBlankView setMultipleTouchEnabled:YES]; 
[mBlankView setBackgroundColor:[UIColor clearColor]]; 
[window addSubview:mBlankView];  

viewFrame包含MPMoviePlayerController的大小。

5

你使用的是什麼樣的電影播放器​​? 如果您使用MPMoviePlayerViewController/MPMoviePlayerController,則可以將controlStyle屬性設置爲MPMovieControlStyleNone。 (如果你使用MPMoviePlayerViewController你先調用moviePlayer屬性讓你獲得具有ControlStyle屬性中的MPMoviePlayerController)

例子:

MPMoviePlayerViewController* moviePlayerViewController = [MPMoviePlayerViewController alloc] initWithContentURL:url]; 
moviePlayerViewController.moviePlayer.controlStyle = MPMovieControlStyleNone; 
+0

好的。這似乎工作。有關#2的任何想法? – djcouchycouch

0
MPMoviePlayerViewController *playerViewController=[[MPMoviePlayerViewController alloc]initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"XYZ" ofType:@"mp4"]]]; 
[self presentViewController:playerViewController animated:NO completion:nil]; 

MPMoviePlayerController *player = [playerViewController moviePlayer]; 
player.controlStyle=MPMovieControlStyleNone; //hide the controls 
[player play];