Seek bar in mp3 file not working

若如初见. 提交于 2019-12-13 07:27:37

问题


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
  1. You don't appear to be sending the 206 Partial Content status.
  2. You're not sending a proper Content-Range response header.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!