Music Controls does not work - Subscription don't fire


#1

Hi,
I’m using Ionic 3 + Ionic Native Media + Ionic Native Music Controls but music controls doesn’t works. Clicking Play / Pause using Music Controls nothing happen. Media streaming works well.

I’m testing it on iOS (10.3 / 11) simulator and device, and on Android tablet device.

I’ve installed all cordova plugins required, of course.
I’ve switched ON the ‘Audio’ option in Capabilities -> ‘Background Modes’ using XCODE 9.

I’ve created a minimal ionic blank app from ionic starter, with Media stream (works) and Music Controls (not works), it’s available on github for testing :

Ionic Info:

@ionic/cli-utils : 1.12.0
ionic (Ionic CLI) : 3.12.0

global packages:

cordova (Cordova CLI) : 7.0.1 

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : ios 4.5.1
Ionic Framework    : ionic-angular 3.7.1

System:

ios-deploy : 1.9.2 
ios-sim    : 6.1.2 
Node       : v6.11.2
npm        : 5.4.2 
OS         : macOS Sierra
Xcode      : Xcode 9.0 Build version 9A235

#2

Hi i get the same problem on ionic 1 and now with ionic 3.x
anyone test this plugin ?


#3

I’ve tested a lot of plugins versions, It’s working only using 1.4.1 version.
You need to use this environment:

cordova-plugin-music-controls@1.4.1
ionic-native/music-controls@4.2.1
cordova-ios@4.5.2

Play/pause works, but hasPrev / hasNext are always showed on iOS 11.

Ionic Docs are wrong: on subscribe you have to change the code with this:

'this.musicControls.subscribe().subscribe((action) => {
          switch(action) {

I’ve added a repo with ‘downgrade’ branch that works: