Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play HTML5 Audio immediately without waiting for the entire buffering to complete?

Tags:

html

audio

I have a very fast connection and it takes about 2-3 seconds before the song actually starts playing. It's a relatively average 128kbps MP3 size (3mb-4mb). I have set preload="auto" but that didn't help much. Is there a way to just start playing the audio right away and continue to buffer it (sort of like YouTube does)?

Here is an example that I am currently working on. It's going to play an audio simultaneously on all connected clients. So if you have 2+ laptops, you can try it out. All computers must be connected before you start playing the audio. (double click on a song to start playing).

like image 479
Sahat Yalkabov Avatar asked Mar 08 '13 17:03

Sahat Yalkabov


2 Answers

Running video and audio without complete buffering is called smooth / adaptive streaming. It can be achieved in players like silverlight and flash.

What it actually does is to create chunks of files and let the user play file chunk by chunk. Since you are downloading chunks, it will not require whole file to download.

Well, I am not giving you the full fledged answer since I haven't studied much but I am giving you the exact idea of how it works.

I had same issue but with HTML5 Video.. I overcame it with using Smooth streaming media Azure..

Here is a tutorial of the same : http://www.wrapcode.com/featured/windows-azure-media-services-mp4-to-smooth-streaming/

I will keep you updated once I find something useful :-)

like image 114
Rahul Patil Avatar answered Nov 15 '22 23:11

Rahul Patil


If you use preload=none, then you have no buffer at the beginning but it will buffer your content "on the fly"

I have an Icecast server which streamsmy contet, and when I use pause and play, it buffers my content, even with preload=none.

Do not use preload=auto. It will take some time to start.

like image 37
João Bruno Abou Hatem de Liz Avatar answered Nov 16 '22 00:11

João Bruno Abou Hatem de Liz