External Javascript API
For more advanced applications, litePlayer can be controlled externally using some very basic javascript. You can target a specific player instance by its unique ID and control playback using the functions below.
litePlayer
setup includes instructions for assigning a unique ID to a player instance. Here's how you might target such an instance and call the PLAY function:
document.getElementById('someID').liteplayer_play();See the various
External Control demos for complete code examples.
liteplayer_play()
Starts or resumes playback. Same as clicking the PLAY icon.
liteplayer_pause()
Pauses playback. Same as clicking the PAUSE icon.
liteplayer_stop()
Stops playback and resets the file position to zero.
liteplayer_rewind()
Resets the file position to zero. If already playing, playback resumes from the beginning.
liteplayer_touch()
Starts playback from the beginning. If already playing or paused, playback stops and resumes from the beginning.
liteplayer_touch() differs from liteplayer_play() in that the latter will do nothing if the file is already playing. liteplayer_touch() is best used for short UI sound effects, such as those demonstrated in the Tab Rollover Effects demo.