Skip to content

Commit

Permalink
Merge pull request #14 from ghenry22/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ghenry22 committed Feb 12, 2020
2 parents 430a2b1 + 285a894 commit 57c7fd4
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 20 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
# Cordova Music Controls Plugin
# Cordova Music Controls Plugin 2

<img src='https://imgur.com/fh3ACOq.png' width='564' height='342'>

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).
Music controls for Cordova applications. Display a 'media' notification with play/pause, previous, next buttons, allowing the user to control the play. Handles headset events (plug, unplug, headset button).

This plugin is forked from the original which is no longer maintained but which can be found at:
https://github.com/homerours/cordova-music-controls-plugin

This plugin is renamed as cordova-plugin-music-controls2 for easy differentiation and to allow for publishing
updates to npm to make life easier for everyone.

## Supported platforms
- Android (4.1+)
- Android (4.1+) ([homerours](https://github.com/homerours))
- Windows (10+, by [filfat](https://github.com/filfat))
- iOS 8+ (by [0505gonzalez](https://github.com/0505gonzalez))

## Installation
`cordova plugin add https://github.com/ghenry22/cordova-music-controls-plugin`
- Current release
`npm install cordova-plugin-music-controls2`
- Bleeding edge direct from github
`cordova plugin add https://github.com/ghenry22/cordova-plugin-music-controls2`

## Methods
- Create the media controls:
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "cordova-music-controls",
"version": "2.2.1",
"name": "cordova-plugin-music-controls2",
"version": "3.0.3",
"description": "Music controls for Cordova apps",
"cordova": {
"id": "cordova-music-controls",
"id": "cordova-plugin-music-controls2",
"platforms": ["android", "windows", "ios"]
},
"repository": {
"type": "git",
"url": "git+https://github.com/yoojene/cordova-music-controls.git"
"url": "git+https://github.com/ghenry22/cordova-plugin-music-controls2.git"
},
"keywords": [
"cordova",
Expand All @@ -25,14 +25,14 @@
"engines": [
{
"name": "cordova",
"version": ">=3.4.0"
"version": ">=4.0.0"
}
],
"author": "homerours",
"author": "ghenry22",
"license": "MIT",
"bugs": {
"url": "https://github.com/yoojene/cordova-music-controls/issues"
"url": "https://github.com/ghenry22/cordova-plugin-music-controls2/issues"
},
"homepage":
"https://github.com/yoojene/cordova-music-controls#readme"
"https://github.com/ghenry22/cordova-plugin-music-controls2#readme"
}
16 changes: 10 additions & 6 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-music-controls"
version="2.2.1">
<name>MusicControls</name>
id="cordova-plugin-music-controls2"
version="3.0.3">
<name>Music Controls</name>
<keywords>cordova,music,controller,controls,media,plugin,notification,lockscreen,now,playing</keywords>
<repo>https://github.com/yoojene/cordova-music-controls</repo>
<repo>https://github.com/ghenry22/cordova-plugin-music-controls2</repo>
<description>Music controls for Cordova apps</description>
<license>MIT</license>
<author>HomerOurs</author>
<author>ghenry22</author>

<engines>
<engine name="cordova" version=">=3.4.0"/>
<engine name="cordova" version=">=4.0.0"/>
</engines>

<asset src="www/MusicControls.js" target="js/MusicControls.js"/>
Expand All @@ -29,6 +29,10 @@

<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
</config-file>

<config-file target="AndroidManifest.xml" parent="/manifest/application">
Expand Down
4 changes: 2 additions & 2 deletions src/android/MusicControlsNotification.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public MusicControlsNotification(Activity cordovaActivity,int id){
// use channelid for Oreo and higher
if (Build.VERSION.SDK_INT >= 26) {
// The user-visible name of the channel.
CharSequence name = "cordova-music-controls-plugin";
CharSequence name = "Audio Controls";
// The user-visible description of the channel.
String description = "cordova-music-controls-plugin notification";
String description = "Control Playing Audio";

int importance = NotificationManager.IMPORTANCE_LOW;

Expand Down
7 changes: 7 additions & 0 deletions src/android/MusicControlsNotificationKiller.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,11 @@ public void onCreate() {
mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNM.cancel(NOTIFICATION_ID);
}

@Override
public void onDestroy() {
mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNM.cancel(NOTIFICATION_ID);
}

}

0 comments on commit 57c7fd4

Please sign in to comment.