Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

objective c - How to resume a movie that's being played with presentMoviePlayerViewControllerAnimated

I'm uisng this code to display a movie:

 MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc]
 initWithContentURL:movieURL];
 mp.moviePlayer.movieSourceType = MPMovieSourceTypeUnknown;
 [self presentMoviePlayerViewControllerAnimated:mp]; [mp.moviePlayer play];

The code is working fine. However when the application goes to the background while playing a movie, when the app comes back in the foreground the movieplayer is not displayed. (I see the view of the controller that called presentMoviePlayerViewControllerAnimated:mp

Is it possible when entering the foregound to resume the movie that was playing before the app went to the background?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Have you set the UIBackgroundmode to audio and also there has been problem with playing the video after app enters foreground .Refer this Tutorial on MPMoviePlayerViewController Also you can try using MPMoviePlayerViewController which has options for implementing various notifications .


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...