Home > OS >  Can't find path to file in assets folder in Capacitor app
Can't find path to file in assets folder in Capacitor app

Time:11-21

I have a Capacitor app (Capacitor 4) which uses the Cordova Media plugin to play sound, as there is no equivalent native plugin for Capacitor 4 yet.

I can play sounds from the web via urls, but not from the app's own fixed assets directory, it just says file not found.

I've tried public/assets/audio/sound.mp3 and assets/audio/sound.mp3 so far. The latter path works in Cordova apps.

CodePudding user response:

Got around this with the pre-release version of the capacitor native audio plug in - @capacitor-community/[email protected]

Last commit was three months ago.

  • Related