Giter Club home page Giter Club logo

cordova-music-controls-plugin's Introduction

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

  • Create the media controls:
MusicControls.create({
	track       : 'Time is Running Out',		// optional, default : ''
	artist      : 'Muse',						// optional, default : ''
	album       : 'Absolution',     // optional, default: ''
 	cover       : 'albums/absolution.jpg',		// optional, default : nothing
	// cover can be a local path (use fullpath 'file:///storage/emulated/...', or only 'my_image.jpg' if my_image.jpg is in the www folder of your app)
	//			 or a remote url ('http://...', 'https://...', 'ftp://...')
	isPlaying   : true,							// optional, default : true
	dismissable : true,							// optional, default : false

	// hide previous/next/close buttons:
	hasPrev   : false,		// show previous button, optional, default: true
	hasNext   : false,		// show next button, optional, default: true
	hasClose  : true,		// show close button, optional, default: false

	// iOS only, optional
	
	duration : 60, // optional, default: 0
	elapsed : 10, // optional, default: 0
  	hasSkipForward : true, //optional, default: false. true value overrides hasNext.
  	hasSkipBackward : true, //optional, default: false. true value overrides hasPrev.
  	skipForwardInterval : 15, //optional. default: 0.
	skipBackwardInterval : 15, //optional. default: 0.
	hasScrubbing : false, //optional. default to false. Enable scrubbing from control center progress bar 

	// Android only, optional
	// text displayed in the status bar when the notification (and the ticker) are updated
	ticker	  : 'Now playing "Time is Running Out"',
	//All icons default to their built-in android equivalents
	//The supplied drawable name, e.g. 'media_play', is the name of a drawable found under android/res/drawable* folders
	playIcon: 'media_play',
	pauseIcon: 'media_pause',
	prevIcon: 'media_prev',
	nextIcon: 'media_next',
	closeIcon: 'media_close',
	notificationIcon: 'notification'
}, onSuccess, onError);
  • Destroy the media controller:
MusicControls.destroy(onSuccess, onError);
  • Subscribe events to the media controller:
function events(action) {

  const message = JSON.parse(action).message;
	switch(message) {
		case 'music-controls-next':
			// Do something
			break;
		case 'music-controls-previous':
			// Do something
			break;
		case 'music-controls-pause':
			// Do something
			break;
		case 'music-controls-play':
			// Do something
			break;
		case 'music-controls-destroy':
			// Do something
			break;

		// External controls (iOS only)
    	case 'music-controls-toggle-play-pause' :
			// Do something
			break;
    	case 'music-controls-seek-to':
			const seekToInSeconds = JSON.parse(action).position;
			MusicControls.updateElapsed({
				elapsed: seekToInSeconds,
				isPlaying: true
			});
			// Do something
			break;

		// Headset events (Android only)
		// All media button events are listed below
		case 'music-controls-media-button' :
			// Do something
			break;
		case 'music-controls-headset-unplugged':
			// Do something
			break;
		case 'music-controls-headset-plugged':
			// Do something
			break;
		default:
			break;
	}
}

// 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:
MusicControls.updateIsPlaying(true); // toggle the play/pause notification button
MusicControls.updateDismissable(true);
  • iOS Specific Events: Allows you to listen for iOS events fired from the scrubber in control center.
MusicControls.updateElapsed({
	elapsed: 208, // seconds
	isPlaying: true
});

List of media button events

  • Default:
'music-controls-media-button'
  • Android only:
'music-controls-media-button-next', 'music-controls-media-button-pause', 'music-controls-media-button-play',
'music-controls-media-button-play-pause', 'music-controls-media-button-previous', 'music-controls-media-button-stop',
'music-controls-media-button-fast-forward', 'music-controls-media-button-rewind', 'music-controls-media-button-skip-backward',
'music-controls-media-button-skip-forward', 'music-controls-media-button-step-backward', 'music-controls-media-button-step-forward',
'music-controls-media-button-meta-left', 'music-controls-media-button-meta-right', 'music-controls-media-button-music',
'music-controls-media-button-volume-up', 'music-controls-media-button-volume-down', 'music-controls-media-button-volume-mute',
'music-controls-media-button-headset-hook'
  • iOS Only:
