cordova-plugin-nativeaudio icon indicating copy to clipboard operation
cordova-plugin-nativeaudio copied to clipboard

No sound on iOS 10 anymore (9.x is OK)

Open andreasotto opened this issue 9 years ago • 8 comments

I'm using NativeAudio in my ionic 2 (beta-11) project like this:

ngOnInit() {
  this.platform.ready().then(() => {
    NativeAudio.preloadComplex('uniqueId1', 'assets/test.mp3', 1, 1, 0);
  }
}

then, on (click) of a button, i do:

NativeAudio.setVolumeForComplexAsset('uniqueId1', 1.0);
NativeAudio.loop('uniqueId1');

This works in my app since months on iOS 9.3 and Android. As soon as i update to iOS 10 (10.0.1) there is no sound any more. There is no error message, too. It just does not play any sound any more. It is reproducable (as soon as updated to iOS 10, its broken). It is reproducable on real devices and on the simulator, too.

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

ionic emulate --target="iPhone-6s, 10.0" does not work!

Anyone has an idea how to solve this problem?

andreasotto avatar Sep 18 '16 13:09 andreasotto

Add some callbacks to report the status of the plugin. Example:

NativeAudio.preloadComplex('uniqueId1', 'assets/test.mp3', 1, 1, 0, function(success){
    console.log(success);
}, function(err) {
    console.warn(err);
});

Do the same for the other functions and report back your findings. This may give some insight into why it fails now.

jvjvjv avatar Oct 10 '16 20:10 jvjvjv

No bueno. Experiencing the same here on a real device, iOS 10.1.1

phishy avatar Nov 02 '16 01:11 phishy

Same here no sound. It for some strange reason plays the sound when the app is not in focus (home button)

sclearion avatar Nov 29 '16 19:11 sclearion

Is there any work around in the mean time?

SimpleVictor avatar Nov 30 '16 06:11 SimpleVictor

Anyone managed to get this working?

To confirm: preloadSimple does not work, preloadComplex however does so long as I provide volume/voices/delay parameters. Not providing these (to use their default values) does not work and causes a null reference exception error.

Turv avatar Dec 15 '16 11:12 Turv

I believe that the workaround here is only use preloadComplex providing all the parameters, as said above by @Turv

felipepucinelli avatar Mar 13 '17 15:03 felipepucinelli

is this probably on the app's initial page that is being opened upon launching the app?

I have experienced similar, however after manually switching pages and back to the one where the audio is supposed to be played, it worked. The README.md states:

Wait for deviceReady.

Maybe that's an issue here?

Shigawire avatar May 12 '17 19:05 Shigawire

I have waisted days... preloadComplex works beautifully! Thanks @felipepucinelli @Turv !

jpfortin avatar Dec 02 '17 15:12 jpfortin