简体   繁体   English

如何减少html5音频缓冲区的大小?

[英]How can I reduce the html5 audio buffer size?

I'm creating an audio element with javascript and I'd like to control either the buffer size or the amount of buffer fill before the audio starts playing so that there is less delay before the audio plays and less latency. 我正在使用javascript创建音频元素,我想在音频开始播放之前控制缓冲区大小或缓冲区填充量,以使音频播放之前的延迟更短,延迟更短。

The audio data is a stream and the user will choose to play one stream out of many so it isn't feasible to 'preload' the audio data at all. 音频数据是一个流,用户将选择从多个流中播放一个流,因此根本无法“预加载”音频数据。

I haven't seen any references to changing the buffer size. 我还没有看到任何有关更改缓冲区大小的参考。 One suggestion would be to start the audio with the volume turned down. 一种建议是在调低音量的情况下开始播放音频。 then stop and reset the to the start and volume back up. 然后停止并将重置为开始并备份音量。 perhaps even setting the start point may cause internal code to load the buffer with data. 甚至设置起始点都可能导致内部代码向缓冲区加载数据。 i think you need to prime the buffer. 我认为您需要灌注缓冲液。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM