html5

I've been trying to get background music working for my browser-based game. It's working great, but in Chrome I frequently have the music cut short and this error appears:

Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH

I watched the Network tab and saw the audio file being loaded as it should be, with the 206 Partial Content status, until it hit that error and just stopped.

Reloading the page will usually yield the same result, but at a different point in the track. I have yet to encounter this problem in IE, it seems to only be Chrome that's affected.

Any suggestions as to what may be happening?


Example request/response:

GET /music/___________.mp3 HTTP/1.1
Host: ____________.net
Connection: keep-alive
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36
Accept: */*
DNT: 1
Referer: http://____________.net/
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Cookie: SID=XXXXXXXXXX
Range: bytes=0-

HTTP/1.1 206 Partial Content
Date: Tue, 26 Aug 2014 13:53:38 GMT
Server: Apache/2.2.26 (Unix) mod_ssl/2.2.26 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
Last-Modified: Fri, 13 Jun 2014 21:00:31 GMT
ETag: "219f1a-8ed344-4fbbdf7c339c0"
Accept-Ranges: bytes
Content-Length: 9360196
Content-Range: bytes 0-9360195/9360196
Connection: close
Content-Type: audio/mpeg

Increasing Apache's timeout setting fixed it.

Basically Chrome was being "too clever" by only downloading fast enough to keep just ahead of the buffer, and Apache was getting bored.

链接地址: http://www.djcxy.com/p/21278.html

上一篇: LDA gensim实现,两个不同文档之间的距离

下一篇: HTML5