in snippets, WordPress

How to download an MP3 file for offline use in iOS or Android

I took a look at a WordPress plugin, Easy Media Download, and it has a feature that adds a parameter to the <a> tag that forces a download. However, that only works for desktops browsers. If you are wanting to download the file in iOS or Android, you’re going to run into problems. That’s because they don’t have a file system like a computer that let’s you put files anywhere you like.

There are ways around this though. The mobile device wants to secure the phone by keeping files only associated with the apps that use them. So you could build your own app to download an mp3 file and store that file to be use only with that app. Not a quick or cheap solution. Another alternative is using Dropbox to store your mp3 files and share them. When you share the file Dropbox gives you an URL. Use this URL in your easy_media_download shortcode. What this will do (as long as the user has the Dropbox app installed on their phone) is download the file into their Dropbox account. From there they have the option to download the file for offline use.

Sample URL for a mp3 file in Dropbox used in the easy media shortcode:

[easy_media_download url=”{{SOME_RANDOM_GENERATED_FILE_NAME.mp3?dl=1″ text=”Download TEST” color=”red” force_dl=”1″]

Using Easy Media Download shortcode to force a download at least for the desktop. Notice the extra force_dl=”1″ at the end. Probably not quite the answer you were looking for, but at least you know.