Search code examples
phpmp3soundmanager2

playing mp3 files located outside of public_html with soundmanager 2


I have to stream some mp3 files located outside of public_html with soundmanager2 or any other flash-based mp3 player but i can't make it work.

Do you know any workaround on this subject ?

Thanks


Solution

  • You could write a little php script which loads the content from the file and sends it. If your intention is to prevent the user from copying the sound this is probably not possible this way. If you just can't move the files to public_html you could create a symbolic link or just the php script.

    You could use readfile like here:

    header('Content-Type: audio/mpeg');
    header('Content-Disposition: attachment; filename="audio.mp3"');
    readfile('../files/audio.mp3');