[Solved] No more native audio with iOS 10 (9.3 is fine)


#1

I’ve built an App some time ago using ionic Native Audio. It worked perfectly on iOS and Android, until … iOS10

As soon as the devices updated to iOS10 no audio is playing any more. But there is no error or anything else, there is just no audio output any more. Android still works, and iOS 9.3 works, too.

The bug can be reproduced in iOS Simulator like this:

ionic emulate --target="iPhone-6s, 10.0"

vs.

ionic emulate --target="iPhone-6s, 9.3"

The 9.3 simulator works and plays the audio as expected. In the 10.0 simulator there is only silence, the same on real devices.

The code is pretty straight forward:

in the constructor:

NativeAudio.preloadComplex('uniqueId1', 'assets/test.mp3', 1, 1, 0);

then waiting for a button (click):

clickButton() {
  NativeAudio.loop('uniqueId1');
}

Any one has an idea or some hints?


#2

Not quite sure, but it might be because CSP in Safari has gotten much more strict. Also Ionic 2 still doesn’t support iOS 10 officially. For more information check out the following issue (also take a look at the linked topic):


#3

Indeed, removing this line fixed the problem and the Native Audio is playing again!

Thanx a lot!


#4

Ok, great, I’m glad that it solved your problem. However I would say that it’s more a workaround rather than a real solution. Therefore I would recommend you to subscribe/vote for the issue and fix your code once a real solution is available.


#5

I don’t have that line in my index.html, and I can’t play any audio yet.
Anyone knows the solution?