WordPress Audio Streaming

We were recently asked by a client to build an audio streaming player for their proprietary recordings. What a fun opportunity to use some of the built-in multimedia features of HTML5! The basic audio player for WordPress audio streaming is very simple to code, and even those not familiar with hypertext markup language can understand:

Audio Streaming Software
<audio>
<source src=”example.mp3″ type=”audio/mpeg” />
Your browser does not support the audio element.
</audio>

As you can see, the audio file is specified (and the audio file format), as well as a default message to those users still on older browsers that do not support the audio player element. With a little elbow-grease we got this player set up on the client’s WordPress site, linked to the custom posts that they belonged to. But some implementation questions remained:

1. Where would the audio files be hosted? The WordPress media library can certainly store and deliver MP3s and other audio file formats. But these are large files, and serving them over a commercial web hosting package could easily become expensive both in bandwidth and disk storage.

2. How can these audio files be hidden, so that users can’t just download them? As you can see from the code example above, the url of the audio file is completely exposed in the source code. We don’t want to allow users to take these files permanently, but only to stream them temporarily.

Content Delivery Network

We solved the first issue by storing the files on Google Drive, using the client’s G Suite account, so that they could manage their files directly there. This was sufficient for the website’s needs, since the streaming there was sporadic and the audio files themselves were quite long (2-hour long lectures). Had these been small audio files like music tracks, and had there been continuous user demand, this method could have easily become a bottle-neck for the basic Google service, and we would have looked into other content delivery networks, such as Amazon CloudFront.

We utilized an excellent plugin to make this work called Google Drive Embedder for WordPress which when paired with another popular plugin, Google Apps Login, allows you to access your Google Drive account directly from WordPress, and simply choose which files to embed on the page.  Easy!

How to Hide Audio Streaming Files

We could assume no one would steal these audio files, and that they would only use the audio streaming player as provided. But if the files are valuable, and if we are a little suspicious about the honesty of the average visitor, it may be worth protecting the location of the audio files. There are a number of methods to obfuscate file names so that the average user cannot simply download the streamable file.

  • The audio player could be made invisible, but then the controls would not be accessible, and still any determined user could look at the source code and see the filename.
  • Filenames could be encoded (base-64 works well for the common user), but there are many ways to decode this manually and get the real filename.
  • A proxy could be developed that translates code into real filenames.

Ultimately for this project we built a PHP decoder that only accepts valid IDs, and additionally uses server variables to verify that the audio request only comes from authorized users on the client website.

If you would like to implement audio streaming software or any other multimedia technologies (like video streaming, live video, animations, etc) on your website, get in touch. We enjoy working with new media and emerging technologies.

Leave a Comment


Work With Us

We've been building websites for over twenty years, and have learned a thing or two about how to make web projects go smoothly.

What Our Clients Say

Watermelon Web Works, LLC place picture
4.7
Based on 19 reviews
powered by Google
OMS Anita profile picture
OMS Anita
22:20 29 Nov 24
Watermelon Web Works has been incredible to work with. They are patient, understanding, and quick to answer any questions (or emergencies) you might have. After switching over to them to help re-vamp our online retail store, we hired them to build our wholesale website as well. I can't recommend them enough - Thank you team!
Garrett Lister profile picture
Garrett Lister
19:55 10 Jul 24
Jared and the watermelon team were great - they quickly interpreted our website needs and designed a wonderful site. The project management site worked great to keep track of project.
N B profile picture
N B
21:23 14 Nov 23
My previous web developer who I was very happy with retired and I was pretty sad about it because it seems now days it is hard to hire a web developer close by with a good set of skills who is interested in helping small business at reasonable prices. Then I found Watermelon and I have been very happy. They are responsive, are able to solve problems, and work at reasonable prices.
Dark Star Magick profile picture
Dark Star Magick
18:05 03 May 23
We hired Watermelon to help us with our website. They were very thorough and took the time to explain in layman's terms what they were doing and how we could improve SEO and site functionality. We will definitely be back for future website needs!
Astoria Column profile picture
Astoria Column
18:42 24 Apr 23
Great work and amazing service! We're a non-profit, and our priorities are always focused on maintaining the Astoria Column. We had a website built by someone else a few years ago, but without regular updating and maintenance, sections of our site were no longer functional. Joanna and the rest of the team came in and had everything working within a week and it's been smooth sailing since then!
Ben Harris profile picture
Ben Harris
19:25 26 Aug 19
Watermelon has been a fantastic web development partner. Through every phase of our project they have always been 100% responsive to our requests and have always provided highly knowledgeable, creative, prompt, and personable team members to work with. As a financial institution we’re always concerned about the security and maintenance or our website and Watermelon has always provided the appropriate resources in order to meet and/or exceed our compliance and security requirements. We would surely refer them to any business associates looking for a qualified WordPress web designer in the future. – Denali Federal Credit Union
Mohr IP Law Attorneys profile picture
Mohr IP Law Attorneys
00:33 11 Apr 19
Watermelon Web Works did a great job creating a custom shopping cart page for our firm. Gavynn in particular was especially helpful and responsive. We appreciated the upfront costs and the technical competency of Watermelon Web Works and would not hesitate to work with the people there again.
Kim Markle profile picture
Kim Markle
23:36 08 Feb 19
Our company has been working with the Watermelon team for more than 10 years to help build and grow our website and customer portal. They are not only extremely talented and responsive, but are continuously looking for ways for us to enhance our current website. They are consistent, provide excellent customer service and really know what they are doing. Highly recommend!
Rick Brodner profile picture
Rick Brodner
23:23 12 May 17
I cannot say enough good things about Watermelon. They are terrific communicators, highly competent coders, and really, really nice people. They were instrumental in helping us to assemble a very usable, easily maintainable website for our organization. They' have demonstrated great flexibility in accommodating our evolving needs. They have been highly responsive to any technical issues, typically resolving them in less than 4 hours. Watermelon Web Works will make your organization better, and your CFO/Treasurer will be happy when they see the bill - what more can you ask for?
CLOSE