'music-controls-skip-forward', 'music-controls-skip-backward'

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

cordova-music-controls-plugin's People

Contributors

0505gonzalez avatar alexious-sh avatar alisonmonteiro avatar cveniamin avatar darthdie avatar filiphsps avatar ghenry22 avatar hdezela avatar homerours avatar jh3141 avatar neoassyrian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-music-controls-plugin's Issues

iOS: notifications/lock-screen time elapsed issue

Hey everyone,

The elapsed time on the iOS controls keep goes out of sync. Everytime you hit pause it goes back to zero. I've seen other apps using this plugin and they too have simply ignored sending time information to the plugin, which works fine in the notifications area (as iOS hides the time bar) but in the lockscreen it shows an ugly empty time bar.

Is there a way to fix this functionality? If not then is there a way to hide the time bar on the lockscreen?

Your help would be greatly appreciated.

(Angular 1.5, Ionic 1.3.2)

Cheers!

[Android] lock screen image

Hi! is there any way to put an image of current song in lock screen? like spotify does? it will be great!

Tags

Hi,

As it's a best pratice, It'd be nice to have release tags (e.g. v1.3.0) for each new version. This way it's possible to point at that very specific version in automation tools (e.g. npm, bower, jenkins), avoiding breaking anything when there is a new release.

Cover from local file

Seeing some issues using local files for covers. If I change to a http:// url to load the image and it works fine and uses the image. If I place a file called absolution.jpg in /albums or even just in the www root and try to load it as per the documentation it is never used and no error is logged to the console.

cover: 'albums/absolution.jpg'
image is not used

cover: 'absolution.jpg'
cover is not used

https://remote.server.com/absolution.jpg
cover IS used.

onSuccess doesn't fire on iOS

Hey everyone,

Hope someone can shed some light on this.

In any iOS build I do the onSuccess callback isn't being called. I've tripled checked the code and it's been implemented as per the documentation. Not sure what is going on here. Please help!


                       $ionicLoading.show({
                             template: '<ion-spinner></ion-spinner>',
                              noBackdrop: true
                         });
                        $cordovaMusicControls.create({
                            track: $rootScope.featuredTrack.name,
                            artist: $rootScope.featuredTrack.track_narrator.name,
                            cover: $rootScope.featuredTrack.thumbnail,
                            duration: $rootScope.featuredTrack.duration,
                            album: $rootScope.featuredTrack.album_.name, //iOS only
                            elapsed: getSeconds(trackvm.mediaModel.currentPosition),
                            ticker: "Now Playing: " + $rootScope.featuredTrack.name, //Android only
                            isPlaying: false,
                            dismissable: false,
                            hasPrev: true, // show previous button
                            hasNext: true, // show next button
                            hasClose: false, // show close button
                        }, onSuccess, onError);

                        function onSuccess() {
                            $log.info('BG player activated.');
                            $ionicLoading.hide();
                        }

                        function onError() {
                            $log.info('BG player failed.');
                            $ionicLoading.hide();
                        }

So in the above code the spinner won't go away in iOS and nor does it fire any of the $log comments. Works just fine in Android. It has been wrapped around a $ionicPlatform.ready(function() {} as well.

I'm doing this on AngularJS 1.5 and ionic 1.3.2

Looking forward to some help on this :)

Cheers!

iOS duration is always elapsed

Found this in the code when I was trying to figure out how I can add prev/next buttons

        NSNumber * duration = [NSNumber numberWithInt:[musicControlsInfo elapsed]];
        NSNumber * elapsed = [NSNumber numberWithInt:[musicControlsInfo elapsed]];

Guess I should tag @0505gonzalez on this?

MusicControls is not defined

heloo, i have question.
i use this plugin and there's an error "Uncaught ReferenceError: MusicControls is not defined"
can someone told me why ?

MusicControls pause and play icon and fuctionality is not toggled.

i tested in android only yet,

In MusicControls updateIsPlaying( panel only pause is showing as icon ) , is it possible to do like normal player pause and play toggle icon as well as event.?

right now i can see only pause icon and even if i clicked many time it's calling pause audio event only,

