Titanium.Media.MusicPlayer
> Titanium.Media.MusicPlayer

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.

  • 1.4.0
  • 1.4.0
Defined By

Properties

apiName : Stringreadonly

The name of the API that this proxy corresponds to.

The name of the API that this proxy corresponds to.

The value of this property is the fully qualified name of the API. For example, Button returns Ti.UI.Button.

  • 3.2.0
  • 3.2.0
  • 3.2.0
Indicates if the proxy will bubble an event to its parent. ...

Indicates if the proxy will bubble an event to its parent.

Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.

Default: true

  • 3.0.0
  • 3.0.0
  • 3.0.0
Titanium.Media.MusicPlayer
currentPlaybackTime : Number

Current point in song playback, in seconds.

Current 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.

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.

  • 3.6.0
Titanium.Media.MusicPlayer
nowPlaying : Titanium.Media.Itemreadonly

An Item object representing the currently playing media item.

An Item object representing the currently playing media item.

Titanium.Media.MusicPlayer
: Number
Titanium.Media.MusicPlayer
: Number
Titanium.Media.MusicPlayer
: Number
Volume level for the music player from 0.0 (muted) to 1.0 (loudest). ...

Volume level for the music player from 0.0 (muted) to 1.0 (loudest).

Requires: iOS 7.0 and earlier

This property has no effect on devices running iOS 8.0 and later.

This adjusts the volume of the application's session.

The iOS simulator ignores this volume setting. This is a known issue with Apple's simulator.

Defined By

Methods

Adds the specified callback as an event listener for the named event. ...

Adds the specified callback as an event listener for the named event.

Parameters

  • name : String

    Name of the event.

  • callback : Callback<Object>

    Callback function to invoke when the event is fired.

Returns

  • void
Applies the properties to the proxy. ...

Applies the properties to the proxy.

Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Parameters

  • props : Dictionary

    A dictionary of properties to apply.

Returns

  • void
Fires a synthesized event to any registered listeners. ...

Fires a synthesized event to any registered listeners.

Parameters

  • 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.

Returns

  • void
Gets the value of the apiName property. ...

Gets the value of the apiName property.

  • 3.2.0
  • 3.2.0
  • 3.2.0

Returns

  • String
Gets the value of the bubbleParent property. ...

Gets the value of the bubbleParent property.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Returns

  • Boolean
Titanium.Media.MusicPlayer
( ) : Number
Gets the value of the currentPlaybackTime property. ...

Gets the value of the currentPlaybackTime property.

Returns

  • Number
Gets the value of the lifecycleContainer property. ...

Gets the value of the lifecycleContainer property.

  • 3.6.0

Returns

Titanium.Media.MusicPlayer
( ) : Titanium.Media.Item
Gets the value of the nowPlaying property. ...

Gets the value of the nowPlaying property.

Returns

Titanium.Media.MusicPlayer
( ) : Number
Gets the value of the playbackState property. ...

Gets the value of the playbackState property.

Returns

  • Number
Titanium.Media.MusicPlayer
( ) : Number
Gets the value of the repeatMode property. ...

Gets the value of the repeatMode property.

Returns

  • Number
Titanium.Media.MusicPlayer
( ) : Number
Gets the value of the shuffleMode property. ...

Gets the value of the shuffleMode property.

Returns

  • Number
Titanium.Media.MusicPlayer
( ) : Number
Gets the value of the volume property. ...

Gets the value of the volume property.

Returns

  • Number
Titanium.Media.MusicPlayer
( )
Pauses playback of the current media item. ...

Pauses playback of the current media item.

Returns

  • void
Titanium.Media.MusicPlayer
( )
Begins playback of the current media item. ...

Begins playback of the current media item.

Returns

  • void
Removes the specified callback as an event listener for the named event. ...

Removes the specified callback as an event listener for the named event.

Multiple listeners can be registered for the same event, so the callback parameter is used to determine which listener to remove.

When adding a listener, you must save a reference to the callback function in order to remove the listener later:

var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);

To remove the listener, pass in a reference to the callback function:

window.removeEventListener('click', listener);

Parameters

  • name : String

    Name of the event.

  • callback : Callback<Object>

    Callback function to remove. Must be the same function passed to addEventListener.

