How do I get the play length of an ogg file without downloading the whole file? I know this is possible because both the HTML5 tag and VLC can show the entire play length immediately after loading the URL, without downloading the entire file.
Is there a header or something I can read. Maybe even the bitrate, which I can divide by the file size to get an approximate play length?
Unfortunately there does not appear to be a way to achieve this.
Mozilla's Configuring servers for Ogg media is very instructive. Basically:
X-Content-Duration
header - sent by the web server if it has it. This explains the HTML5 audio streaming example you raised. If missing, thenContent-length
HTTP headerThe sample rate is stored in the Identification Header - the first header packet. See the specification go to section "4.2 Header decode and decode setup"