Jump to content

audio problem.


corillo181

Recommended Posts

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

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

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.