(NATIVE AUDIO) Asset not found IOS

Hello
I’m trying to play sounds using NativeAudio in my app.
On Android devices everything works, but not on IOS 10+.
"(NATIVE AUDIO) Asset not found." the sound files are stored in the correct location (and it works on Android).

Any ideas?

6 Likes

Same here. Did you find something?

same here ! Can’t find a solution

1 Like

Same issue. Ionic team any help?

1 Like

Provide some more information:
ionic info, package.json, link to “Native Audio”, code you use to play files etc.

Same here… I’m getting the same problem!

Same issue… doesn’t seem to be a solution posted anywhere. Is anyone successfully using NativeAudio with Ionic 3? And if so, what relative asset path are you using???

4 Likes

Same here! Push! Need a solution fast!

Hi guys,

After I spend some time with this problem, my solution was to put the preload in the app.components.ts, after verify whether the platform is ready, like the tutorial below.

this.platform.ready().then(() = {

   this.smartAudio.preload('click', 'assets/sounds/sound0.mp3');

}

PS: I implemented the “smartAudio Provider” through this tutorial:

Did you guys figure this one out?

I’m having a hard time getting this to work on iOS.
Works perfectly on Android and Browser.

Thanks in advance!

How did you make it work on Android?

I went throught that tutorial, but apps still has the same error. Could you please help us out?

I’m still having the same issue. The old and new Josh Morony tutorials don’t work on iOS. His new tutorial even has a flag to always play in web browser (forceWebAudio=true). Has anyone figured this out…without switching to the Media component?

I got it to work with mp3 files on IOS and ANDROID (and WEB/HTML5) by wrapping the preloadSimple and play methods in cordova ready, AND fixing a bug in the Josh Morony tutorial. He was passing the asset path to the play method, and should be passing the key instead. Here is my solution:


I call the preload on each page where a sound is played, so it’s very modular.

1 Like

For you and whoever stumbles upon this issue in the future

Solution
I faced same issue, and I’m using Cordova Native Audio plugin on ionic Capacitor project… so inside each platform (android and ios) the folder isn’t named www, it’s named public/assets…etc so I followed the solution in the link below where you need to dive in the plugin source code inside each platform and replace “www” with “public”

Follow the comment of this github issue below

Good luck!

2 Likes

Thanks so much @alaswer that link helped me get past this issue.