K
K
KzLIFE2014-05-20 12:46:12
PHP
KzLIFE, 2014-05-20 12:46:12

How to parse Mp3 through an intermediate server?

$file = "http:/$g1.vk.me/$g2/$g3/$g4.mp3";  // URL mp3 файла

$len = get_headers($file,1);  
if ($len[0] == 'HTTP/1.1 200 OK') {
if (ob_get_level()) {
ob_end_clean();
}        
header('Content-Description: File Transfer');
header('Content-Type: audio/mpeg');
header('Content-Disposition: attachment; filename='.$g5.'');
header("Content-Transfer-Encoding: chunked"); 
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . $len['Content-Length']);
readfile($file);
exit;
}

At the output I get $g5.mp3, I insert it into the audiojs.js player, the song plays normally, but does not scroll (forward, backward): (
And if the player specifies a static file that lies on the server, then everything is buzzing. with similar?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Kulakov, 2014-05-20
@KzLIFE

I think the point is that in one case it is a stream and it is impossible to rewind it back and forth without any buffering, in the other case it is a static file that can be read from anywhere. in flash players, if my memory serves me, when rewinding, a request is sent to the server and it prepares the stream from the right place. but in the case of a flash, I can be wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question