Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 <audio> Hiding the audio source

Tags:

html

php

apache

I'd like to be to use the HTML5 <audio> tag to stream mp3 files from my website. The problem is, any ol' Joe can view the page source and see the location of the streaming mp3 file, then they'd be able to download the whole file directly (as opposed to 'streaming' via the player).

Is there anything I can do to keep the user from being able to view the location of the mp3 files on my server? What options do I (or don't I) have?

I'm using Apache with PHP, if that's relevant.

like image 695
Jesse Avatar asked Dec 31 '25 11:12

Jesse


1 Answers

you could use a php script to pull the audio file for you. set the source to a php script rather than the actual file. Then in the php script you could do checks to make sure the request is valid before returning the mp3 file.

like image 142
Dan Avatar answered Jan 03 '26 02:01

Dan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!