even if i tried MusicControls.updateIsPlaying(true); still only pause audio not playing again and not even update icon for play/pause toggle.
I am using android 6.0.1

Please help

[Android] Small close button

Hello,

I discovered today in the latest update the function that interested me a lot: a button to close the notification.

I have just one question, is it possible to have the close button in the top right small, to keep the cover in large ?

Like this :
notifications

Thank you.

Vincent

How do I actually use it?

Hi,

I'm developing a music app with cordova.
The question may seem stupid but I can't figure out how to make it work.

I've tried this:

ionic start myapp
cd myapp
cordova plugin add https://github.com/homerours/cordova-music-controls-plugin

Then I created a button and linked it to a function which does .create() .subscribe() and listen() at the MusicControls variable. I've inspected it using chrome and MusicControls is correctly populated. The button click function is being called as well.

When the button is clicked it shows nothing.
I've tried searching for bugs at the plugin source code, both the JS interface and the Java code seem ok to me.

Can you help me?
Thanks in advance

Android 4.1 + does not work notification

I check this plugin android 4.1.2 and 4.2.2 but it does not work,
it only work android 5.
I see this error on logcat.
Do you have a solution ?

01-27 23:21:56.568 26101-26101/com.ionicframework.example403106 W/dalvikvm: VFY: unable to resolve virtual method 137: Landroid/media/AudioManager;.registerMediaButtonEventReceiver (Landroid/app/PendingIntent;)V 01-27 23:21:56.568 26101-26101/com.ionicframework.example403106 W/dalvikvm: VFY: unable to resolve virtual method 139: Landroid/media/AudioManager;.unregisterMediaButtonEventReceiver (Landroid/app/PendingIntent;)V 01-27 23:21:56.578 26101-26101/com.ionicframework.example403106 W/System.err: java.lang.NoSuchMethodError: android.media.AudioManager.registerMediaButtonEventReceiver 01-27 23:21:56.578 26101-26101/com.ionicframework.example403106 W/System.err: at com.homerours.musiccontrols.MusicControls.registerMediaButtonEvent(MusicControls.java:50) 01-27 23:21:56.578 26101-26101/com.ionicframework.example403106 W/System.err: at com.homerours.musiccontrols.MusicControls.initialize(MusicControls.java:75) 01-27 23:21:56.578 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.CordovaPlugin.privateInitialize(CordovaPlugin.java:56) 01-27 23:21:56.583 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:171) 01-27 23:21:56.583 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.PluginManager.exec(PluginManager.java:122) 01-27 23:21:56.583 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59) 01-27 23:21:56.583 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.CordovaBridge.promptOnJsPrompt(CordovaBridge.java:135) 01-27 23:21:56.583 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.engine.SystemWebChromeClient.onJsPrompt(SystemWebChromeClient.java:124) 01-27 23:21:56.583 26101-26101/com.ionicframework.example403106 W/System.err: at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java) 01-27 23:21:56.583 26101-26101/com.ionicframework.example403106 W/System.err: at android.os.Handler.dispatchMessage(Handler.java) 01-27 23:21:56.583 26101-26101/com.ionicframework.example403106 W/System.err: at android.os.Looper.loop(Looper.java) 01-27 23:21:56.588 26101-26101/com.ionicframework.example403106 W/System.err: at android.app.ActivityThread.main(ActivityThread.java) 01-27 23:21:56.588 26101-26101/com.ionicframework.example403106 W/System.err: at java.lang.reflect.Method.invokeNative(Native Method) 01-27 23:21:56.588 26101-26101/com.ionicframework.example403106 W/System.err: at java.lang.reflect.Method.invoke(Method.java:511) 01-27 23:21:56.588 26101-26101/com.ionicframework.example403106 W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java) 01-27 23:21:56.588 26101-26101/com.ionicframework.example403106 W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java) 01-27 23:21:56.588 26101-26101/com.ionicframework.example403106 W/System.err: at dalvik.system.NativeStart.main(Native Method) 01-27 23:21:56.598 26101-26101/com.ionicframework.example403106 W/System.err: java.lang.NoSuchMethodError: android.media.AudioManager.registerMediaButtonEventReceiver 01-27 23:21:56.598 26101-26101/com.ionicframework.example403106 W/System.err: at com.homerours.musiccontrols.MusicControls.registerMediaButtonEvent(MusicControls.java:50) 01-27 23:21:56.598 26101-26101/com.ionicframework.example403106 W/System.err: at com.homerours.musiccontrols.MusicControls.initialize(MusicControls.java:75) 01-27 23:21:56.598 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.CordovaPlugin.privateInitialize(CordovaPlugin.java:56) 01-27 23:21:56.598 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:171) 01-27 23:21:56.603 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.PluginManager.exec(PluginManager.java:122) 01-27 23:21:56.603 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59) 01-27 23:21:56.603 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.CordovaBridge.promptOnJsPrompt(CordovaBridge.java:135) 01-27 23:21:56.603 26101-26101/com.ionicframework.example403106 W/System.err: at org.apache.cordova.engine.SystemWebChromeClient.onJsPrompt(SystemWebChromeClient.java:124) 01-27 23:21:56.603 26101-26101/com.ionicframework.example403106 W/System.err: at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java) 01-27 23:21:56.603 26101-26101/com.ionicframework.example403106 W/System.err: at android.os.Handler.dispatchMessage(Handler.java) 01-27 23:21:56.603 26101-26101/com.ionicframework.example403106 W/System.err: at android.os.Looper.loop(Looper.java) 01-27 23:21:56.603 26101-26101/com.ionicframework.example403106 W/System.err: at android.app.ActivityThread.main(ActivityThread.java) 01-27 23:21:56.603 26101-26101/com.ionicframework.example403106 W/System.err: at java.lang.reflect.Method.invokeNative(Native Method) 01-27 23:21:56.608 26101-26101/com.ionicframework.example403106 W/System.err: at java.lang.reflect.Method.invoke(Method.java:511) 01-27 23:21:56.608 26101-26101/com.ionicframework.example403106 W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java) 01-27 23:21:56.608 26101-26101/com.ionicframework.example403106 W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java) 01-27 23:21:56.608 26101-26101/com.ionicframework.example403106 W/System.err: at dalvik.system.NativeStart.main(Native Method)

