开发者

Displaying song duration

开发者 https://www.devze.com 2023-03-15 07:45 出处:网络
I\'ve been able to play media with a html5 audio element but the duration of the song never displays correctly, and when it plays the p开发者_运维百科rogress bar just fills up, although it does play f

I've been able to play media with a html5 audio element but the duration of the song never displays correctly, and when it plays the p开发者_运维百科rogress bar just fills up, although it does play fine. This is what I've been doing. I'm using ogg vorbis files.

  1. Started with jPlayer, had this problem.
  2. Heard the problem might be related to my Jetty server so I switched to Tomcat, but I still had this problem.
  3. Tried using the plain html5 audio element and the problem persisted.
  4. Put a video in my page with an html5 element, and that had the correct duration.
  5. I imported all my audio from CDs using the same program, so although I can see the duration any number of other ways I thought I might try files from some place else. So far every file I try has the problem.

I've been hearing about an Accept-Ranges header but I don't know how to see if I'm using that header, how I would make sure to use the header, or when I would use the header(do I send it with the html page, do I send with with the audio itself? Can I add a header to a file?)


I'm very new to web programming and figuring out the ropes have been tough. In the end I just added the "Accept-Ranges" : "bytes" to every response my server returned. I thought I would have to be careful what responses I added headers to but this is working out. In clojure with compojure which is the language and framework I'm working in I just use a middleware that adds "Accept-Ranges" : "bytes" to the response map under :headers and it looks like there is a setHeaders function in the response object in Java.

0

精彩评论

暂无评论...
验证码 换一张
取 消