cordova-plugin-nativeaudio
cordova-plugin-nativeaudio copied to clipboard
No sound on iOS 10 anymore (9.x is OK)
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?
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.
No bueno. Experiencing the same here on a real device, iOS 10.1.1
Same here no sound. It for some strange reason plays the sound when the app is not in focus (home button)
Is there any work around in the mean time?
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.
I believe that the workaround here is only use preloadComplex providing all the parameters, as said above by @Turv
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?
I have waisted days... preloadComplex works beautifully! Thanks @felipepucinelli @Turv !