为什么不能设置此音频的playbackRate? [英] Why can't I set the playbackRate of this audio?

查看:504
本文介绍了为什么不能设置此音频的playbackRate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在尝试解决网络视频的音频延迟问题.例如,如果我转到youtube并发现视频与音频不匹配,我想推迟或预播放音频,以使其与视频同步.我已经弄清楚了如何推迟音频,但是我却想不出如何提前播放音频.请帮助

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

我尝试将音频播放速率设置为2.0,然后将其设置回1.0,因此1秒钟后,它将同步视频.但是我无法设置从网页获得的音频的播放速率.

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);
}

当打印出回放速率时,它是1而不是2.0

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

我做错了什么吗?

推荐答案

哦,这是实时资源,不是来自文件.您无法更改播放速率.

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!

这篇关于为什么不能设置此音频的playbackRate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