sau*_*lob 8 php safari audio html5 ipad
好的,我正在尝试在iPad上播放HTML音频代码但不起作用.
我创建了一个PHP脚本来发送到HTML5音频代码的MP3请求
mp3_file_player.php?N = mp3file.mp3
播放器在这里:http: //www.avault.com/news/podcast-news/john-romero-podcast-episode-80/
您将看到即使在我的iPod Touch上,它也可以在每个支持HTML5的浏览器上运行.但是在iPad/iPhone上不起作用,即使在Mac OSX上的Safari上也没有(我在Safari/Windows上试过,工作正常)
这是我的PHP代码:
header("X-Powered-By: ");
header("Accept-Ranges: bytes");
header("Content-Length: ". (string)(filesize($episode_filename)) ."");
header("Content-type: audio/mpeg");
readfile($episode_filename);
exit();
Run Code Online (Sandbox Code Playgroud)
一切正常,MP3具有相同的标题,如直接读取MP3.
来自直接文件访问的HTTP标头:
(Status-Line) HTTP/1.1 200 OK
Date Mon, 31 May 2010 20:27:31 GMT
Server Apache/2.2.9
Last-Modified Wed, 26 May 2010 13:39:19 GMT
Etag "dac0039-41d91f8-4877f669cefc0"
Accept-Ranges bytes
Content-Length 50656162
Content-Range bytes 18390614-69046775/69046776
Keep-Alive timeout=15, max=100
Connection Keep-Alive
Content-Type audio/mpeg
Run Code Online (Sandbox Code Playgroud)
我的PHP脚本的HTTP标头:
(Status-Line) HTTP/1.1 200 OK
Date Mon, 31 May 2010 20:27:08 GMT
Server Apache/2.2.9
Accept-Ranges bytes
Content-Length 69046776
Keep-Alive timeout=15, max=100
Connection Keep-Alive
Content-Type audio/mpeg
Run Code Online (Sandbox Code Playgroud)
唯一不同的是它的内容范围,我甚至尝试添加它,但如果我使用它,播放器将不能在我的Ipod Touch上工作.所以我删除了.
非常感谢你.
尝试删除,header("Accept-Ranges: bytes");因为您没有发送文件的一部分。header("X-Powered-By: ");无论如何,删除 Apache 提供的服务
$etag = md5(serialize(fstat($fp)));
fclose($fp);
header('Etag: '.$etag);
Run Code Online (Sandbox Code Playgroud)
^^ 添加电子标签
并尝试一下!