2
我正在使用soundmanager2,並且Safari瀏覽器出現問題。Soundmanager2,Safari和PHP流式傳輸錯誤
我成功地從PHP到Soundmanager2流保護的文件(Web根目錄外),使用這樣的事情:
//check if user is logged in and has rights on $file
//if yes stream file
if (file_exists($file)) {
$filepath = $file;
$filesize = filesize($filepath);
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Disposition: attachment;filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary");
header('Content-Type: audio/mpeg');
header('Content-Length: '.$filesize);
@readfile($filepath);
exit(0);
}
這適用於Firefox和Chrome精細,MP3文件播放,但在Safari我得到:
soundmanager2.js:1190basicMP3Sound0: Using HTML5
soundmanager2.js:1190basicMP3Sound0: play(): Attempting to load
soundmanager2.js:1190basicMP3Sound0: load (/privateaccess/index/1415)
soundmanager2.js:1190basicMP3Sound0: waiting
soundmanager2.js:1190basicMP3Sound0: loadstart
soundmanager2.js:1190basicMP3Sound0: loadedmetadata
soundmanager2.js:1190basicMP3Sound0: HTML5 error, code 3
soundmanager2.js:1188basicMP3Sound0: Failed to load/invalid sound? Zero-length duration reported. (/privateaccess/index/1415)
我只當我從流PHP文件,它的工作與在Web根目錄(由阿帕奇而不是PHP交付)文件出現此錯誤。
如果我直接點擊www.myurl.com/privateaccess/index/1415,文件被下載,所以它確實看起來像Safari,Soundmanager2和PHP文件流之間的問題。
有人嗎?一個想法來解決/解決這個問題?
謝謝你這個答案。不知道我是如何在他們的網站上錯過的,但謝天謝地,您在這裏添加了相關鏈接。 – Zoidberg