Mobile app version of
Login or Join

 query : Offer MP3 files on WordPress for listening only (prevent downloading) I have a WordPress blog on which I'd like to share some large audio files to my visitors. But I want to prevent, or at


Posted in: #Media #Streaming #Video #Wordpress

I have a WordPress blog on which I'd like to share some large audio files to my visitors. But I want to prevent, or at least discourage, my users from directly downloading the MP3 files.

I've seen many plugins that have the possibility show the audio as some sort of streaming, but unfortunately you'll still see the direct link to the MP3 files when you take a look in the HTML code.
The best solution I've found so far is to embed the Yagosta Flash player.

I wonder if there is anyway to archieve the same result in HTML5? I'd rather not use a Flash player because so many devices don't support Flash.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Reiling115


Sorted by latest first Latest Oldest Best



In order to use HTML5 features to play an MP3 file the browser would need to know the URL to the MP3 file, and therefore it would need to be included in the the source code. There are some tricks however that can help make it more difficult for people to find the URL, such as:

Obfuscating the URL using HTML character code substitutes

For example: would become http://

function HtmlObfuscation( $sText ) {
$sObfuscated = '';
for( $i = 0; $i < strlen( $sText ); $i++ ) {
$sObfuscated .= '&#' . ord( $sText[$i] ) . ';';

Inserting the URL after the page has loaded using Javascript

HTML file would contain:

<audio controls id="mp3-player"></audio>
<script type="text/javascript" src="mp3-player.js"></script>

and then the javascript file mp3-player.js could contain:

oMp3Player = document.getElementById('mp3-player');
oAudioSource = document.createElement('source');
oAudioSource.href = '';
oAudioSource.setAttribute('href', '');

or perhaps an obfuscated version of the same (created using an online tool):

eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('b'+e(c)+'b','g'),k[c])}}return p}('a=2.d('1-c');0=2.h('g');0.6='4://3.7.5/8/b-9.1';0.f('6','4://3.7.5/8/b-9.1');a.e(0);',18,18,'oAudioSource|mp3|document|www|http|com|href|example|audio|asset|oMp3Player|protected|player|getElementById|appendChild|setAttribute|source|createElement'.split('|'),0,{}))

Slow stream

Restrict the data speed of the stream to listening pace so that it wouldn't be possible to download an MP3 file quicker than it would take to listen to it.


Whatever tricks you use though to hide it in the source code, the browser will often reveal it in very easy readable format if the developer tools are enabled and the Network tab selected. All the top browsers have these features built-in these days by just pressing F12.

Also, unfortunately if you use HTML5 for embedding the MP3 audio link you'll find similar to the flash player issue, not all versions of all web browsers will support this at present, partly due to HTML5 still being under development and not officially released as a final standard yet. You may therefore need to use a combination of solutions with some logic code in order to ensure there is a working version for at least the most used browser versions (check your website analytics to see which ones your users use).

In reality if the audio files can be played, they can be downloaded. Frustrating I know but this is just the reality. For audio the best copy protection might be to only provide a sample clip rather than the full length of the audio, or if you simply want people to come to your website you might be best to simply include an announcement at the beginning and end of the audio to introduce your website with a tagline for example.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme