Sonos speakers need content-length header?

188 Views Asked by At

I am currently writing a DLNA server which serves streams for DMRs such as the Sonos Play 1 & 3.

Accordingly to the HTTP 1.1 specification, when you do not know the actual length of a track, do not specify Content-Length, instead just specify Connection: Close. This should make the clients read the stream until the server closes the connection.

This is working fine for wav and flac streams. But for mp3 and ogg streams i need to specify a Content-Length to make them play. Otherwise the Sonos clients just close the connection instantly by them self. In my case its a live stream of the computers current playback. Therefore it is impossible to know the length. As long as the computer runs there is content to play.

My current solution is to fake the content length and set it to an absurd value (100gb) to make the stream play forever.

I am wondering about that behaviour, because it is working fine for wav and flac, but not for mp3 and ogg.

What am i doing wrong? Or is this just a deviation from the HTTP 1.1 specification?

0

There are 0 best solutions below