iOS Developer Library — Pre-Release

Developer

MediaPlayer Framework Reference MPMoviePlayerViewController Class Reference

Options
Deployment Target:

On This Page
Language:

MPMoviePlayerViewController

The MPMoviePlayerViewController class implements a simple view controller for displaying full-screen movies. Unlike using an MPMoviePlayerController object on its own to present a movie immediately, you can incorporate a movie player view controller wherever you would normally use a view controller. For example, you can present it using a tab bar or navigation bar-based interface, taking advantage of the transitions offered by those interfaces. More...

Inheritance


Import Statement


Swift

import MediaPlayer

Objective-C

@import MediaPlayer;

Availability


Available in iOS 3.2 and later.
  • init(contentURL:) - initWithContentURL: Designated Initializer

    Returns a movie player view controller initialized with the specified movie.

    Declaration

    Swift

    init!(contentURL contentURL: NSURL!)

    Objective-C

    - (instancetype)initWithContentURL:(NSURL *)contentURL

    Parameters

    contentURL

    The URL that points to the content to be played.

    Return Value

    A movie player view controller initialized with the specified URL.

    Import Statement

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.2 and later.

  • The movie player controller object used to present the movie. (read-only)

    Declaration

    Swift

    var moviePlayer: MPMoviePlayerController! { get }

    Objective-C

    @property(nonatomic, readonly) MPMoviePlayerController *moviePlayer

    Discussion

    The MPMoviePlayerController object in this property is created automatically by the receiver and cannot be changed. However, you can use the object to manage the presentation and configuration of the movie playback.

    Import Statement

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.2 and later.

  • Returns a Boolean value indicating whether the view controller supports the specified orientation.

    Declaration

    Objective-C

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

    Parameters

    toInterfaceOrientation

    The orientation of the application’s user interface after the rotation. The possible values are described in UIInterfaceOrientation.

    Return Value

    YEStrue if the view controller supports the specified orientation or NOfalse if it does not.

    Discussion

    This method is an override that replaces the default behavior by returning YEStrue for the UIInterfaceOrientationPortrait, UIInterfaceOrientationLandscapeLeft, and UIInterfaceOrientationLandscapeRight orientations.

    Availability

    Available in iOS 3.2 through iOS 6.1.