我只在 IE 中播放音频时遇到问题。 控制台不显示错误。我从 php 脚本获取文件并设置此 header :
$mime_type = "audio/mpeg";
header("Content-Type: {$mime_type}");
header('Content-Length: '.filesize($file));
readfile($file);
在 js 中:
audio.src = source;
audio.load();
audio.addEventListener('canplay', function(){
audio.play();
}, true);
在 php 脚本的 source
路径中。
最佳答案
Add this meta tag to the head:
< meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
and also
Try
audio/vnd.wave
because some browser do attempt content fixing wrong MIME types.
关于javascript - IE 不从 php 脚本播放 mp3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38393702/