Protocol

MPMediaPlayback

A protocol that defines the interface for controlling audio media playback.

Declaration

@protocol MPMediaPlayback

Overview

This protocol supports basic transport operations including start, stop, and pause, and also lets you seek forward and back through media or to a specific point in its timeline.

Topics

Starting and Stopping Playback

- play

Initiates playback of the current item.

Required.

- pause

Pauses playback of the current item.

Required.

- stop

Ends playback of the current item.

Required.

- prepareToPlay

Prepares a media player for playback.

Required.

isPreparedToPlay

A Boolean value indicating whether a media player is ready to play.

Required.

Seeking Within Media

- beginSeekingBackward

Begins seeking backward through the media content.

Required.

- beginSeekingForward

Begins seeking forward through the media content.

Required.

- endSeeking

Ends forward and backward seeking through the media content.

Required.

Accessing Playback Attributes

currentPlaybackRate

The current playback rate for the player.

Required.

currentPlaybackTime

The current position of the playhead.

Required.

Notifications

MPMediaPlaybackIsPreparedToPlayDidChangeNotification

Indicates that the prepared to play status of the media player has changed.

Deprecated

Relationships

See Also

Built-In Music Playback

Playing Audio Using the Built-In Music Player

Create a media player inside your app to play audio from the user's media library.

MPMusicPlayerController

An object used to play audio media items from the device's Music app library.

MPSystemMusicPlayerController

A protocol for playing videos in the Music app.