Getting error on some LG phones.

This is the error reported:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.ComponentName.getPackageName()' on a null object reference at android.media.AudioManager.registerMediaButtonIntent(AudioManager.java:2542) at android.media.AudioManager.registerMediaButtonEventReceiver(AudioManager.java:2534) at com.homerours.musiccontrols.MusicControls.registerMediaButtonEvent(MusicControls.java:49) at com.homerours.musiccontrols.MusicControls.initialize(MusicControls.java:69) at org.apache.cordova.CordovaPlugin.privateInitialize(CordovaPlugin.java:54) at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:169) at org.apache.cordova.PluginManager.exec(PluginManager.java:120) at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59) at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41) at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method) at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:37) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.os.HandlerThread.run(HandlerThread.java:61)

I have absolutely no idea what that means...

Style options

Is it possible to have any control over the visual style of the Android notification control?

I'd prefer it to have a solid black background (not grey) and to use custom icons (I.e. the ones from https://www.google.com/design/icons)

iOS: hasPrev/hasNext

I set these properties to false, but the music controls on iOS still show the prev/next buttons.

Use controls without media, for streamed media?

Is it possible to somehow create the controls and indicate the duration of a medium, without specifying a media file?

This would be useful for applications that stream media on demand. It would allow the user to seek to an arbitrary position and a callback would send the requested position to the server, which would in turn seek to that position in the local media file and stream from there on.

Plugin does not work

I have a problem the plugin does not work on my android device I did all the steps, I downloaded the git through the console. I added the plugin to config.xml then create a js with the following code

