I am trying to do something which I feel should not be too difficult: download mp3 files, store them “locally”, and then make them available for a user to play. But, wow, I am really having problems…
I am successfully downloading the mp3 files from Firestore – at least as far as I can tell. And, I feel like I’m storing them in the “Data” directory – certainly it seems like they are there when I run my app in a browser, and use the debugging console to see the storage system. See image below.
However, I’ve been unable to figure out how to read the 1.mp3 file in from that location and play it, either with an html <audio>
tag or using Javascript Audio stuff or with cordova media stuff. The errors that come back usually so are obscure that you cannot tell if you are not reading the file correctly or have saved the file in a bad format or have not been able to find the file in the file system.
Can anyone help me? Do you have any suggestions on how to tell if the file is in a good format and/or how to read the (binary) file in and play it?
(Note: here are all the things I have been able to do successfully:
- Play an audio file that is stored in
assets
. - Download json files from the web and store then in the Data directory.
- Read json files in from the Data directory and process them.
)
Frustratedly yours,
Vic