我相信jPlayer音频播放器中存在一个错误,如果歌曲文件是由PHP文件输出的,则会阻止用户使用搜索栏浏览歌曲。在我的htaccess文件中,我有这一行:
RewriteRule ^stream/(.*)/([0-9+]).mp3?$ modules/stream.php?a1=$1&a2=$2
然后在我的stream.php文件中,这是我设置的标题数据:
$fsize = filesize($path);
$shortlen = $fsize-1;
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false); // required for certain browsers
header("Content-Type: audio/mpeg");
header("Content-Disposition: inline; filename=" . $file . ";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $fsize);
header('Content-Range: bytes 0-'.$shortlen.'/'.$fsize);
header('X-Pad: avoid browser bug');
header("Content-Length: " . filesize($path));
readfile("$path");
exit();
mp3的链接通常如下所示:
www.website.com/stream/song/100/
除了使用搜索栏导航歌曲外,其他所有内容似乎都适用于jPlayer。当我将URL更改为mp3的直接路径时,搜索栏将再次开始工作。有谁知道如何解决这个问题?
编辑: 在Mac OSX 10.8上的Safari v6中不会出现此问题。确实发生在Chrome v27
上