Usecase: Imagine if a dev wanted to download and play the first 10 seconds of an mp4. They can parse the moov box, seek(0) and seek(10) to get the byte range, and append the buffers from that info.
However, there's a couple of problems with this:
seek seeks the file. This can be problematic when introspecting on a file that's playing.
seek returns the latest bytes to be appended.
This is a pretty big one. The seekInfo returned can choose not to correspond to the time being requested, but the 'last known byte' that needs to be appended. (If the first 15 seconds have been downloaded, the byteOffset returned is for the 15th second).
Proposed Solution: Have a method, say offsetForSecond, which would return the byteOffset for a specific timestamp in the file.
Usecase: Imagine if a dev wanted to download and play the first 10 seconds of an mp4. They can parse the moov box,
seek(0)
andseek(10)
to get the byte range, and append the buffers from that info.However, there's a couple of problems with this:
seek
seeks the file. This can be problematic when introspecting on a file that's playing.seek
returns the latest bytes to be appended.Proposed Solution: Have a method, say
offsetForSecond
, which would return the byteOffset for a specific timestamp in the file.