Controlling BTplay

From Chumby Wiki
Revision as of 14:14, 5 March 2008 by Chumby (Talk | contribs)

Jump to: navigation, search

BTPlay is an external music player that is used by the chumby Control Panel to play audio files and streams asynchronously. It is implemented as a persistent daemon that is controlled by a UNIX pipe, typically from the Flash Lite Player, or through some stub applications.

Several ASnative() calls have been added to the Flash Lite implementation to control this daemon. These calls are only available to movies run locally - they cannot be called from widgets.

PlayAudio

_PlayAudio = ASnative(5,151);
_PlayAudio('/mnt/usb/somemusicfile.mp3');

PlayLoopCount

_PlayLoopCount = ASnative(5,146);
_PlayLoopCount(10);

Sets the number of times the next file provided to PlayAudio will play.

StopAudio

_StopAudio = ASnative(5,134);
_StopAudio();

PauseAudio

_PauseAudio = ASnative(5,132);
_PauseAudio();

ResumeAudio

_ResumeAudio = ASnative(5,133);
_ResumeAudio();

PlayerState

_PlayerState = ASnative(5,131);
playerState = _PlayerState();

returns -1 if player daemon not running, 0 if paused, 2 if playing a track

SongAttributes

_SongAttributes = ASnative(5,135);
attrs = _SongAttributes();

returns XML of the information about the currently playing track, typically MP3 tags and other metadata