`MusicControls.create({
    track       : 'Time is Running Out',        // optional, default : ''
      artist      : 'Muse',                     // optional, default : ''
    cover       : '',      // optional, default : nothing
    // cover can be a local path (use fullpath 'file:///storage/emulated/...', or only 'my_image.jpg' if my_image.jpg is in the www folder of your app)
    //           or a remote url ('http://...', 'https://...', 'ftp://...')
  isPlaying   : true,                           // optional, default : true
    dismissable : true,                         // optional, default : false

    // hide previous/next/close buttons:
    hasPrev   : false,      // show previous button, optional, default: true
    hasNext   : false,      // show next button, optional, default: true
    hasClose  : true,       // show close button, optional, default: false

  // iOS only, optional
  album       : 'Absolution',     // optional, default: ''
  duration : 60, // optional, default: 0
  elapsed : 10, // optional, default: 0

    // Android only, optional
    // text displayed in the status bar when the notification (and the ticker) are updated
    ticker    : 'Now playing "Time is Running Out"'
}, onSuccess, onError);`

And call it in the index.html
<script type="text/javascript" src="js/music-control.js"></script>

But nothing appears on the notification bar

I also use the code on the play buttons but nothing like that does not work

MusicControls.updateIsPlaying(true);

Hide next/previous

Could it be possible to add the ability to hide the next/previous buttons when creating/updating the notification? People tell me its confusing when they're at the end of a playlist but the "next" button is still there.

iOS: update playback rate

Please expose this API. The Cordova Media Plugin supports playback rate on iOS. The Music Controls Plugin should have the same support so that the playback timeline can be in sync.

MusicControls.create is undefined

MusicControls is called in a function
function playmusic(){
try {
MusicControls.create({
track : 'My track',
artist : 'my subttile',
cover : 'img/Musical Notes-100.png',
isPlaying : true,
ticker : 'Now playing ......'
}, onSuccess, onError);
}catch(e){
console(e.message);
}
}
console(e.message); Returns MusicControls.create is undefined please how do I solve this?

Doesn't work on LG V10, Android 5.1.1

Lockscreen controls and metadata do not appear on an LG V10 running Android 5.1.1. Used the same code successfully on a Nexus 7 also running Android 5.1.1.

Cover image is being reloaded every time create() is called

What do you think about caching the cover image?
I'm loading images from other server and it takes too much time to Create() terminate. When changing the music it's ok, since there is new data, but it's pretty dumb to re-download the image everytime user play/pause music.

Maybe creating a method 'tooglePlay()', which would recreate the notification using the same info just toggling the isPlaying would be a better approach.

I want to create a pull request for data, but I don't know when I'll have available time. Maybe this Sunday I'll do that.

Let me know what you think about so we can work on it.

Problem with app when it is closed

When you close the app and reopen, a new control is created in the notification bar.
How to destroy the control before exit the app, or destroy when open it?

captura de tela de 2015-10-08 09 20 59

App just crash android 5.1

Trying the following code (and everything ... after the device is ready obviously) in android 5.1 doesn't work :( the app just crashes

MusicControls.create({
    track       : 'Time is Running Out',        // optional, default : ''
    artist      : 'Muse',                       // optional, default : ''
    //cover       : 'albums/absolution.jpg',      // optional, default : nothing
    isPlaying   : true,                         // optional, default : true
    dismissable : true,                         // optional, default : false

    // hide previous/next/close buttons:
    hasPrev   : false,      // show previous button, optional, default: true
    hasNext   : false,      // show next button, optional, default: true
    hasClose  : true,       // show close button, optional, default: false

    // Android only, optional
    // text displayed in the status bar when the notification (and the ticker) are updated
    //ticker    : 'Now playing "Time is Running Out"'
});

Is this version of android unsupported ?

Support Samsung's Always-On display

We get reports from our Samsung users that they expect track updates to appear on Samsung's Always-On display, like the way Spotify and others do it (see attached picture). I was expecting this to work out of the box once the track information is pushed to the OS via this plugin, but apparently it doesn't?

Can this be implemented in cordova-music-controls-plugin?

samsung-always-on

Play / Pause / Next / Previous Buttons are not visible

Hello,

I am not able to see play,next and previous buttons on xiomi redmi prime 2 phone which has android kitkat 4.4.4 and MIUI7. It is working on Sony xperia and other android phones but not on MIUI. Please check the issue. Thanks.

stopped when app in background

Hi