Returns

  • void
Titanium.Media.MusicPlayer
( )
Begins seeking backward in the currently playing media. ...

Begins seeking backward in the currently playing media.

Seeking speed increases as seeking continues.

Call stopSeeking to return to normal play.

Returns

  • void
Titanium.Media.MusicPlayer
( )
Begins seeking forward in the currently playing media item. ...

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.

Returns

  • void
Sets the value of the bubbleParent property. ...

Sets the value of the bubbleParent property.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Parameters

  • bubbleParent : Boolean

    New value for the property.

Returns

  • void
Titanium.Media.MusicPlayer
( currentPlaybackTime )
Sets the value of the currentPlaybackTime property. ...

Sets the value of the currentPlaybackTime property.

Parameters

  • currentPlaybackTime : Number

    New value for the property.

Returns

  • void
Sets the value of the lifecycleContainer property. ...

Sets the value of the lifecycleContainer property.

  • 3.6.0

Parameters

Returns

  • void
Titanium.Media.MusicPlayer
( queue )
Sets the media queue. ...

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

Returns

  • void
Titanium.Media.MusicPlayer
( repeatMode )
Sets the value of the repeatMode property. ...

Sets the value of the repeatMode property.

Parameters

  • repeatMode : Number

    New value for the property.

Returns

  • void
Titanium.Media.MusicPlayer
( shuffleMode )
Sets the value of the shuffleMode property. ...

Sets the value of the shuffleMode property.

Parameters

  • shuffleMode : Number

    New value for the property.

Returns

  • void
Titanium.Media.MusicPlayer
( volume )
Sets the value of the volume property. ...

Sets the value of the volume property.

Parameters

  • volume : Number

    New value for the property.

Returns

  • void
Titanium.Media.MusicPlayer
( )
Skips to the beginning of the currently playing media item. ...

Skips to the beginning of the currently playing media item.

Returns

  • void
Titanium.Media.MusicPlayer
( )
Skips to the next media item in the queue. ...

Skips to the next media item in the queue.

If there are no more media items in the queue, ends playback.

Returns

  • void
Titanium.Media.MusicPlayer
( )
Skips to the previous media item in the queue. ...

Skips to the previous media item in the queue.

If there are no previous media items in the queue, ends playback.

Returns

  • void
Titanium.Media.MusicPlayer
( )
Stops playback of the current media queue. ...

Stops playback of the current media queue.

Returns

  • void
Titanium.Media.MusicPlayer
( )
Ends a seek operation and returns to the previous playback state. ...

Ends a seek operation and returns to the previous playback state.

See also: seekForward and seekBackward.

Returns

  • void
Defined By

Events

Titanium.Media.MusicPlayer
deprecated
Fired when the currently playing media item changes. ...

Fired when the currently playing media item changes.

deprecated since 3.0.0

Use <Titanium.Media.MusicPlayer.playingchange> instead.

See nowPlaying to identify the current media item.

Properties

  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.Media.MusicPlayer
Fired when the currently playing media item changes. ...

Fired when the currently playing media item changes.

See nowPlaying to identify the current media item.

  • 3.0.0
  • 3.0.0

Properties

  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.Media.MusicPlayer
deprecated
Fired when the music player's playback state changes. ...

Fired when the music player's playback state changes.

deprecated since 3.0.0

Use <Titanium.Media.MusicPlayer.statechange> instead.

See playbackState to identify the current playback state.

Properties

  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.Media.MusicPlayer
Fired when the music player's playback state changes. ...

Fired when the music player's playback state changes.

See playbackState to identify the current playback state.

  • 3.0.0
  • 3.0.0

Properties

  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.Media.MusicPlayer
deprecated
Fired when the volume changes. ...

Fired when the volume changes.

deprecated since 3.0.0

Use <Titanium.Media.MusicPlayer.volumechange> instead.

This event has been deprecated and renamed volumechange (lower case).

Use the volume property to set or determine the current volume level for this player.

Properties

  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.Media.MusicPlayer
Fired when the volume changes. ...

Fired when the volume changes.

Use the volume property to set or determine the current volume level for this player.

  • 3.0.0
  • 3.0.0

Properties

  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •