Skip to content Skip to sidebar Skip to footer

Firefox Ignoring Response Header Content-range And Playing Only The Sample Sent

I have built an audio stream for mp3 files, and each time client hits the audio it receives something like this: But what it does is just plays 1 minute sample instead of 120 min

Solution 1:

Not 100% sure because you didn't provide code or an example stream to test, but your handling of HTTP range requests is broken.

In your example request, the client sends Range: bytes=0-, and your server responds with a 1MiB response:

  • Content-Length: 1048576 (aka. 1 MiB)
  • Content-Range: 0-1048575/...

This is wrong, the client did not request this! It did request bytes=0-, meaning all data from position 0 to the end of the entire stream (See the http 1.1 RFC), i.e. a response equal to one without any Range. (IIRC, Firefox still sends the Range: bytes=0- to detect if the Server handles ranges in the first place).

This, combined with the Content-Length, leads the client (Firefox) to think the whole resource is just 1MiB in size, instead of the real size. I'd imagine the first 1 MiB of your test stream comes out as 1:06 of audio.

PS: The Content-Duration header (aka. RFC 3803) is something browsers don't usually implement at all and just ignore.

Solution 2:

Just an idea. Did you tried some of the http 3xx header like: '308 Resume Incomplete' or '503 Service Temporarily Unavailable' plus 'retry-after:2' or '413 Request Entity Too Large' plus 'retry-after:2'

Post a Comment for "Firefox Ignoring Response Header Content-range And Playing Only The Sample Sent"