Procedure AudioLoop()Pa_ReadStream(*my_stream, *writeBuffer, framesPerBuffer)CreateFile(10, "temp.raw"):WriteData(10, *writeBuffer, framesPerBuffer*bytesPerFrame): CloseFile(10)RunProgram("\Programs\Opus\opusenc.exe" , "--max-delay 0 --quiet --comp 0 --raw-rate 44100 --raw-chan 1 temp.raw temp.opus", "./", #PB_Program_Wait)header$="HTTP/1.1 200 OK"+#CRLF$header$+"Server: 127.0.0.1:8000" + #CRLF$header$+"Content-Type: audio/ogg"+#CRLF$header$+"Cache-Control: no-cache"+#CRLF$header$ +#CRLF$ReadFile(10, "temp.opus"): ReadData(10, *writeBuffer+Len(header$), leng): : CloseFile(10)If ClientID <> 0SendNetworkString(ClientID, header$)result = SendNetworkData(ClientID, *tempBuffer, leng)EndIfEndProcedure
You've seen the code and I've said the program works with mp3 files. Why a browser stops accepting data after the first buffer/packet is the mystery. I'm not going to worry about the rest of it until that mystery is solved.
OK I tried sending the HTTP header only once, then sending successive packets. No change. Firefox plays through the first packet and quits.
I've been using audio/opus as the mime type, which I believe is now the standard for opus.