Streaming 如何在网页上即时播放音频文件
我想从服务器播放音频文件。目前我正在使用html音频控件,但速度非常慢。我的要求是尽可能快,几乎是瞬间。实现这一目标的最佳方式是什么?请参考资料来源。提前感谢。HTML5方式就在这里Streaming 如何在网页上即时播放音频文件,streaming,real-time,Streaming,Real Time,我想从服务器播放音频文件。目前我正在使用html音频控件,但速度非常慢。我的要求是尽可能快,几乎是瞬间。实现这一目标的最佳方式是什么?请参考资料来源。提前感谢。HTML5方式就在这里 <audio controls> <source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.mp4" type='audio/mp4'> <!-- The next two lines
<audio controls>
<source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.mp4"
type='audio/mp4'>
<!-- The next two lines are only executed if the browser doesn't support MP4 files -->
<source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.oga"
type='audio/ogg; codecs=vorbis'>
<!-- The next line will only be executed if the browser doesn't support the <audio> tag-->
<p>Your user agent does not support the HTML5 Audio element.</p>
</audio>
检查这一点,目前我正在以同样的方式进行。我在寻找更快的替代方案
var aud = document.createElement("iframe");
aud.setAttribute('src', "http://yoursite.com/youraudio.mp4"); // replace with actual file path
aud.setAttribute('width', '1px');
aud.setAttribute('height', '1px');
aud.setAttribute('scrolling', 'no');
aud.style.border = "0px";
document.body.appendChild(aud);