mplayer-as-promised
Simple mplayer (http://www.mplayerhq.hu/) wrapper for use in node written in Typescript and presenting a promise-heavy API. The library currently is geared towards audio playback applications.
Usage
Import the module and create an instance of the MPlayer object
;
Open a file for playback (playback starts when the file is opened)
;mplayer.openFile'/path/to/file.wav'.then;
Pause a playing item
item.pause.then;
Play a paused item
item.play.then;
Stop an item (the item cannot be replayed - openFile() must be called again)
item.stop.then;
Listen to an item (resolves when the item is complete or stop() has been called)
item.listen.then;
Seek to a specific time in an item (in seconds)
item.seekTo120.then;
Seek by an offset from the current position (in seconds)
item.seekBy-20.then;
Get the current position in the track in seconds
item.getCurrentTime.then;
Get the current position in the track as a percentage
item.getCurrentPercent.then;
Shutdown mplayer
mplayer.shutdown.then;