0

I'm having trouble in adding a seek feature to my music player.The problem occurs for the google chrome while other browsers(Microsoft Edge,firefox,etc) works fine.The problem can be seen here in detail -> HTML audio can't set currentTime

I'm guessing that the issue is in the HttpResponse Header 'Accept-Ranges' which is not present in the Header data.This is suggested in answers present in the link I provided above.

I'm new to Django programming so I don't have any idea about how to tweak with the Http header.From my reading, I was able to change header of my views but since the media is served(handled) by django, I don't know how to send http header in its response.So It would be great if told how to do it.

KANE
  • 63
  • 1
  • 1
  • 11
  • I think we'll need more detail on how it is being served. I'm guessing as MEDIA, but what web server? Is it really served through Django, or is /media/ treated differently (as it usually is). – Mark Bailey Apr 20 '19 at 12:03
  • No it's served through django. I have used a FileField for media upload and they are stored in the media folder.Then I accessed the audio file using HTML5 audio element with src attritube set to the required location in the media folder.The mp3 file plays without any buffer but when I try to seek by setting currenttime attritube,but It initialises to 0(I have checked by putting simple values as 10,20).Although in firefox and Microsoft Edge this works properly as intended. – KANE Apr 20 '19 at 12:15
  • It sounds like you are hitting the limits of the "lightweight development Web server" provided by `django-admin runserver`. I think you will need to try it with a proper web server. From the docs: DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.) – Mark Bailey Apr 20 '19 at 12:25
  • Yeah It definitely looks limitations... Thanks for your time. – KANE Apr 20 '19 at 12:27

0 Answers0