node-osx-mediacontrol
Allows to monitor and control iTunes and Spotify from Node on macOS
Last updated 3 years ago by mderezynski .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install node-osx-mediacontrol 
SYNC missed versions from official npm registry.

node-osx-mediacontrol

This module allows to control iTunes and Spotify on macOS; it is possible to register a callback to be notified of the app's state.

For now, only iTunes is implemented with the functionality:

* Receive status updates (playback state changes)
* Control play, Control pause

Example usage:


  const MediaControl = require('node-osx-mediacontrol');
   
  ...

  /* Registers to listen to iTunes events */
  MediaControl.iTunes.observe(function(state) {
    
	switch (state) {
	    case MediaControl.ITUNES_STOPPED:
		/* do something */
		break;
	    case MediaControl.ITUNES_PLAYING;
		/* do something */
		break;
	    case MediaControl.ITUNES_PAUSED:
		/* do something */
		break;
  });

  MediaControl.iTunes.controlPause();

  MediaControl.iTunes.controlPlay();

  /* This will stop the module from listening to iTunes events */
  /* You can still use the control*() functions to control iTunes */
  MediaControl.iTunes.ignore();

Current Tags

  • 0.0.2                                ...           latest (3 years ago)

2 Versions

  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (3)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |