Murl Engine Lua Addon API  Version 1.0 beta
Murl.IMusicPlayerControl

The IMusicPlayerControl interface.

The music player's audio session category can be setup by the IEngineConfiguration::SetAudioSessionCategory() during IApp::Configure().

If the configured category is IEnums::AUDIO_SESSION_CATEGORY_DEFAULT the category IEnums::AUDIO_SESSION_CATEGORY_MIX_AMBIENT is used when selecting a music player.

The music player control is currently supported on iOS only.


Table members

Inherited


Murl.IControlable

Enumerations


MusicPlayer

Enumeration of the selected music player. Use SelectMusicPlayer() to select the current music player, see GetSelectedMusicPlayer() to get the current music player.

Murl.IMusicPlayerControl.PLAYER_NONENo music player.
Murl.IMusicPlayerControl.PLAYER_APPLICATIONThe application music player plays music locally within your app. It does not affect the iPod state. When your app moves to the background, the music player stops if it was playing.
Murl.IMusicPlayerControl.PLAYER_SYSTEMThe system (iPod) music player employs the iPod app on your behalf. Music that is playing continues to play when your app moves to the background. On instantiation, it takes on the current iPod app state and controls that state. Specifically, the shared state includes the following: - Repeat mode (see GetRepeatMode()) - Shuffle mode (see GetShuffleMode()) - Current now-playing item (see HasCurrentItemChanged()) - Playback state (see GetPlaybackState())

PlaybackState

Enumeration of the playback state. Use GetPlaybackState() to get the current playback state.

Murl.IMusicPlayerControl.PLAYBACK_STOPPEDThe music player is stopped.
Murl.IMusicPlayerControl.PLAYBACK_PLAYINGThe music player is playing.
Murl.IMusicPlayerControl.PLAYBACK_PAUSEDThe music player is paused.
Murl.IMusicPlayerControl.PLAYBACK_INTERRUPTEDThe music player has been interrupted, such as by an incoming phone call.
Murl.IMusicPlayerControl.PLAYBACK_SEEKING_FORWARDThe music player is seeking forward.
Murl.IMusicPlayerControl.PLAYBACK_SEEKING_BACKWARDThe music player is seeking backward.

RepeatMode

Enumeration of the repeat mode. Use GetRepeatMode() to get the current repeat mode.

Murl.IMusicPlayerControl.REPEAT_DEFAULTThe user’s preferred repeat mode.
Murl.IMusicPlayerControl.REPEAT_NONEThe music player will not repeat the current song or playlist.
Murl.IMusicPlayerControl.REPEAT_ONEThe music player will repeat the current song.
Murl.IMusicPlayerControl.REPEAT_ALLThe music player will repeat the current playlist.

ShuffleMode

Enumeration of the shuffle mode. Use GetShuffleMode() to get the current shuffle mode.

Murl.IMusicPlayerControl.SHUFFLE_DEFAULTThe user’s preferred shuffle mode.
Murl.IMusicPlayerControl.SHUFFLE_OFFThe playlist is not shuffled.
Murl.IMusicPlayerControl.SHUFFLE_SONGSThe playlist is shuffled by song.
Murl.IMusicPlayerControl.SHUFFLE_ALBUMSThe playlist is shuffled by album.


Functions



Methods


SelectMusicPlayer(musicPlayer)

Set the selected music player. Changing between application and system player during runtime is not properly supported by iOS, once a player is selected it should not change until the app is restarted.

Boolean SelectMusicPlayer(Murl.IMusicPlayerControl.MusicPlayer musicPlayer)

Parameters
musicPlayerThe selected music player.
Returns
Boolean true if successful.

GetSelectedMusicPlayer()

Get the selected music player.

Murl.IMusicPlayerControl.MusicPlayer GetSelectedMusicPlayer()

Returns
Murl.IMusicPlayerControl.MusicPlayer The selected music player.

ShowMediaPicker(allowMultipleItems, prompt)

Show the media item picker. The media item picker let a user choose media items from the device iPod library.

Boolean ShowMediaPicker(Boolean allowMultipleItems, String prompt)

Parameters
allowMultipleItemsSpecify multiple (true) or single (false) selection behavior.
promptA prompt for the user that appears above the navigation bar buttons.
Returns
Boolean true if successful.

