cordova-music-controls-plugin icon indicating copy to clipboard operation
cordova-music-controls-plugin copied to clipboard

Doesn't work on ios11.

Open thesayyn opened this issue 6 years ago • 27 comments

This is my ionic project. plugin working on android as well but in ios 11 doesn't;

IOS Version : 11.0.2

Source code : https://github.com/thesayyn/media-controls

thesayyn avatar Jan 03 '18 15:01 thesayyn

I had the same issue with iOS 11.0.2. The issue even occurred with Spotify users. One thing you have to do is to reboot your phone and the play something with the default music player.

jkapongo avatar Jan 12 '18 22:01 jkapongo

do you know is there any chance to change priority? thanks

thesayyn avatar Jan 13 '18 07:01 thesayyn

Please help me, I've tried it on my own and I have not been able to fix it, I'll be waiting for it :(

JuanSeBestia avatar Jan 15 '18 16:01 JuanSeBestia

In a Cordova projects work, but in Ionic a proyect fail

JuanSeBestia avatar Jan 15 '18 20:01 JuanSeBestia

@thesayyn it's not a matter of priority. You just have to run the default music player once; and after that, it'll be working properly.

jkapongo avatar Jan 15 '18 22:01 jkapongo

@jsdussanc it works for me with in Ionic. What failure are you encountering?

jkapongo avatar Jan 15 '18 22:01 jkapongo

In the last iOS update, the title, artist, image never change, and the events are not linked to the buttons. Only see the src of te audio. Also create a new project with your plugin and an

I've tried it with my Iphone 5s 11.2.2

Edit: Xcode: 9.2 I'm debug all lines in Xcode and run correctly, but in the promise of create in js or ts, never resolve, never run then or catch

JuanSeBestia avatar Jan 17 '18 16:01 JuanSeBestia

Help me! :(

JuanSeBestia avatar Jan 18 '18 22:01 JuanSeBestia

@jsdussanc same here, in android it's works fine. but in ios same as your problem.

thesayyn avatar Jan 19 '18 05:01 thesayyn

@jsdussanc and @thesayyn , I made a PR which links events to the buttons such as play/pause/next/prev. I don't know if that's your problem but you should consider it. I was only able to receive events for music-controls-skip-forward/backward but not for media-controls-play/pause/next/prev. With my #112, you should be able to receive them. I hope it helps!

CVeniamin avatar Jan 19 '18 14:01 CVeniamin

We try it, but it didn't work, thanks for the help 6a1b701d-35e3-4b89-a803-91268a8a3d39

JuanSeBestia avatar Jan 19 '18 15:01 JuanSeBestia

@CVeniamin could you try with my repo ? Source code : https://github.com/thesayyn/media-controls

thesayyn avatar Jan 19 '18 16:01 thesayyn

@thesayyn, I don't have ionic installed.... @jsdussanc, what's your configuration? My musicOptions look like this

var musicOptions = {
	isPlaying   : false, // optional, default : true
	dismissable : true, //not relevant to iOS
	hasScrubbing : true
};

I only change isPlaying after MusicControls.create() using MusicControls.updateIsPlaying(true);

CVeniamin avatar Jan 19 '18 17:01 CVeniamin

Nope, in xcode the log console drop this message: THREAD WARNING: ['MusicControls'] took '14.559082' ms. Plugin should use a background thread. :/

JuanSeBestia avatar Jan 19 '18 21:01 JuanSeBestia

I do have installed this plugin to enable background audio https://github.com/EddyVerbruggen/cordova-plugin-backgroundaudio

CVeniamin avatar Jan 19 '18 22:01 CVeniamin

Yes I tried @CVeniami

JuanSeBestia avatar Jan 20 '18 18:01 JuanSeBestia

if you uninstall the ionic-web-view, it works, but that plugin is too functional, it improves the response times a lot. I tried many alternatives that would reproduce the audio content via the Web and the control menu, but nothing worked for me.

Finally I will choose to switch to play audio content natively with ionic-native-media or something similar, that way ir work well.

JuanSeBestia avatar Jan 20 '18 18:01 JuanSeBestia

I tested ionic-webview plugin which includes WKWebview and I can confirm that it "overrides" the controls. Using UIWebview however the issue doesn't appear. It seems that WKWebview is in controls of media playback thus this plugin isn't able to "take over" media controls.

CVeniamin avatar Jan 26 '18 15:01 CVeniamin

This issue was also reported on telerik wkwebview plugin. I tried to apply same "patch" but without success. Also found other users with same problem, as commented in a SO question , stating that it's by design and one can't override wkwebview.

CVeniamin avatar Jan 30 '18 20:01 CVeniamin

I can confirm I am also having problems with music controls in an Ionic project, where it has been working before. Still works on Android, but the Music Controls create neither calls success or fail callback on iOS. In my case I am not even having the music controls appear, let alone the events.

westphalen avatar Feb 24 '18 05:02 westphalen

I found that it depends on how you build the cordova project prior to running it in XCode. For example, when running in non-production mode (i.e. ionic cordova build ios) it does not work once you disconnect the iOS device. However, if you build in production mode:ionic cordova build ios --prod, and then run in xcode, it works properly.

Also as mentioned, the background audio plugin is also required (i.e. cordova-plugin-backgroundaudio).

Please also run it on an actual iOS device; the emulator, at least for does not seem to work.

jkapongo avatar Feb 24 '18 23:02 jkapongo

I have gotten it working by ignoring the create Promise/callback and calling updateIsPlaying and listen directly after. Seems odd to ignore the promise, but it works for some reason. This only applies to iOS, worked fine on Android.

westphalen avatar Feb 26 '18 02:02 westphalen

Yes, from the beginning I always ignored the promise in iOS, I really did not probe if I served in prod mode, but then I left it like this: v. what I did see is that the seekTo is a bug in iOS 11, but it is already Apple, if you get in the progress bar out of the point to realice seek, it is bugged for ever... I deprecated this functionality for the moment

JuanSeBestia avatar Mar 01 '18 15:03 JuanSeBestia

I also had problems with the interaction when the screen is blocked and the app was foreground, if you also have this symptom, you can use my version of cordova-background-mode https://github.com/jsdussanc/cordova-plugin-background-mode

JuanSeBestia avatar Mar 01 '18 15:03 JuanSeBestia

Has anybody managed to get this working in iOS 11 with WKWebview? Using UIWebview is no longer a valid option. It works perfectly in iOS 10 but for iOS 11 nothing shows up. If you have managed to get this working can you please post your ionic version and relevant plugin versions and the implementation code you used? Thank you!

kevryan2 avatar Jul 27 '18 19:07 kevryan2

You need user cordova-media I make you the fa of the packages.

{
  "name": "latotuga",
  "version": "0.0.1",
  "author": "Inkremental",
  "homepage": "https://www.inkremental.co",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/animations": "5.0.3",
    "@angular/common": "5.0.3",
    "@angular/compiler": "5.0.3",
    "@angular/compiler-cli": "5.0.3",
    "@angular/core": "5.0.3",
    "@angular/forms": "5.0.3",
    "@angular/http": "5.0.3",
    "@angular/platform-browser": "5.0.3",
    "@angular/platform-browser-dynamic": "5.0.3",
    "@ionic-native/app-version": "^4.7.0",
    "@ionic-native/background-mode": "^4.5.3",
    "@ionic-native/core": "4.4.0",
    "@ionic-native/file": "^4.5.3",
    "@ionic-native/google-analytics": "^4.7.0",
    "@ionic-native/http": "^4.5.3",
    "@ionic-native/in-app-browser": "^4.5.3",
    "@ionic-native/keyboard": "^4.7.0",
    "@ionic-native/music-controls": "^4.5.3",
    "@ionic-native/network": "^4.5.3",
    "@ionic-native/onesignal": "^4.7.0",
    "@ionic-native/splash-screen": "4.4.0",
    "@ionic-native/status-bar": "4.4.0",
    "@ionic/storage": "2.1.3",
    "cordova-android": "7.1.1",
    "cordova-fabric-plugin": "^1.1.14-dev",
    "cordova-ios": "4.5.4",
    "cordova-plugin-advanced-http": "^1.11.1",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-background-mode": "git+https://github.com/jsdussanc/cordova-plugin-background-mode.git#latotuga",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-google-analytics": "^1.8.3",
    "cordova-plugin-inappbrowser": "^1.7.2",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.2.1",
    "cordova-plugin-media": "git+https://github.com/jsdussanc/cordova-plugin-media.git#latotuga",
    "cordova-plugin-music-controls": "git+https://github.com/jsdussanc/cordova-music-controls-plugin.git#latotuga",
    "cordova-plugin-network-information": "^1.3.4",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-sqlite-storage": "^2.3.3",
    "ionic-angular": "3.9.2",
    "ionic-audio": "^3.2.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "onesignal-cordova-plugin": "^2.4.1",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.5",
    "typescript": "^2.4.0"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-device": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-file": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-background-mode": {},
      "cordova-plugin-media": {
        "KEEP_AVAUDIOSESSION_ALWAYS_ACTIVE": "NO"
      },
      "cordova-plugin-music-controls": {},
      "cordova-plugin-advanced-http": {},
      "onesignal-cordova-plugin": {},
      "cordova-plugin-google-analytics": {},
      "cordova-plugin-app-version": {},
      "cordova-fabric-plugin": {
        "FABRIC_API_KEY": ":P",
        "FABRIC_API_SECRET": ":P"
      }
    },
    "platforms": [
      "android",
      "ios"
    ]
  }
}

But of the code, I could not.

JuanSeBestia avatar Jul 27 '18 21:07 JuanSeBestia

@442623641 It's an interesting question, but the answer depends more on your purpose of using the app.

Although I do not understand why you mention it in this issue

JuanSeBestia avatar Oct 29 '18 18:10 JuanSeBestia