问题
I have been trying to play the mp3 file in browser using default html5 player.
http://ujyaaloonline.com/audios/programAudios/1a8fdf5d0433ed581bbcee74836b3305.mp3
Audio is playing but the seek bar is not working here. What might be the problem. Please help.
回答1:
You need to support byte range requests on the machine from which you're serving the audio. See SoundManager2's Technical Notes on the subject.
Byte Serving is automatically negotiated between client and server, and offers a number of advantages over traditional downloads. Most notably, Byte Serving is closer to a "streaming" technology and enables clients to seek, buffer and resume playback at arbitrary positions within a file once the duration is known.
Example Request:
GET 1a8fdf5d0433ed581bbcee74836b3305.mp3 HTTP/1.1
Range: bytes=5210604-5275910
Expected Response:
HTTP/1.1 206 Partial Content
Accept-Ranges: bytes
Content-length: 65307
Content-Range: bytes 5210604-5275910/5275911
Content-Type: audio/mpeg
- You don't appear to be sending the 206 Partial Content status.
- You're not sending a proper
Content-Range
response header. - Finally if the client makes a range request that is out of bounds—that is, none of the range values overlap the extent of the resource—the server should respond with a 416 Requested Range Not Satisfiable status.
来源:https://stackoverflow.com/questions/35744718/seek-bar-in-mp3-file-not-working