La duración del audio HTML5 para mp3 es siempre infinito

Estoy jugando con mi proyecto favorito y, experimentando con el "streaming" de mp3 con PHP, siempre obtengo la duración del audio para regresar.Infinity. Intenté buscar en muchos lugares, desafortunadamente, parece que no puedo encontrar el problema de la raíz.

Tenga en cuenta que tuve que dejar de lado ese proyecto por un tiempo, y todo funcionó bien antes. Cuando reinicié el trabajo en el proyecto, hice un refactor de UI y descubrí este "error". ¿Alguien puede detectar algo mal con mi código?

Contexto: esto es en una acción de controlador (ZF2), donde$media es unPOPO modelo.

$file = $basePath . $media->getFileName();
$fileSize = filesize($file);
$fileHandle = fopen($file, 'r');

$etag = md5(serialize(fstat($fileHandle)));
$cacheExpires = new \DateTime();

// TODO : implement ranges...
if ( isset($_SERVER['HTTP_RANGE']) ) {

    // find the requested range
    // this might be too simplistic, apparently the client can request
    // multiple ranges, which can become pretty complex, so ignore it for now
    preg_match('/bytes=(\d+)-(\d+)?/', $_SERVER['HTTP_RANGE'], $matches);

    $rangeFrom = intval($matches[1]);
    $rangeTo = intval($matches[2]);

    $statusCode = 206;
} else {
    $rangeFrom = 0;
    $rangeTo = $fileSize;
    $statusCode = 200;
}

fseek($fileHandle, $rangeFrom);

set_time_limit(0); // try to disable time limit

$response = new Stream();
$response->setStream($fileHandle);
$response->setStatusCode($statusCode);
$response->setStreamName(basename($file));

$headers = new Headers();
$headers->addHeaders(array(
    'Pragma' => 'public',
    'Expires' => $cacheExpires->format('Y/m/d H:i:s'),
    'Cache-Control' => 'no-cache',
    'Accept-Ranges' => 'bytes',
    'Content-Description' => 'File Transfer',
    'Content-Transfer-Encoding' => 'binary',
    'Content-Disposition' => 'attachment; filename="' . basename($file) .'"',
    'Content-Type' => 'audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3',  // $media->getFileType(),
    'Content-Range' => "bytes {$rangeFrom}-{$rangeTo}/{$fileSize}",
    'Content-Length' => $fileSize,
    'Etag' => $etag,
    'X-Pad' => 'avoid browser bug',
));
$response->setHeaders($headers);
return $response;

He intentado jugar con casi todos los campos HEADER (incluso eliminando los rangos), pero el navegador siempre tieneisFinite(audio.duration) === false. Todo lo demás parece funcionar, incluso la reproducción, perfectamente.

Respuestas a la pregunta(1)

Su respuesta a la pregunta