Buffered audio in SoundJS

百般思念 提交于 2019-12-12 03:08:15

问题


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

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.

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 ?

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.

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

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


回答1:


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.

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

Hope that helps.



来源:https://stackoverflow.com/questions/26335787/buffered-audio-in-soundjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!