Why can't I set the playbackRate of this audio?

ε祈祈猫儿з 提交于 2020-01-25 09:04:10

问题


So I am trying to fix an audio delay problem on web videos. e.g If I go on to youtube and see that the video doesn't match with the audio, I want to postpone or pre-play the audio, so that it syncs with the video. I have figured out how to postpone the audio, but I couldn't figure out how to pre-play the audio. Please help

I have tried setting the audio playback rate to be 2.0 and set it back to 1.0 after, so after 1 second, it will sync will the video. But I can't set the playback rate of the audio I got from webpages.

var audio = document.createElement('audio')

How I got the audio
chrome.tabCapture.capture({audio: true}, stream => {
    audio.srcObject = stream;
    audio.playbackRate = 2.0;
    console.log(audio.playbackRate);
}

When the playback rate gets printed out, it is 1 instead of 2.0

Did I do anything wrong?


回答1:


Oh, this is a live source, not from a file. You can't change the playback rate.

Think about it this way... if you could speed up something that's being recorded live, you would effectively be going into the future!



来源:https://stackoverflow.com/questions/57081031/why-cant-i-set-the-playbackrate-of-this-audio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!