I have now tried to many different methods to get this to work, and have googled for hours without finding something good.
So, I'm working on a app where the user can record him/her self with new Media, and then I need to upload this file to a WordPress site when the user chooses self.
I have installed the plugins:
cordova-plugin-file & cordova-plugin-media
And with this I wanted to create a new directory for all my recordings, so when I record a new sound. I can just read all these files in this directory and list them out, and then I can either delete or upload those files. But my files don't get saved to this folder.
I'm working with a Android phone right now, and I can see that these files are saved to "Shared internal storage".
Can someone share a quick example of how to create a custom directory, and save recordings to this directory? Because then the file path will be the same on iOS and Android.
I also added:
<preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="iosPersistentFileLocation" value="Library" />
Or have can I save to cordova.file.dataDirectory?
Try using the cdvfile:// scheme when saving and loading media -- that way you can use the same code on iOS and Android and don't have to worry about the underlying file paths being different.
will save to whatever location is defined in config.xml for the persistent location.
Consult the cordova-plugin-file documentation for examples on how to create folders and the like.