Jump to content

listen to a song..


corillo181

Recommended Posts

i know that part i mean the content that has to be sent as the heade in order to make the page read as a mp3 and not a normal text/html

i'm now too good with header content

but i know is something  like

 

header('content-type: mp3');

and then i do the query which is what you posted..

 

 

Link to comment
https://forums.phpfreaks.com/topic/91498-listen-to-a-song/#findComment-469043
Share on other sites

that dont work only prompts to download the song.

If you set the headers like that and output the contents of the file, the browser is going to prompt you to do something based on the header. If it's an HTML file, the browser will open the file itself. But if it detects an mp3 file, it's going to prompt you to download it just as if you tried to browse to

www.somesite.com/asong.mp3

 

Link to comment
https://forums.phpfreaks.com/topic/91498-listen-to-a-song/#findComment-469146
Share on other sites

You should also remember the script will time out if it can't send the entire mp3 in 30 seconds (or whatever timeout you have set).  Use set_time_limit() to override this.  If you want to get fruity, look into accepting byte ranges in your headers, and how to interpret them and send their response-counterparts, which will allow MP3 players to seek/rewind/fast-forward in your streaming mp3s.  It's not as tricky as it sounds, and is very useful.

Link to comment
https://forums.phpfreaks.com/topic/91498-listen-to-a-song/#findComment-469778
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.