2016-12-26 73 views
0
MPMoviePlayerController vodPlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:httpUrl]]; 
[vodPlayer.view setFrame:CGRectMake(0, 0, screen_width, screen_height)]; 
[self.view addSubview:vodPlayer.view]; 
[vodPlayer play]; 

當主頁按鈕觸摸時,播放器被停止。 我想在主頁按鈕觸摸時保持播放。 如何解決它?主頁按鈕觸摸後繼續播放MPMoviePlayerController

+0

http://stackoverflow.com/questions/9292421/how-to-play-even-background-mode-using-mpmovieplayercontroller –

回答

0

1)首先MPMoviePlayerController已被棄用,所以請儘量避免使用它。 2)如果您正在播放視頻,那麼當應用移至背景時,無需播放視頻。

  • 如果沒有使用它,則爲下一個或其他應用程序釋放資源。

3)使用AVPLayer播放視頻/音頻。 4)如果你想繼續播放背景模式的媒體,你必須在info.plist文件中啓用背景模式。

enter image description here

+0

我嘗試使用這個,但是當我去的背景下,球員是停止。 –

+0

正在播放視頻? –

+0

好的。我播放視頻。 http streaming –

相關問題