IsMediaPickerShowing()

Check if the media item picker is showing.

Boolean IsMediaPickerShowing()

Returns
Boolean true if the media item picker is showing.

Play()

Initiates playback of the current item.

Boolean Play()

Returns
Boolean true if successful.

Pause()

Pauses playback of the current item.

Boolean Pause()

Returns
Boolean true if successful.

Stop()

Ends playback of the current item.

Boolean Stop()

Returns
Boolean true if successful.

SkipToNextItem()

Start playback of the next media item in the playback queue. If the music player is not playing the next media item is designated as the next to be played.

Boolean SkipToNextItem()

Returns
Boolean true if successful.

SkipToBeginning()

Restart playback at the beginning of the currently playing media item.

Boolean SkipToBeginning()

Returns
Boolean true if successful.

SkipToPreviousItem()

Start playback of the previous media item in the playback queue. If the music player is not playing the previous media item is designated as the next to be played.

Boolean SkipToPreviousItem()

Returns
Boolean true if successful.

BeginSeekingBackward()

Begin seeking backward through the media content.

Boolean BeginSeekingBackward()

Returns
Boolean true if successful.

BeginSeekingForward()

Begin seeking forward through the media content.

Boolean BeginSeekingForward()

Returns
Boolean true if successful.

EndSeeking()

End forward and backward seeking through the media content.

Boolean EndSeeking()

Returns
Boolean true if successful.

HasPlaybackStateChanged(inspector)

Check if the current playback state has changed.

Boolean, Murl.ChangeInspector HasPlaybackStateChanged(Murl.ChangeInspector inspector)

Parameters
inspectorThe change inspector.
Returns
Boolean true if the current playback state has changed.
Murl.ChangeInspector inspector The change inspector.

GetPlaybackState()

Get the current playback state.

Murl.IMusicPlayerControl.PlaybackState GetPlaybackState()

Returns
Murl.IMusicPlayerControl.PlaybackState The current playback state.

GetCurrentPlaybackTime()

Get the current playback time.

Number GetCurrentPlaybackTime()

Returns
Number The current playback time in seconds.

HasCurrentItemChanged(inspector)

Check if the current item has changed. If the current item has changed one or more of the following properties changed:

  • The title (see GetCurrentTitle())
  • The album title (see GetCurrentAlbumTitle())
  • The artist (see GetCurrentArtist())
  • The duration (see GetCurrentDuration())

Boolean, Murl.ChangeInspector HasCurrentItemChanged(Murl.ChangeInspector inspector)

Parameters
inspectorThe change inspector.
Returns
Boolean true if the current item has changed.
Murl.ChangeInspector inspector The change inspector.

GetCurrentTitle()

Get the title of the current item.

String GetCurrentTitle()

Returns
String The title of the current item.

GetCurrentAlbumTitle()

Get the album title of the current item.

String GetCurrentAlbumTitle()

Returns
String The album title of the current item.

GetCurrentArtist()

Get the artist of the current item.

String GetCurrentArtist()

Returns
String The artist of the current item.

GetCurrentDuration()

Get the duration of the current item.

Number GetCurrentDuration()

Returns
Number The duration of the current item in seconds.

SetRepeatMode(repeatMode)

Set the current repeat mode.

Boolean SetRepeatMode(Murl.IMusicPlayerControl.RepeatMode repeatMode)

Parameters
repeatModeThe current repeat mode.
Returns
Boolean true if successful.

GetRepeatMode()

Get the current repeat mode.

Murl.IMusicPlayerControl.RepeatMode GetRepeatMode()

Returns
Murl.IMusicPlayerControl.RepeatMode The current repeat mode.

SetShuffleMode(shuffleMode)

Set the current shuffle mode.

Boolean SetShuffleMode(Murl.IMusicPlayerControl.ShuffleMode shuffleMode)

Parameters
shuffleModeThe current shuffle mode.
Returns
Boolean true if successful.

GetShuffleMode()

Get the current shuffle mode.

Murl.IMusicPlayerControl.ShuffleMode GetShuffleMode()

Returns
Murl.IMusicPlayerControl.ShuffleMode The current shuffle mode.