1

How does browser (Chrome) obtain media file duration without downloading full file with video/audio tag ?

For example when using audio tag with src set to remote mp3 file (http link)

Is it getting calculated from the first chunk's Content-Range HTTP-header field ?

--P.S. related question: Is it possible to know the duration of an MP3 before the entire file is downloaded?

IvanM
  • 2,913
  • 2
  • 30
  • 30
  • Its probably stored in the MP3's file header. – tkausl Apr 13 '18 at 04:32
  • found answer in https://webaudio.github.io/web-audio-api/#AudioBuffer-attributes, another question where does it take sample_rate then – IvanM Apr 13 '18 at 09:45
  • partially answered in https://stackoverflow.com/a/49815245/2154075 – IvanM Apr 13 '18 at 10:58
  • Uh, the webaudio AudioBuffer attributes have nothing to do with this question. For this case, you would have had to download the entire file and decode it to get an AudioBuffer. – Raymond Toy Apr 13 '18 at 15:37

0 Answers0