Firefox 不会使用 HTML5 <audio> 播放 .WAV 文件.标签? [英] Firefox won't play .WAV files using the HTML5 <audio> tag?
问题描述
我正在构建一个页面,允许用户上传 MP3 文件.该 MP3 文件在后端使用 LAME 转换为 .WAV 文件.
I'm building a page that will allow a user to upload an MP3 file. That MP3 file is converted in the back end to a .WAV file using LAME.
蹩脚的执行脚本在这里:
The lame execution script is here:
LAME --resample 44.1 -decode myDirectoryPath/Master.mp3 myDirectoryPath/Master.wav
但是,当我使用 HTML5 音频标签在 Firefox 中为该音频文件创建播放器时,它不起作用.
However, when I use the HTML5 audio tag to create a player for that audio file in Firefox, it doesn't work.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<audio controls>
<source src="myDirectoryPath/Master.mp3">
<source src="myDirectoryPath/Master.wav">
</audio>
</body>
</html>
我读过的所有内容都说 Firefox 支持 .wav 文件...而且我找不到一个简单的 .mp3 到 .ogg 命令行工具来使用它将 master.mp3 转换为 .ogg 格式.有人可以就下一步尝试提供一些建议吗?
Everything I've read says that Firefox supports .wav files... and I can't find a simple .mp3 to .ogg command line tool to use that will convert the master.mp3 to .ogg format. Can someone offer some suggestions on what to try next?
我在这里发布了适用于 Safari 和 Chrome 的代码:http://www.wgbh.org/byers/Audio/index.html
I've posted code that works in Safari and Chrome here: http://www.wgbh.org/byers/Audio/index.html
无论出于何种原因,FF 都不喜欢它.
For whatever reason, FF doesn't like it.
更新(附带facepalm)问题出在我的LAME 解码上.正确的语法是 --decode 用两个破折号而不是一个破折号.系统实际上是将其从 mp3 编码为 mp3,将其命名为 wav,Mac 上的 Safari/Chrome 假定文件类型.
UPDATE (With accompanying facepalm) The issue lies with my LAME decode. The correct syntax is --decode with two dashes instead of one. The system was actually encoding it from mp3 to mp3, naming it wav and Safari / Chrome on the Mac was assuming the file type.
推荐答案
您的 WAV 文件的位深是多少?Firefox 支持 8 位和 16 位 PCM,但不支持其他位深(12、20、24、32).
What's the bit depth on your WAV files? Firefox supports 8-bit and 16-bit PCM, but not other bit depths (12, 20, 24, 32).
这篇关于Firefox 不会使用 HTML5 <audio> 播放 .WAV 文件.标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!