i am using shoutcast mp3 url as media and its playing fine in app but when app in background and controls showing in toolbar after certain seconds player get stopped

MusicControls notification doesn't notice app being killed

I noticed that the MusicControls notification keeps getting shown when my app is "killed" by Android after a period of inactivity. If the app is "paused", i.e. put in the background, and I terminate it manually (by swiping it from the recent apps list), the MusicControls notification is closed after a short delay (1-3 sec).
If I keep it in the background, e.g. over night, the app will get killed silently at some time. Apparently, MusicControls does not notice this, and prev/play/next buttons will no longer work. Clicking the track image will restart the app, splash screen and all, though.

Can we have updateDismissable(boolean) added

Hi guys,
Can we have a method to update the "dismissable" property of the notification without re-creating the whole control? Would like to be able to update this when the media is playing/pausing.

Should be similar to updateIsPlaying(boolean)

case 'music-controls-play': don't work

every case work find just case 'music-controls-play': it's don't work can you tell me why? this is my function
function events(action) {
switch(action) {
case 'music-controls-next':
$scope.skip();
break;
case 'music-controls-previous':
$scope.back();
break;
case 'music-controls-pause':
$scope.stop();
break;
case 'music-controls-play':
console.log("play click");
$scope.playMedia(playing);
break;
default:
break;
}
}
play click don't show
sorry for my English :"(

play pause toggle not working

I've tried two ways (on android), i guess im just missing something simple :

`            
            case 'music-controls-pause':
                angular.element(document.getElementById('cont')).scope().playBtn().$apply();
                MusicControls.updateIsPlaying(true);
                console.log("pause");
           
                break;

                case 'music-controls-play':
                    angular.element(document.getElementById('cont')).scope().playBtn().$apply();
                    MusicControls.updateIsPlaying(false);///(or this?)//// isPlaying: false,
                    console.log("pause");

                    break;

and other way :

`               case 'music-controls-media-button-play-pause':
                    angular.element(document.getElementById('cont')).scope().playBtn().$apply();
                    if (MusicControls.updateIsPlaying(false)) {
                        MusicControls.updateIsPlaying(true);///(or this?)//// isPlaying: true,
                    }
                    else {
                        MusicControls.updateIsPlaying(false);
                    }
                    break;`

How to update notification?

If I skip a song it doesn't update the notification with the correct info, is there an update/modify function available to edit the notification/music player?

Local image asset isn't found

When passing in an image file that exists locally within the app Android is unable to find the file:

window.MusicControls.create({
                    track: 'Title',
                    artist: 'Artist',
                    cover: 'img/logo.jpg',
                    isPlaying: false,
                    dismissable: true,
                    hasPrev: false,
                    hasNext: false,
                    hasClose: true
                });
03-03 15:40:38.771 31274 31290 W System.err: java.io.FileNotFoundException: img/logo.jpg: open failed: ENOENT (No such file or directory)

On a OnePlus One running Android 6.0.1

How to create in Ionic 2

Hi!
Thanks for this plug-in (I think)
I can't get it to work in my Ionic 2 project. It has probably nothing to do with the plugin it self.
In my ts I have:
import {MusicControls} from 'ionic-native';
//--
showMusicControls = function(){
MusicControls.create({
track : 'Time is Running Out', // optional, default : ''
artist : 'Muse', // optional, default : ''
cover : 'albums/absolution.jpg', // optional, default : nothing
}, onSuccess, onError);

};

But I get three errors:
Cannot find name 'onSuccess'.at line
Cannot find name 'onError'.at line
Supplied parameters do not match any signature of call target.at line

Can you please show how to create Musiccontrols in Ionic 2?

Different music-controls-media-button events

Hi,
music-controls-media-button works great but wouldn't it be better to send the keyCode, for example, as a second parameter to the "MusicControls.subscribe(events)" function since the variable "KeyEvent event" in MusicControlsBroadcastReceiver.java already has that value?

Then one could have different actions for example:
KEYCODE_MEDIA_PREVIOUS
KEYCODE_MEDIA_NEXT

My car acts as a bluetooth headset for my phone and all media control keys just fire the music-controls-media-button event and I can't differentiate the prev/next event from play/pause event.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.