Skip to content

caffeinalab/ti.musicplayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ti.MusicPlayer

com.caffeinalab.titanium.musicplayer

A simple Music player widget.

image

Installation

Via Gittio

gittio install com.caffeinalab.titanium.musicplayer

Via Github

Download the latest release, unzip in app/widgets and add in your config.json, under dependencies:

"dependencies": {
    "com.caffeinalab.titanium.musicplayer": "*"
}

Usage

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()

API

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()

Play current track.

stop()

Stops the currently playing audio and releases the memory.

pause()

Pauses the currently playing audio.

setPlaylist(Track[])

Set the playlist to use in the player.

setPlaylistIndex(Number)

Set the current index track in the playlist

deletePlaylist

Delete the current playlist. You can use setTrack to set a single track to play.

setTrack(Track)

Override the current track.

Events

play

Fired when the play function is called either from the widget's UI or programmatically

Passed arguments:

  • Track

pause

Fired when the pause function is called either from the widget's UI or programmatically

Passed arguments:

  • Track

stop

Fired when internally when the music reaches the end or when the stop function is called programmatically

progress

Fired continuously while the music is playing.

Passed arguments:

  • Track

About

Widget for titanium to manage playing audio files

Resources

License

Stars

Watchers

Forks

Packages

No packages published