A simple Music player widget.
gittio install com.caffeinalab.titanium.musicplayer
Download the latest release, unzip in app/widgets
and add in your config.json, under dependencies
:
"dependencies": {
"com.caffeinalab.titanium.musicplayer": "*"
}
var mp = Alloy.createWidget('com.caffeinalab.titanium.musicplayer');
mp.setPlaylist([{
id: "",
url: 'http://google.com',
cover: "http://google.com",
artist: "",
album: "",
track: 1
}]);
mp.setPlaylistIndex(0);
mp.play()
The Track
object is:
id
: Usually the model id but can be whatever you want. It is not used internally but it is recommended.url
: The link to the audio.cover
: Link to the cover image.artist
: The artist of the sound track.album
: The album where the sound track is featured.index
: Track index
Play current track.
Stops the currently playing audio and releases the memory.
Pauses the currently playing audio.
Set the playlist to use in the player.
Set the current index track in the playlist
Delete the current playlist. You can use setTrack
to set a single track to play.
Override the current track.
Fired when the play function is called either from the widget's UI or programmatically
Passed arguments:
Track
Fired when the pause function is called either from the widget's UI or programmatically
Passed arguments:
Track
Fired when internally when the music reaches the end or when the stop function is called programmatically
Fired continuously while the music is playing.
Passed arguments:
Track