corillo181 Posted December 14, 2008 Share Posted December 14, 2008 i have this code <?php $song_id = (int) $this->uri->segment(3); $query = $this->db->query('SELECT * FROM `artist_songs` WHERE `id`='.$song_id); $song=$query->result(); $filename = 'artist/songs/'.$song[0]->path; if(false !== ($fh = fopen($filename,'r'))){ header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: audio/mpeg"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$filename"); fclose($filename); } it was working before but now it does not. all it needs to do is to get a song and play it. i know is getting the song because i did some test, so the problem is in one of the header, i do not understand headers yet. any help will be great. thanks. Link to comment https://forums.phpfreaks.com/topic/136909-audio-problem/ Share on other sites More sharing options...
corillo181 Posted December 14, 2008 Author Share Posted December 14, 2008 is this really that hard? Link to comment https://forums.phpfreaks.com/topic/136909-audio-problem/#findComment-715059 Share on other sites More sharing options...
corillo181 Posted December 14, 2008 Author Share Posted December 14, 2008 come on guys :| Link to comment https://forums.phpfreaks.com/topic/136909-audio-problem/#findComment-715358 Share on other sites More sharing options...
xtopolis Posted December 14, 2008 Share Posted December 14, 2008 What are the errors? Is this supposed to be a download option, or part of a stream? Have you checked the header page for examples that might fit what you want? Link to comment https://forums.phpfreaks.com/topic/136909-audio-problem/#findComment-715435 Share on other sites More sharing options...
Yesideez Posted December 14, 2008 Share Posted December 14, 2008 Why not use HTML to play the music? http://www.hypergurl.com/music.html Link to comment https://forums.phpfreaks.com/topic/136909-audio-problem/#findComment-715438 Share on other sites More sharing options...
Yesideez Posted December 14, 2008 Share Posted December 14, 2008 I also found this link which gives a little more information and might be better suited to what you want... http://www.conradaskland.com/blog/2006/11/html-code-to-auto-play-mp3-audio-files/ Just use PHP to drop the audio clip name into the correct place. Link to comment https://forums.phpfreaks.com/topic/136909-audio-problem/#findComment-715439 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.