Ok, i have to build a secure music player; one that don't display music's source (even on the console). I've already built the logic, but, in order to do that, my only way out was to use php header to strem mp3.
My question: is my performance loss "tolerable" doing that:
/main.js
Player.src = "music.php"
/music.php
header('Content-type: audio/mpeg');
header('Content-length: ' . filesize($track));
header('Content-Disposition: filename="sometrack.mp3"');
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');
print file_get_contents($track);
instead of that?:
/main.js
Player.src = "music.mp3"
By "tolerable", i mean: 10% loss? 15% loss?
Or Anyone has another suggestion?
Here is the github with the very(!) raw logic: https://github.com/filipemerker/securePlayer
If you have to do it that way, you should consider using readfile instead of file_get_contents
Take a look at PHP readfile vs. file_get_contents.