MusicControl

Control default music player for Android from Cordova/Phonegap/Steroids.
Dustin Blackman0.0.10
platforms: android
$ cordova plugin add com.dustinblackman.plugin.MusicControl

Android Music Control plugin

A Cordova/Phonegap/SteroidsJS plugin that allows you to use basic controls of the default music player on Android. The commands are based off the MediaPlaybackService source code.

This plugin is still in development and shouldn't be considered in a production environment.

Usage

play(err, callback)

Play last track.

Example:

musicControl.play(function(err, cb) {
  if (err) {
    console.log(err);
  }
  return console.log(cb);
});

stop(err, callback)

Stop track.

Example:

musicControl.stop(function(err, cb) {
  if (err) {
    console.log(err);
  }
  return console.log(cb);
});

pause(err, callback)

Pause track.

Example:

musicControl.pause(function(err, cb) {
  if (err) {
    console.log(err);
  }
  return console.log(cb);
});

togglepause(err, callback)

Toggle between Paused and Play.

Example:

musicControl.togglepause(function(err, cb) {
  if (err) {
    console.log(err);
  }
  return console.log(cb);
});

previous(err, callback)

Play previous track

Example:

musicControl.previous(function(err, cb) {
  if (err) {
    console.log(err);
  }
  return console.log(cb);
});

next(err, callback)

Play next track

Example:

musicControl.next(function(err, cb) {
  if (err) {
    console.log(err);
  }
  return console.log(cb);
});