Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/MediaPlayer.framework |
Availability | Available in iOS 2.0 and later. |
Declared in | MPMoviePlayerController.h |
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.
To present a movie in your application, incorporate the view contained in a movie player’s view
property into your application’s view hierarchy. Be sure to size the frame correctly, as shown here:
MPMoviePlayerController *player = |
[[MPMoviePlayerController alloc] initWithContentURL: myURL]; |
[[player view] setFrame: [myView bounds]]; // frame must match parent view |
[myView addSubview: [player view]]; |
// ... |
[player play]; |
Consider a movie player view to be an opaque structure. You can add your own custom subviews to layer content on top of the movie but you must never modify any of its existing subviews.
In addition to layering content on top of a movie, you can provide custom background content by adding subviews to the view in the backgroundView
property. Custom subviews are supported in both inline and fullscreen playback modes but you must adjust the positions of your views when entering or exiting fullscreen mode. Use the MPMoviePlayerWillEnterFullscreenNotification
and MPMoviePlayerWillExitFullscreenNotification
notifications to detect changes to and from fullscreen mode.
This class supports programmatic control of movie playback, and user-based control via buttons supplied by the movie player. You can control most aspects of playback programmatically using the methods and properties of the MPMediaPlayback
protocol, to which this class conforms. The methods and properties of that protocol let you start and stop playback, seek forward and backward through the movie’s content, and even change the playback rate. In addition, the controlStyle
property of this class lets you display a set of standard system controls that allow the user to manipulate playback. You can also set the shouldAutoplay
property for network-based content to start automatically.
You typically specify the movie you want to play when you create a new MPMoviePlayerController
object. However, you can also change the currently playing movie by changing the value in the contentURL
property. Changing this property lets you reuse the same movie player controller object in multiple places. For performance reasons you may want to play movies as local files. Do this by first downloading them to a local directory.
Note: Although you may create multiple MPMoviePlayerController
objects and present their views in your interface, only one movie player at a time may play its movie.
To facilitate the creation of video bookmarks or chapter links for a long movie, the MPMoviePlayerController
class defines methods for generating thumbnail images at specific times within a movie. You can request a single thumbnail image using the thumbnailImageAtTime:timeOption:
method or request multiple thumbnail images using the requestThumbnailImagesAtTimes:timeOption:
method.
To play a network stream whose URL requires access credentials, first create an appropriate NSURLCredential
object. Do this by calling, for example, the initWithUser:password:persistence:
method, as shown here:
NSURLCredential *credential = [[NSURLCredential alloc] |
initWithUser: @"userName" |
password: @"password" |
persistence: NSURLCredentialPersistenceForSession]; |
self.credential = credential; |
[credential release]; |
In addition, create an appropriate NSURLProtectionSpace
object, as shown here. Make appropriate modifications for the realm you are accessing:
NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] |
initWithHost: "streams.mydomain.com" |
port: 80 |
protocol: @"http" |
realm: @"mydomain.com" |
authenticationMethod: NSURLAuthenticationMethodDefault]; |
self.protectionSpace = protectionSpace; |
[protectionSpace release]; |
Add the URL credential and the protection space to the Singleton NSURLCredentialStorage
object. Do this by calling, for example, the setCredential:forProtectionSpace:
method, as shown here:
[[NSURLCredentialStorage sharedCredentialStorage] |
setDefaultCredential: credential |
forProtectionSpace: protectionSpace]; |
With the credential and protection space information in place, you can then play the protected stream.
The MPMoviePlayerController
class generates numerous notifications to keep your application informed about the state of movie playback. In addition to being notified when playback finishes, interested clients can be notified in the following situations:
When the movie player begins playing, is paused, or begins seeking forward or backward
When the scaling mode of the movie changes
When the movie enters or exits fullscreen mode
When the load state for network-based movies changes
When meta information about the movie itself becomes available
For more information, see the Notifications section in this document.
This class plays any movie or audio file supported in iOS. This includes both streamed content and fixed-length files. For movie files, this typically means files with the extensions .mov
, .mp4
, .mpv
, and .3gp
and using one of the following compression standards:
H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. (The Baseline profile does not support B frames.)
MPEG-4 Part 2 video (Simple Profile)
If you use this class to play audio files, it displays a white screen with a QuickTime logo while the audio plays. For audio files, this class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.
In iOS 3.1 and earlier, this class implemented a full-screen movie player only. After creating the movie player and initializing it with a single movie file, you called the play
method to present the movie. (The definition of the play
method has since moved out of this class and into the MPMediaPlayback
protocol.) The movie player object itself handled the actual presentation of the movie content.
– contentURL
– setContentURL:
movieSourceType
property
movieMediaTypes
property
naturalSize
property
fullscreen
property
– setFullscreen:animated:
scalingMode
property
controlStyle
property
useApplicationAudioSession
property
duration
property
playableDuration
property
view
property
backgroundView
property
See also the methods of the MPMediaPlayback
protocol.
loadState
property
playbackState
property
initialPlaybackTime
property
endPlaybackTime
property
shouldAutoplay
property
repeatMode
property
– timedMetadata
– thumbnailImageAtTime:timeOption:
– requestThumbnailImagesAtTimes:timeOption:
– cancelAllThumbnailImageRequests
The following methods and properties are no longer available in iOS 3.2 and must not be used.
backgroundColor
property Available in iOS 2.0 through iOS 3.1
movieControlMode
property Available in iOS 2.0 through iOS 3.1
For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.
A customizable view that is displayed behind the movie content. (read-only)
@property(nonatomic, readonly) UIView *backgroundView
This view provides the backing content, on top of which the movie content is displayed. You can add subviews to the background view if you want to display custom background content.
This view is part of the view hierarchy returned by the view
property.
MPMoviePlayerController.h
The style of the playback controls.
@property(nonatomic) MPMovieControlStyle controlStyle
The default value of this property is MPMovieControlStyleDefault
. You can change the value of this property to change the style of the controls or to hide the controls altogether. For a list of available control styles, see “MPMovieControlStyle.”
MPMoviePlayerController.h
The duration of the movie, measured in seconds. (read-only)
@property(nonatomic, readonly) NSTimeInterval duration
If the duration of the movie is not known, the value in this property is 0.0
. If the duration is subsequently determined, this property is updated and a MPMovieDurationAvailableNotification
notification is posted.
MPMoviePlayerController.h
The end time (measured in seconds) for playback of the movie.
@property(nonatomic) NSTimeInterval endPlaybackTime
The default value of this property is -1, which indicates the natural end time of the movie. This property is not applicable for streamed content.
MPMoviePlayerController.h
A Boolean that indicates whether the movie player is in full-screen mode.
@property(nonatomic, getter=isFullscreen) BOOL fullscreen
The default value of this property is NO
. Changing the value of this property causes the movie player to enter or exit full-screen mode immediately. If you want to animate the transition to full-screen mode, use the setFullscreen:animated:
method instead.
Whenever the movie player enters or exits full-screen mode, it posts appropriate notifications to reflect the change. For example, upon entering full-screen mode, it posts MPMoviePlayerWillEnterFullscreenNotification
and MPMoviePlayerDidEnterFullscreenNotification
notifications. Upon exiting from full-screen mode, it posts MPMoviePlayerWillExitFullscreenNotification
and MPMoviePlayerDidExitFullscreenNotification
notifications.
The value of this property may also change as a result of the user interacting with the movie player controls.
MPMoviePlayerController.h
The time, specified in seconds within the video timeline, when playback should start.
@property(nonatomic) NSTimeInterval initialPlaybackTime
For progressively downloaded content, playback starts at the closest key frame prior to the provided time. For video-on-demand content, playback starts at the nearest segment boundary to the provided time. For live video streams, the playback start time is measured from the start of the current playlist and is rounded to the nearest segment boundary.
The default value of this property is -1, which indicates the natural start time of the movie.
MPMoviePlayerController.h
The network load state of the movie player. (read-only)
@property(nonatomic, readonly) MPMovieLoadState loadState
MPMoviePlayerController.h
The types of media available in the movie. (read-only)
@property(nonatomic, readonly) MPMovieMediaTypeMask movieMediaTypes
Movies can contain a combination of audio, video, or a combination of the two. The default value of this property is MPMovieMediaTypeMaskNone
.
MPMoviePlayerController.h
The playback type of the movie.
@property(nonatomic) MPMovieSourceType movieSourceType
The default value of this property is MPMovieSourceTypeUnknown
. This property provides a clue to the playback system as to how it should download and buffer the movie content. If you know the source type of the movie, setting the value of this property before playback begins can improve the load times for the movie content. If you do not set the source type explicitly before playback, the movie player controller must gather this information, which might delay playback.
MPMoviePlayerController.h
The width and height of the movie frame. (read-only)
@property(nonatomic, readonly) CGSize naturalSize
This property reports the clean aperture of the video in square pixels. Thus, the reported dimensions take into account anamorphic content and aperture modes.
It is possible for the natural size of a movie to change during playback. This typically happens when the bit-rate of streaming content changes or when playback toggles between audio-only and a combination of audio and video.
MPMoviePlayerController.h
The amount of currently playable content. (read-only)
@property(nonatomic, readonly) NSTimeInterval playableDuration
For progressively downloaded network content, this property reflects the amount of content that can be played now.
MPMoviePlayerController.h
The current playback state of the movie player. (read-only)
@property(nonatomic, readonly) MPMoviePlaybackState playbackState
The playback state is affected by programmatic calls to play, pause, or stop the movie player. It can also be affected by user interactions or by the network, in cases where streaming content cannot be buffered fast enough.
For a list of valid values for this property, see “MPMoviePlaybackState”
.
MPMoviePlayerController.h
Determines how the movie player repeats the playback of the movie.
@property(nonatomic) MPMovieRepeatMode repeatMode
The default value of this property is MPMovieRepeatModeNone
. For a list of available repeat modes, see “MPMovieRepeatMode.”
MPMoviePlayerController.h
The scaling mode to use when displaying the movie.
@property(nonatomic) MPMovieScalingMode scalingMode
Changing this property while the movie player is visible causes the current movie to animate to the new scaling mode.
The default value of this property is MPMovieScalingModeAspectFit
. For a list of available scaling modes, see “MPMovieScalingMode.”
MPMoviePlayerController.h
A Boolean that indicates whether a movie should begin playback automatically.
@property(nonatomic) BOOL shouldAutoplay
The default value of this property is YES
. This property determines whether the playback of network-based content begins automatically when there is enough buffered data to ensure uninterrupted playback.
MPMoviePlayerController.h
A Boolean value that indicates whether the movie player should use the application’s audio session.
@property(nonatomic) BOOL useApplicationAudioSession
The default value of this property is YES
. Setting this property to NO
causes the movie player to use a system-supplied audio session with a nonmixable playback category.
Important: In iOS 3.1 and earlier, a movie player always uses a system-supplied audio session. To obtain that same behavior in iOS 3.2 and newer, you must set this property’s value to NO
.
When this property is YES
, the movie player shares the application’s audio session. This give you control over how the movie player content interacts with your audio and with audio from other applications, such as the iPod. For important guidance on using this feature, see “Working with Movies and iPod Music” in Audio Session Programming Guide.
Changing the value of this property does not affect the currently playing movie. For the new setting to take effect, you must stop playback and then start it again.
MPMoviePlayerController.h
The view containing the movie content and controls. (read-only)
@property(nonatomic, readonly) UIView *view
This property contains the view used for presenting the video content. This view incorporates all the background, content, and controls needed to display movies. You can incorporate this view into your own view hierarchies or present it by itself using a view controller.
To embed the view into your own view hierarchies, add it as a subview to one of your existing views. A good place to do this is in the loadView
or viewDidLoad
method of the custom view controller that presents your view hierarchy. You are free to change the view’s frame
rectangle to accommodate the space available in your view hierarchy. The movie player uses the value in the scalingMode
property to scale the movie content to match the frame you specify.
If you want to present the view by itself—that is, without embedding it in an existing view hierarchy—you can use an instance of the MPMoviePlayerViewController
class to manage the presentation of the view. That class works directly with the movie player controller to present the view by itself.
You can add subviews to the view in this property. You might do this in cases where you want to display custom playback controls or add other custom content that is relevant to your application.
MPMoviePlayerController.h
Cancels all pending asynchronous thumbnail image requests.
- (void)cancelAllThumbnailImageRequests
This method cancels only requests made using the requestThumbnailImagesAtTimes:timeOption:
method. It does not cancel requests made synchronously using the thumbnailImageAtTime:timeOption:
method.
MPMoviePlayerController.h
Returns the URL that points to the movie file.
- (NSURL *)contentURL
The URL that points to the movie file
MPMoviePlayerController.h
Returns a MPMoviePlayerController
object initialized with the movie at the specified URL.
- (id)initWithContentURL:(NSURL *)url
The location of the movie file. This file must be located either in your application directory or on a remote server.
The movie player object.
This method initializes the movie player in full-screen mode.
If you provide a nil
value in the url parameter, or call the init
method directly, the system throws an exception.
To check for errors in URL loading, register for the MPMoviePlayerContentPreloadDidFinishNotification
or MPMoviePlayerPlaybackDidFinishNotification
notifications. On error, these notifications contain an NSError
object available using the @"error"
key in the notification’s userInfo
dictionary.
MPMoviePlayerController.h
Captures one or more thumbnail images asynchronously from the current movie.
- (void)requestThumbnailImagesAtTimes:(NSArray *)playbackTimes timeOption:(MPMovieTimeOption)option
An array of NSNumber
objects containing the times at which to capture the thumbnail images. Each time value represents the number of seconds from the beginning of the current movie.
The option to use when determining which specific frame to use for each thumbnail image. For a list of possible values, see “MPMovieTimeOption.”
This method processes each thumbnail request separately and asynchronously. When the results for a single image arrive, the movie player posts a MPMoviePlayerThumbnailImageRequestDidFinishNotification
notification with the results for that image. Notifications are posted regardless of whether the image capture was successful or failed. You should register for this notification prior to calling this method.
MPMoviePlayerController.h
Assigns a new movie to the movie player controller
- (void)setContentURL:(NSURL *)contentURL
The URL identifying the file or stream to play.
If you call this method while the previous movie is playing, this method pauses that movie and begins loading the new one. The new movie starts playing at the beginning.
MPMoviePlayerController.h
Causes the movie player to enter or exit full-screen mode.
- (void)setFullscreen:(BOOL)fullscreen animated:(BOOL)animated
Specify YES
to enter full-screen mode or NO
to exit full-screen mode.
Specify YES
to animate the transition between modes or NO
to switch immediately to the new mode.
MPMoviePlayerController.h
Captures and returns a thumbnail image from the current movie.
- (UIImage *)thumbnailImageAtTime:(NSTimeInterval)playbackTime timeOption:(MPMovieTimeOption)option
The time at which to capture the thumbnail image. The time value represents the number of seconds from the beginning of the current movie.
The option to use when determining which specific frame to use for the thumbnail image. For a list of possible values, see “MPMovieTimeOption.”
An image object containing the image from the movie or nil
if the thumbnail could not be captured.
This method captures the thumbnail image synchronously from the current movie (which is accessible from the MPMovieSourceTypeUnknown
property).
MPMoviePlayerController.h
Obtains the most recent time-based metadata provided by the streamed movie.
- (NSArray *) timedMetadata;
An array of the most recent MPTimedMetadata
objects provided by the streamed movie.
MPMoviePlayerController.h
Constants describing the network load state of the movie player.
enum { MPMovieLoadStateUnknown = 0, MPMovieLoadStatePlayable = 1 << 0, MPMovieLoadStatePlaythroughOK = 1 << 1, MPMovieLoadStateStalled = 1 << 2, }; typedef NSInteger MPMovieLoadState;
MPMovieLoadStateUnknown
The load state is not known at this time.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieLoadStatePlayable
The buffer has enough data that playback can begin, but it may run out of data before playback finishes.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieLoadStatePlaythroughOK
Enough data has been buffered for playback to continue uninterrupted.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieLoadStateStalled
The buffering of data has stalled. If started now, playback may pause automatically if the player runs out of buffered data.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
Constants describing the style of the playback controls.
enum { MPMovieControlStyleNone, MPMovieControlStyleEmbedded, MPMovieControlStyleFullscreen, MPMovieControlStyleDefault = MPMovieControlStyleFullscreen }; typedef NSInteger MPMovieControlStyle;
MPMovieControlStyleNone
No controls are displayed.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieControlStyleEmbedded
Controls for an embedded view are displayed. The controls include a start/pause button, a scrubber bar, and a button for toggling between fullscreen and embedded display modes.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieControlStyleFullscreen
Controls for fullscreen playback are displayed. The controls include a start/pause button, a scrubber bar, forward and reverse seeking buttons, a button for toggling between fullscreen and embedded display modes, a button for toggling the aspect fill mode, and a Done button. Tapping the done button pauses the video and exits fullscreen mode.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieControlStyleDefault
Fullscreen controls are displayed by default.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
Constants describing the reason that playback ended.
enum { MPMovieFinishReasonPlaybackEnded, MPMovieFinishReasonPlaybackError, MPMovieFinishReasonUserExited }; typedef NSInteger MPMovieFinishReason;
MPMovieFinishReasonPlaybackEnded
The end of the movie was reached.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieFinishReasonPlaybackError
There was an error during playback.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieFinishReasonUserExited
The user stopped playback.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
Constants describing the current playback state of the movie player.
enum { MPMoviePlaybackStateStopped, MPMoviePlaybackStatePlaying, MPMoviePlaybackStatePaused, MPMoviePlaybackStateInterrupted, MPMoviePlaybackStateSeekingForward, MPMoviePlaybackStateSeekingBackward }; typedef NSInteger MPMoviePlaybackState;
MPMoviePlaybackStateStopped
Playback is currently stopped. Playback will commence from the beginning of the movie.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMoviePlaybackStatePlaying
Playback is currently under way.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMoviePlaybackStatePaused
Playback is currently paused. Playback will resume from the point where it was paused.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMoviePlaybackStateInterrupted
Playback is temporarily interrupted, perhaps because the buffer ran out of content.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMoviePlaybackStateSeekingForward
The movie player is currently seeking towards the end of the movie.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMoviePlaybackStateSeekingBackward
The movie player is currently seeking towards the beginning of the movie.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
Constants describing how the movie player repeats content at the end of playback.
enum { MPMovieRepeatModeNone, MPMovieRepeatModeOne }; typedef NSInteger MPMovieRepeatMode;
MPMovieRepeatModeNone
Content is not repeated when playback finishes
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieRepeatModeOne
The current movie is repeated when it finishes.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
Constants describing how the movie content is scaled to fit the frame of its view.
typedef enum { MPMovieScalingModeNone, MPMovieScalingModeAspectFit, MPMovieScalingModeAspectFill, MPMovieScalingModeFill } MPMovieScalingMode;
MPMovieScalingModeNone
Do not scale the movie.
Available in iOS 2.0 and later.
Declared in MPMoviePlayerController.h
.
MPMovieScalingModeAspectFit
Scale the movie uniformly until one dimension fits the visible bounds of the view exactly. In the other dimension, the region between the edge of the movie and the edge of the view is filled with a black bar. The aspect ratio of the movie is preserved.
Available in iOS 2.0 and later.
Declared in MPMoviePlayerController.h
.
MPMovieScalingModeAspectFill
Scale the movie uniformly until the movie fills the visible bounds of the view. Content at the edges of the larger of the two dimensions is clipped so that the other dimension fits the view exactly. The aspect ratio of the movie is preserved.
Available in iOS 2.0 and later.
Declared in MPMoviePlayerController.h
.
MPMovieScalingModeFill
Scale the movie until both dimensions fit the visible bounds of the view exactly. The aspect ratio of the movie is not preserved.
Available in iOS 2.0 and later.
Declared in MPMoviePlayerController.h
.
Constants describing which frame to use when generating thumbnail images.
enum { MPMovieTimeOptionNearestKeyFrame, MPMovieTimeOptionExact }; typedef NSInteger MPMovieTimeOption;
MPMovieTimeOptionNearestKeyFrame
Generate a thumbnail image using the nearest key frame. This frame could be several frames away from the current frame. This option generally offers better performance than trying to find the exact frame.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieTimeOptionExact
Use the exact current frame.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
Specifies the types of content available in the movie file.
enum { MPMovieMediaTypeMaskNone = 0, MPMovieMediaTypeMaskVideo = 1 << 0, MPMovieMediaTypeMaskAudio = 1 << 1 }; typedef NSInteger MPMovieMediaTypeMask;
MPMovieMediaTypeMaskNone
The types of media available in the media are not yet known.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieMediaTypeMaskVideo
The movie file contains video media.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieMediaTypeMaskAudio
The movie file contains audio media.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
You can OR the specified constants together to specify a movie
Specifies the type of the movie file.
enum { MPMovieSourceTypeUnknown, MPMovieSourceTypeFile, MPMovieSourceTypeStreaming }; typedef NSInteger MPMovieSourceType;
MPMovieSourceTypeUnknown
The movie type is not yet known.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieSourceTypeFile
The movie is a local file or is a file that can be downloaded from the network.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMovieSourceTypeStreaming
The movie is a live or on-demand stream.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
The following keys may be found in the userInfo dictionary of a MPMoviePlayerThumbnailImageRequestDidFinishNotification
notification.
NSString *const MPMoviePlayerThumbnailImageKey; NSString *const MPMoviePlayerThumbnailTimeKey; NSString *const MPMoviePlayerThumbnailErrorKey;
MPMoviePlayerThumbnailImageKey
The value of this key is a UIImage
object containing the image that was obtained for the desired frame.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMoviePlayerThumbnailTimeKey
The value of this key is a NSNumber
object containing a double value. This value represents the actual time (measured in seconds) from the beginning of the movie at which the image was captured.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMoviePlayerThumbnailErrorKey
The value of this key is an NSError
object identifying the error that occurred, if any.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
The following keys may be found in the userInfo dictionary of notifications for transitioning in or out of full-screen mode.
NSString *const MPMoviePlayerFullscreenAnimationDurationUserInfoKey; NSString *const MPMoviePlayerFullscreenAnimationCurveUserInfoKey;
MPMoviePlayerFullscreenAnimationDurationUserInfoKey
The value of this key is an NSNumber
containing a double value. This value represents the duration (measured in seconds) of the animation used to transition in or out of full-screen mode.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
MPMoviePlayerFullscreenAnimationCurveUserInfoKey
The value of this key is an NSNumber
containing an integer value that represents one of the UIViewAnimationCurve
constants.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
The following key may be found in the userInfo dictionary of a MPMoviePlayerPlaybackDidFinishNotification
notification.
NSString *const MPMoviePlayerPlaybackDidFinishReasonUserInfoKey;
MPMoviePlayerPlaybackDidFinishReasonUserInfoKey
The value of this key is an NSNumber
containing an integer value that represents one of the “MPMovieFinishReason”
constants.
Available in iOS 3.2 and later.
Declared in MPMoviePlayerController.h
.
Options for displaying movie playback controls. (Deprecated. Use the “MPMovieControlStyle”
constants in conjunction with the controlStyle
property instead.)
typedef enum { MPMovieControlModeDefault, MPMovieControlModeVolumeOnly, MPMovieControlModeHidden } MPMovieControlMode;
MPMovieControlModeDefault
Display the standard controls for controlling playback. This includes play/pause controls, a volume slider, and a timeline control.
Available in iOS 2.0 and later.
Declared in MPMoviePlayerController.h
.
MPMovieControlModeVolumeOnly
Display volume controls only.
Available in iOS 2.0 and later.
Declared in MPMoviePlayerController.h
.
MPMovieControlModeHidden
Do not display any controls. This mode prevents the user from controlling playback.
Available in iOS 2.0 and later.
Declared in MPMoviePlayerController.h
.
This notification is posted when the duration of a movie object is determined. The object of the notification is the MPMoviePlayerController
object itself. There is no userInfo dictionary. The duration value is reflected in the duration
property of the movie player controller.
MPMoviePlayerController.h
This notification is posted when the media types of a movie object are determined. The object of the notification is the MPMoviePlayerController
object itself. There is no userInfo dictionary. The supported media types are reflected in the movieMediaTypes
property of the movie player controller.
MPMoviePlayerController.h
This notification is posted when the frame size of a movie object is first determined or subsequently changes. The object of the notification is the MPMoviePlayerController
object itself. There is no userInfo dictionary. The frame size value is reflected in the naturalSize
property of the movie player controller.
MPMoviePlayerController.h
Notifies observers that the movie is now in memory and ready to play. The affected movie player is stored in the object
parameter of the notification. If an error occurred during loading, the userInfo
dictionary of this notification contains a key with the name “error” whose value is the NSError
object describing the problem. (Deprecated. Use the MPMoviePlayerLoadStateDidChangeNotification
notification to determine the readiness of the player.)
MPMoviePlayerController.h
Notifies observers that the movie player entered into full-screen mode. The affected movie player is stored in the object
parameter of the notification. There is no userInfo dictionary.
User actions may also cause the media player to send this notification.
MPMoviePlayerController.h
Notifies observers that the movie player exited full-screen mode. The affected movie player is stored in the object
parameter of the notification. There is no userInfo dictionary.
User actions may also cause the media player to send this notification.
MPMoviePlayerController.h
Notifies observers that the network buffering state changed. The affected movie player is stored in the object
parameter of the notification. There is no userInfo
dictionary. The current load state can be retrieved from the loadState
property of the movie player controller.
MPMoviePlayerController.h
Notifies observers that the currently playing movie changed. The affected movie player is stored in the object
parameter of the notification. There is no userInfo
dictionary. The currently playing movie can be retrieved from the contentURL
method of the movie player controller.
MPMoviePlayerController.h
Notifies observers that the movie finished playing. The affected movie player is stored in the object
parameter of the notification. The userInfo
dictionary of this notification contains the MPMoviePlayerPlaybackDidFinishReasonUserInfoKey
key, which indicates the reason that playback finished. This notification is also sent when playback fails because of an error.
This notification is not sent in cases where the movie player is displaying in fullscreen mode and the user taps the Done button. In that instance, the Done button causes movie playback to pause while the player transitions out of fullscreen mode. If you want to detect this scenario in your code, you should monitor other notifications such as MPMoviePlayerDidExitFullscreenNotification
.
MPMoviePlayerController.h
Notifies observers that the playback state changed. The affected movie player is stored in the object
parameter of the notification. There is no userInfo
dictionary.
The playback state can change by programmatic means or because of user interactions with the controls. To get the current playback state, get the value of the playbackState
property of the movie player object.
MPMoviePlayerController.h
Notifies observers that the scaling mode property of the player changed. The affected movie player is stored in the object
parameter of the notification. There is no userInfo
dictionary.
User actions may also cause the media player to send this notification.
MPMoviePlayerController.h
Notifies observers that a request to capture a thumbnail from the movie is now complete. The affected movie player is stored in the object
parameter of the notification. The userInfo dictionary of this notification contains one or more keys with information about the thumbnail image.
A separate notification is sent for each thumbnail that is captured. Upon successful capture of a given image, the userInfo dictionary contains the MPMoviePlayerThumbnailImageKey
and MPMoviePlayerThumbnailTimeKey
keys. If an error occurs, the notification contains the MPMoviePlayerThumbnailErrorKey
and MPMoviePlayerThumbnailTimeKey
keys.
MPMoviePlayerController.h
Notifies observers that the movie player is about to enter full-screen mode. The affected movie player is stored in the object
parameter of the notification. The userInfo dictionary of this notification contains keys describing the transition animation used to enter full-screen mode. These keys are described in “Fullscreen Notification Keys.”
User actions may also cause the media player to send this notification.
MPMoviePlayerController.h
Notifies observers that the movie player is about to exit full-screen mode. The affected movie player is stored in the object
parameter of the notification. The userInfo dictionary of this notification contains keys describing the transition animation used to exit full-screen mode. These keys are described in “Fullscreen Notification Keys.”
User actions may also cause the media player to send this notification.
MPMoviePlayerController.h
This notification is posted when the source type of a movie object is unknown initially but is determined later. The object of the notification is the MPMoviePlayerController
object itself. There is no userInfo dictionary. The source type is reflected in the movieSourceType
property of the movie player controller.
MPMoviePlayerController.h
Last updated: 2010-07-13