如何在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
答案 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);
});