MPMoviePlayerController vs. MPMoviePlayerViewController
I'm new to iPhone development. Just wondering what the difference is between the MPMoviePlayerController and the MPMoviePlayerViewController. Also, more generall开发者_高级运维y, what is the difference between a controller and a view controller? I know that you use a controller to construct a view (as with MPMoviePlayerController.view), so what does a ViewController create?
The MPMoviePlayerController is just a movie player, it provides a way for you to play movies on the iPhone, a MPMoviePlayerViewController is an actual view controller subclass that takes care of presentation of the MPMoviePlayerController...as documentation at apple puts it "An MPMoviePlayerController instance, or movie player, manages the playback of a movie from a file or a network stream. Playback occurs either in full-screen mode or in a custom view that is vended by the movie player. You can incorporate the view into your own view hierarchies or use an MPMoviePlayerViewController object to manage the presentation for you."
There is no relation between a viewControler and a controller, this class just happens to be named MPMoviePlayerController because it gives you control over the movie player. Actually before (4.0 i think) there was no view controller and just the movie player, later apple decided to incorporate the movie player view controller too.
Zaius,
In the simplest terms, MPMoviePlayerViewController
displays the movie/video using the MPMoviePlayerController
.
hence, MPMoviePlayerController
is a property in MPMoviePlayerViewController
that you can access.
MPMoviePlayerViewController.moviePlayer
is the property that you'd use to access MPMoviePlayerController
properties.
Hope anyone hitting this thread will find this useful!
Example:
MyMoviePlayerViewController * moviePlayerVC = [[MPMoviePlayerViewController alloc]initWithContentURL:movieURL];
moviePlayerVC.moviePlayer.allowsAirPlay = YES;
精彩评论