Now to the question at hand. How to call an audio file from a web server.
—, the WebAudio API goodies aren't available to video unfortunately.
mchulet, Animate, Carbincopy, I recently needed to do this and came up with a workaround (albeit hackish). So if you want to try, here goes.
This involves modding the Scirra audio plugin with a small change to the runtime.js and edittime.js
In my case, i just needed to reference .mp3's managed by a CMS exposed as a static site directory from a remote domain (ie. a web server). To keep things simple let's assume only using the Chrome browser and that mobile devices are out of the picture (I didn't need it in my case).
Let's say that our MP3 files are at http://www.yourdomain.com:8080/tracks/
1. Backup Scirra's audio plugin in case it gets messed up.
2. Edit the runtime.js and add a line after 3401 like so.
3. Edit the edittime.js and change line 71 to the following.
BUT... and here's the complicated bit.
4. You'll need to be the administrator of said server and be able to configure the appropriate Cross-Origin Resource Sharing (CORS) to ensure that your C2 application is allowed to GET those mp3's from wherever origin (domain) you're getting it from. Also note that when configuring CORS, you need to include the origin's port number as well (if any).
That's basically it.
During authoring time, just enter the URL (where the Folder property used to be). After a successful test, you can then think about reading an external JSON, iterating over an MP3 playlist and feeding the filenames to the (modified) audio plugin as a next step (see demo below).
Here's the modified plugin dialog for Play (by name) action. Notice the empty Sounds/Music folder:
Finally, doing it this way would allow the continued use of the WebAudio API, filters and stuff. You get the idea.
How about an app that's hosted in Scirra Arcade which gets its audio from another site? Perfect example.
If you have previous C2 projects using "PlayByName", beware that the above "hack" will break your previous project. However, the proper (less hackish) way that doesn't break previous C2 projects would be to extend the existing audio plugin with a new action, say "PlayFromURL", instead of modifying "PlayByName". But this requires a bit of plugin development know-how from your side to get done correctly (but is relatively easy).