The mediaplayer interface module
Interface to various media players
The mediaplayer module is an interface to various popular media players. It allows controlling them remotely to a certain degree and retrieving the information about the currently played media (in order to implement the nice /playing scripts). The module has replaced the old mediaplayer module which after years of development had developed some design flaws and needed a complete rewrite. At the moment of writing the supported players are: XMMS (UNIX), Audacious (UNIX), Winamp (Windows), every player supported by the AMIP project (Windows), every player using the MPRIS D-Bus interface (Amarok2, JuK under KDE). You choose the player interface by either setting the option in the settings dialog, by manually setting option stringPreferredMediaPlayer or by running mediaplayer.detect that will guess the media player interface for you.
If you're going to use the Winamp media player then you must install the gen_kvirc.dll plugin (included in the KVIrc distribution) as a general Winamp plugin. This is achieved by simply copying the file gen_kvirc.dll to the Winamp plugins directory and restarting Winamp.

The commands and functions exported by this module serve mainly for two purposes: control the playback and get information about the currently played media. Playback control is achieved by the means of mediaplayer.play, mediaplayer.stop, mediaplayer.pause, mediaplayer.next, mediaplayer.prev and $mediaplayer.status(). The information about the currently played media can be retrieved with $mediaplayer.nowplaying() and $mediaplayer.mrl().

Several other informative function are available as well but they are not granted to work with all the supported media players or media types (e.g. with Winamp you can play video files that probably have no album, genre or sampleRate information).

If you intend to write portable code, you should check the return value of the functions like $mediaplayer.artist(), $mediaplayer.title() or $mediaplayer.channels() and be ready to discard it when it does not appear to be meaningful. The functions that are granted to work are $mediaplayer.nowplaying(), $mediaplayer.mrl() and $mediaplayer.localfile().

Index, Modules