You are reading 13.2.0. See this page in 13.4.1.
Titanium.Media.MusicPlayer
Extends Titanium.Proxy
This object represents a music controller.
A MusicPlayer lets you manage and playback a queue of media Item objects.
To retrieve an instance of a MusicPlayer object, use either the Titanium.Media.appMusicPlayer or the Titanium.Media.systemMusicPlayer property.
Use the Media module's openMusicLibrary and queryMusicLibrary methods to access the media items in the device's media library.
Properties 7
Inherited from Titanium.Proxy
The name of the API that this proxy corresponds to.
Inherited from Titanium.Proxy
Indicates if the proxy will bubble an event to its parent.
Default: true
currentPlaybackTime
NumberCurrent point in song playback, in seconds.
This property is read/write, so you can update the music player's current position by setting this property.
An Item object representing the currently playing media item.
Playback state.
repeatMode
NumberRepeat setting.
shuffleMode
NumberShuffle setting.
Methods 14
Inherited from Titanium.Proxy
Adds the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to invoke when the event is fired. 4 fields
|
applyProperties
since 3.0.0Inherited from Titanium.Proxy
Applies the properties to the proxy.
| Parameters | Type | Description |
|---|---|---|
| props | Dictionary | A dictionary of properties to apply. |
Inherited from Titanium.Proxy
Fires a synthesized event to any registered listeners.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| event? | Dictionary | A dictionary of keys and values to add to the Titanium.Event object sent to the listeners. |
Pauses playback of the current media item.
Begins playback of the current media item.
Inherited from Titanium.Proxy
Removes the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to remove. Must be the same function passed to 4 fields
|
Begins seeking backward in the currently playing media.
Seeking speed increases as seeking continues.
Call stopSeeking to return to normal play.
Begins seeking forward in the currently playing media item.
While seeking forward audio plays faster than usual. The speed increases as seeking continues.
Call stopSeeking to return to normal play.
Sets the media queue.
Sets the media queue to a single media item or a list of items.
Starting in Titanium 6.1.0 you can also pass a String that identifies the Media item. This string has to be the Titanium.Media.Item.persistentID property that identifies a media item uniquely.
| Parameters | Type | Description |
|---|---|---|
| queue | Titanium.Media.Item | Array<Titanium.Media.Item> | String | One or more media items. |
Skips to the beginning of the currently playing media item.
Skips to the next media item in the queue.
If there are no more media items in the queue, ends playback.
Skips to the previous media item in the queue.
If there are no previous media items in the queue, ends playback.
Stops playback of the current media queue.
Ends a seek operation and returns to the previous playback state.
See also: seekForward and seekBackward.
Events 2
playingchange
since 3.0.0Fired when the currently playing media item changes.
See nowPlaying to identify the current media item.
statechange
since 3.0.0Fired when the music player's playback state changes.
See playbackState to identify the current playback state.