playback

Control the iTunes transport and receive track change events

playback

Control the iTunes transport on OS X and Windows and receive track change events

example

If you are in public, plug in some headphones or lower your volume, then:

var itunes = require('playback');
itunes.on('playing', function(data){ console.dir(data);} );
itunes.on('paused', function(data){ console.log('paused');} );
itunes.play();

Pause, play, and change tracks in iTunes and watch the Node console.

methods

var itunes = require('playback')

Start playing the current track. If callback is not defined emits a playing event with an object argument representing the current track:

{
    name: 'Dance Yrself Clean',
    artist: 'LCD Soundsystem',
    album: 'This Is Happening'
}

If callback is defined it is called with the same object.

Pause playback. If callback is not defined emits a paused event with the following object:

{ ok: "true" }

If callback is defined it is called with the same object.

Stop playback. If callback is not defined emits a stopped event with the following object:

{ ok: "true" }

If callback is defined it is called with the same object.

Get information about the currently playing track. If callback is not defined emits a playing event with an object argument representing the current track:

{
    name: 'Lizzy',
    artist: 'Melvins',
    album: 'Houdini'
}

If callback is defined it is called with the same object.

Skip to the next song in the current playlist. Start playing if iTunes is paused or stopped. If callback is not defined emits a playing event with an object argument representing the current track:

{
    name: 'Going Blind',
    artist: 'Melvins',
    album: 'Houdini'
}

If callback is defined it is called with the same object.

Skip to the previous song in the current playlist. Start playing if iTunes is paused or stopped. If callback is not defined emits a playing event with an object argument representing the current track:

{
    name: 'Night Goat',
    artist: 'Melvins',
    album: 'Houdini'
}

If callback is defined it is called with the same object.

Slowly decrease the iTunes volume to zero, stop playback, then return the volume to the level at which it was set before the fade out began.

Set the iTunes volume to zero, start playback, then slowly return the volume to the original level.

install

With npm do:

npm install playback

release notes

Add setVolume command (Windows only)

Windows support

Initial release