在firefox上设置playbackRate

时间:2013-09-16 08:29:08

标签: firefox html5-audio

如何在Firefox中设置playbackRate? 我有以下代码:

audio = document.createElement('audio');
audio.src = 'http://www.html5rocks.com/en/tutorials/audio/quick/test.ogg';
audio.playbackRate = 1.7;
audio.play();
console.log(audio.playbackRate); // Outputs 1

1 个答案:

答案 0 :(得分:0)

在媒体项目上调用.play().load()将(可能)重置.playbackRate

之后设置.playbackRate,或者改为使用.defaultPlaybackRate

以下是fiddle证明:

audio = document.createElement('audio');
audio.src = 'http://www.html5rocks.com/en/tutorials/audio/quick/test.ogg';
audio.addEventListener("canplay", function () {
    audio.play();
    audio.playbackRate = 1.7;
    console.log(audio.playbackRate);
});