问题
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