No longer maintained.

Gavin Henry (ghenry22) has been maintaining a fork that should be updated and working better than this one. Please use his fork.

https://github.com/ghenry22/cordova-music-controls-plugin

Cordova Music Controls Plugin

Music controls for Cordova applications. Display a 'media' notification with play/pause, previous, next buttons, allowing the user to control the play. Handle also headset event (plug, unplug, headset button).

Supported platforms

Installation

cordova plugin add https://github.com/homerours/cordova-music-controls-plugin

Methods

// Register callback MusicControls.subscribe(events);

// Start listening for events // The plugin will run the events function each time an event is fired MusicControls.listen();


- Toggle play/pause:
```javascript
MusicControls.updateIsPlaying(true); // toggle the play/pause notification button
MusicControls.updateDismissable(true);

List of media button events

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request