SoundJS中的缓冲音频 [英] Buffered audio in SoundJS

查看:713
本文介绍了SoundJS中的缓冲音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SoundJS 0.5.2在我为客户设计的音乐播放器中播放音频。

I'm using SoundJS 0.5.2 to play audio in a music player that I'm designing for a client.

根据文档,我必须注册 preload 一个音频文件,然后才能使用它,使用 registerSound 声音类的方法,音频在完全加载之前无法播放。

According to the documentation, I have to register or preload an audio file before I can use it, by using the registerSound method of the Sound Class and the audio cannot be played before it is fully loaded.

但是我怎么做才能在播放时缓冲音频?比如等到10%的音频被缓冲,然后播放这首歌?这可以使用PreloadJS完成吗?

But how I do I go about buffering the audio while it is being played? Like wait till 10% of the audio is buffered, then play the song? Can this be accomplished using PreloadJS ?

谷歌搜索后,我发现这个线程。它说WebAudioPlugin由于底层技术不支持缓冲,但HTMLAudioPlugin可以在完全加载之前播放音频。

After Googling about it, I found this thread. It says that the WebAudioPlugin does not support buffering because of the underlying technology, but the HTMLAudioPlugin can play the audio before it is fully loaded.

但它没有提到如何去做。使用HTMLAudioPlugin时,是否仍需要使用 registerSound 注册声音?

But it does not mention how to do that. When using HTMLAudioPlugin, do I still have to register the sound using registerSound ?

此外,当使用FlashPlugin作为回退,FlashPlugin仍然支持缓冲吗?

Also, when using FlashPlugin as a fallback, will the buffering still be supported by FlashPlugin?

推荐答案

HTMLAudioPlugin在收到来自音频的canplaythrough事件时触发就绪事件标记,因此它默认支持缓冲(无需设置)。您必须为他们注册声音,以便使用PreloadJS或内部SoundJS方法开始加载。无论如何,缓冲都会起作用。

HTMLAudioPlugin fires the ready event when it receives the canplaythrough event from the audio tag, so it supports buffering by default (no setup required). You have to register sounds for them to start loading, either with PreloadJS or internal SoundJS methods. Buffering will work the same regardless.

据我所知,FlashPlugin不支持缓冲。

Buffering is not supported by the FlashPlugin as far as I know.

希望有所帮助。

这篇关于SoundJS中的缓冲音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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