I am trying to create a service for a project that allows javascript-based embed codes for sharing audio clips, such that the player appears on sites where it is embedded. Very much like a soundcloud clone, but on a far smaller scale and for private sharing only.
I am not sure how to go about this, but thinking of making the javascript write the HTML5 player dynamically into any page where the embed is placed, fetching the details needed to render the player into the page via JSON-P (to overcome the same origin policy) and streaming the audio clip directly from the main server. I will prefer to use the jQuery framework.
Is this the best method to go about this? I am trying to research, but I do not know how exactly to search for the information or where to start.
P.S. I also found this helpful S/O article about how soundcloud hides the URLs of the streaming media to prevent direct downloads
making the javascript write the HTML5 player dynamically into any page where the embed is placed
You can also use iframe that will load the “widget” from your server. That's how HTML5 widget is built at SoundCloud.
fetching the details needed to render the player into the page via JSON-P
You can use CORS in order to overcome same-domain policy if you'd want to render widget with JS.
As for the streaming, the basics of it can be done via some simple server configuration and serving media files from that server (nginx is probably your best bet).
I hope this helps some.