Class ISN_MPMusicPlayerController
An object used to play audio media items from the device's Music app library. https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller
Inheritance
Inherited Members
Namespace: SA.iOS.MediaPlayer
Assembly: cs.temp.dll.dll
Syntax
public class ISN_MPMusicPlayerController
Fields
NowPlayingItemDidChange
Posted when the currently playing media item has changed.
Declaration
public const string NowPlayingItemDidChange = "MPMusicPlayerControllerNowPlayingItemDidChangeNotification"
Field Value
Type | Description |
---|---|
System.String |
PlaybackStateDidChange
Posted when the playback state has been changed programmatically or by user action.
Declaration
public const string PlaybackStateDidChange = "MPMusicPlayerControllerPlaybackStateDidChangeNotification"
Field Value
Type | Description |
---|---|
System.String |
VolumeDidChange
Posted when the audio playback volume for the music player has changed.
Declaration
public const string VolumeDidChange = "MPMusicPlayerControllerVolumeDidChangeNotification"
Field Value
Type | Description |
---|---|
System.String |
Properties
ApplicationMusicPlayer
The application music player.
The application music player plays music locally within your app. The music player does not affect the Music app’s state. When your app moves to the background, the music player stops playing the current media.
Declaration
public static ISN_MPMusicPlayerController ApplicationMusicPlayer { get; }
Property Value
Type | Description |
---|---|
ISN_MPMusicPlayerController |
ApplicationQueuePlayer
The application queue music player.
The application queue music player plays music locally within your app. The application queue music player provides more functionality and greater control over the music played than the application music player.
The music player does not affect the Music app’s state. When your app moves to the background, the music player stops playing the current media.
Declaration
public static ISN_MPMusicPlayerController ApplicationQueuePlayer { get; }
Property Value
Type | Description |
---|---|
ISN_MPMusicPlayerController |
NowPlayingItem
The currently-playing media item, or the media item, within a queue, that you have designated to begin playback with.
Declaration
public ISN_MPMediaItem NowPlayingItem { get; }
Property Value
Type | Description |
---|---|
ISN_MPMediaItem |
PlaybackState
You determine a music player’s state by checking the playbackState property. Depending on the property’s value, you can update your application’s user interface or take other appropriate action.
Declaration
public ISN_MPMusicPlaybackState PlaybackState { get; }
Property Value
Type | Description |
---|---|
ISN_MPMusicPlaybackState |
PlayerHashId
Objective-C linked object hash Id.
Declaration
public string PlayerHashId { get; }
Property Value
Type | Description |
---|---|
System.String |
SystemMusicPlayer
Returns the system music player, which controls the Music app’s state.
The system music player employs the built-in Music app on your behalf. On instantiation, it takes on the current Music app state, such as the identification of the now-playing item. If a user switches away from your app while music is playing, that music continues to play. The Music app then has your music player’s most recently-set repeat mode, shuffle mode, playback state, and now-playing item.
Declaration
public static ISN_MPMusicPlayerController SystemMusicPlayer { get; }
Property Value
Type | Description |
---|---|
ISN_MPMusicPlayerController |
Methods
BeginGeneratingPlaybackNotifications()
Starts the generation of playback notifications.
Declaration
public void BeginGeneratingPlaybackNotifications()
EndGeneratingPlaybackNotifications()
Ends the generation of playback notifications.
Declaration
public void EndGeneratingPlaybackNotifications()
Pause()
Pause current player track
Declaration
public void Pause()
Play()
Play current player track
Declaration
public void Play()
SetQueueWithItemCollection(ISN_MPMediaItemCollection)
Sets a music player’s playback queue using a media item collection.
Declaration
public void SetQueueWithItemCollection(ISN_MPMediaItemCollection itemCollection)
Parameters
Type | Name | Description |
---|---|---|
ISN_MPMediaItemCollection | itemCollection | A media item collection that you want as the playback queue. See ISN_MPMediaItemCollection for a description of media item collections and how to use them. |
SetQueueWithStoreIDs(String[])
Sets a music player's playback queue using with media items identified by the store identifiers.
Declaration
public void SetQueueWithStoreIDs(params string[] storeIDs)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | storeIDs | An array of store identifiers associated with the media items to be added to the queue. |
SkipToNextItem()
Starts playback of the next media item in the playback queue; or, the music player is not playing, designates the next media item as the next to be played.
Declaration
public void SkipToNextItem()
SkipToPreviousItem()
Starts playback of the previous media item in the playback queue; or, the music player is not playing, designates the previous media item as the next to be played.
Declaration
public void SkipToPreviousItem()
Stop()
Stop current player track
Declaration
public void Stop()