Streaming Live Audio to Browser

Tag: audio-streaming Author: jackcheng123900 Date: 2014-03-29

I am writing a program to serve a live audio stream to a browser. The language is Purebasic with its built-in networking functions. I am trying to serve audio to Mozilla Firefox running an HTML5 page. The HTML5 code works fine as I can receive other on-line audio streams e.g. from Triton sites. The program uses PortAudio and serves packets of audio delivered by PortAudio written to disk and encoded to mp3 using the Lame encoder. PureBasic's SendNetworkData() is used to send the mp3 data. It returns the number of bytes transmitted by my server program. Upon examination I am able to send a few packets successfully and then for some reason the transmissions stop being successful -- the SendNetworkData() function returns -1 which means the packets were not successfully sent. If I use a client program of my own creation I am able to send packets indefinitely. I've tried disabling the firewall, no joy. After a couple of dozen packets it's as if the connection goes dead, but with Firefox only, not with my own client program. I am also sending a header with HTTP 1.1 200 OK and Content-Type:audio/mpeg. OS is Windows 7. The PortAudio part works fine.

This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself. Language, platform, environment and other information would be helpful, along with code and what you've done to troubleshoot so far. You've basically just gone to the doctor and said "it hurts."
Please edit that information into your question using the edit link.

Other Answer1

I may have found the answer to this problem. The header must contain a line like so:

Server: 192.168.1.101:8000

Otherwise, no joy.