Html mp3 的 <audio> 标签在 Chrome 上不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32640450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
<audio> tag for mp3 doesn't really work on Chrome
提问by alexandresecanove
First of all here is the website I'm currently coding :
首先,这里是我目前正在编写的网站:
On each button, there is one tag for one mp3 sample. All the mp3 are playing perfectly with Safari, but with Chrome only a few buttons are working.
在每个按钮上,一个 mp3 样本有一个标签。所有 mp3 都可以在 Safari 上完美播放,但在 Chrome 中只有几个按钮可以工作。
I tested with type audio/mp3 and audio/mpeg, but it doesn't change. Thanks guys
我用音频/mp3 和音频/mpeg 类型进行了测试,但它没有改变。谢谢你们
回答by AndrewL64
Some of the buttons are not working because you are specifying the file type wrong. All the audio files are mp3 but you're specifying some of them as mpeg
.
某些按钮不起作用,因为您指定的文件类型错误。所有音频文件都是 mp3,但您将其中一些指定为mpeg
.
You need to change this:
你需要改变这个:
<source src="sons/xxx.mp3" type="audio/mpeg">
to this:
对此:
<source src="sons/xxx.mp3" type="audio/mp3">
For all of them.
对于他们所有人。
回答by Hameed Syed
Its too late but this might help anyone in future.Both audio of mp3 quality(128 and 320 Kbps) and video of mp4(in iFrame) are working fine in the google chrome version 55.0.2883.87.
为时已晚,但这可能会对未来的任何人有所帮助。 mp3 质量(128 和 320 Kbps)的音频和 mp4(iFrame 中)的视频在 google chrome 版本 55.0.2883.87 中都可以正常工作。
<audio controls="controls" src="mydriveaddress\test.mp3" autoplay>
</audio>
<iframe src="mydriveaddress\test2.mp4" height="300" width="300" allowfullscreen=""></iframe>
回答by Owen Bula
I had the same problem with Google Chrome. It's more of like a version problem of chrome. To fix that re-encode the MP3 files to a lower bitrate using Audacity or other Media Converters.
For more info: https://stackoverflow.com/a/32719143/8009667
我在谷歌浏览器上遇到了同样的问题。这更像是 chrome 的版本问题。为了解决这个问题,使用 Audacity 或其他媒体转换器将 MP3 文件重新编码为较低的比特率。
更多信息:https: //stackoverflow.com/a/32719143/8009667