Mozilla 的音频
我直接从 Mozilla 获取此示例。
<!doctype html>
<html>
<head>
<title>Generating audio in real time</title>
<script type="text/javascript">
function playTone() {
var output = new Audio();
output.mozSetup(1, 44100);
var samples = new Float32Array(22050);
var len = samples.length;
for (var i = 0; i < samples.length ; i++) {
samples[i] = Math.sin( i / 20 );
}
output.mozWriteAudio(samples);
}
</script>
</head>
<body>
<p>This demo plays a one second tone when you click the button below.</p>
<button onclick="playTone();">Play</button>
</body>
</html>
Firefox 3.6.17,Firebug 说:output.mozSetup 不是一个函数。
I'm getting this example straight from Mozilla.
<!doctype html>
<html>
<head>
<title>Generating audio in real time</title>
<script type="text/javascript">
function playTone() {
var output = new Audio();
output.mozSetup(1, 44100);
var samples = new Float32Array(22050);
var len = samples.length;
for (var i = 0; i < samples.length ; i++) {
samples[i] = Math.sin( i / 20 );
}
output.mozWriteAudio(samples);
}
</script>
</head>
<body>
<p>This demo plays a one second tone when you click the button below.</p>
<button onclick="playTone();">Play</button>
</body>
</html>
Firefox 3.6.17, Firebug is saying: output.mozSetup is not a function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
mozSetup 和 mozWriteAudio 需要 Firefox 4。
根据此页面,这些方法被标记为 [Requires Gecko 2.0][非标准]。 Gecko 2.0 首次在 Firefox 4.0 中使用。
mozSetup and mozWriteAudio need Firefox 4.
According to this page, those methods are marked as [Requires Gecko 2.0] [Non-standard]. Gecko 2.0 was first used in Firefox 4.0.