Measures the playback duration of an MP3 byte stream.
Walks MPEG audio frame headers and sums each frame's samples over its sample rate, so
constant- and variable-bitrate streams are both handled. Any Xing/Info header frame is
counted as the ordinary (silent) frame it is, worth well under one percent of a clip.
Parameters
bytes: Uint8Array
Raw MP3 bytes, optionally preceded by an ID3v2 tag.
Returns number
Duration in milliseconds, or 0 when no valid frame is found.
Measures the playback duration of an MP3 byte stream.
Walks MPEG audio frame headers and sums each frame's samples over its sample rate, so constant- and variable-bitrate streams are both handled. Any Xing/Info header frame is counted as the ordinary (silent) frame it is, worth well under one percent of a clip.