Jay Kyburz
Jay Kyburz

Reputation: 699

Google App Engine serving MP3 for Audio Element needs Content-Range Header

So from what I can tell, when a page in Safari requests an MP3 for the Audio element, it will only play once unless it has a Content-Range header.

Any ideas how to format a content Range Header correctly so that I can fix this issue.

Upvotes: 2

Views: 346

Answers (1)

idbehold
idbehold

Reputation: 17168

  • You must send the 206 Partial Content HTTP status.
  • Include an Accept-Ranges: bytes header.
  • Include a Content-Range: 0-2048/123456 header where you send the starting and ending byte index of the content followed by the total byte length of the content. The client will be sending you the byte ranges it wants in the request header. The client may send multiple byte ranges in a single request, in which case you'd also need to send the content with multipart word boundaries.
  • If the client requests a byte range that isn't satisfiable then you must send a 416 HTTP status and close the connection.

Upvotes: 1

Related Questions