Search code examples
htmlaudiostreamingwavpcm

html 5 audio streaming faking files. Progressive Download, PCM WAV


As far as i know there is no audio streaming available in html5. Even with the audio tag.

That is, you always have to provide a file instead of passing an audio stream of some sort.

So, we know that most commonly used formats are ogg and mp3(not free). Also wav can be used but due to its size not commonly used.

My question is can I fake a file as if it was a stream, say create the wav file (with the riff header) and specify the PCM format details(freq,channel,blah blah) and pass that as the first few bytes and then send the PCM stream over the wire(actualy audio chunks).

The first issue I see if that RIFF header in the wav files require the chunk sizes which is the length of the file. WELL WE DONT HAVE A LENGTH SINCE IT IS AN AUDIO STREAM.

Any ideas.


Solution

  • Yes, absolutely.

    The client doesn't need to know or care that the media it is playing is created live, or being loaded from disk.

    You may have challenges depending on the codec used. WAV present the problems you have mentioned with the header, but it should be possible. With MP3, you can generally just send data at any point, and the decoder will sync to the frames on its own.