Setting playbackRate on audio element connected to web audio api

后端 未结 2 2053
栀梦
栀梦 2021-01-13 01:00

I\'ve been experimenting with connecting an audio element to the web audio api using createMediaElementSource and got it to work but one thing I need to do is change the pla

相关标签:
2条回答
  • You have to set the playback rate after the audio has started playing. The only portable way I have found to make this work, is by waiting until you get a timeupdate event with valid currentTime:

    _audio.addEventListener('timeupdate', function(){
        _if(!isNaN(audio.currentTime)) {
            _audio.playbackRate = 0.6;
        }
    });
    

    Note that playback rate isn't currently supported on android and that Chrome (on desktop) doesn't support playback rates lower than 0.5.

    0 讨论(0)
  • 2021-01-13 01:44

    Which browser are you using to test this? It seems this is not yet implemented in Firefox, but should be working on Chrome.

    Mozilla bug for implementing playbackRate: https://bugzilla.mozilla.org/show_bug.cgi?id=495040

    0 讨论(0)
提交回复
热议问题