[whatwg] HTML5 video: frame accuracy / SMPTE

Robert O'Callahan robert at ocallahan.org
Mon Jan 24 12:10:21 PST 2011

On Mon, Jan 24, 2011 at 11:32 PM, Philip Jägenstedt <philipj at opera.com>wrote:

> On Mon, 24 Jan 2011 02:36:15 +0100, Robert O'Callahan <
> robert at ocallahan.org> wrote:
>  Interop problems are going to arise with approximate seeking no matter
>> what
>> we do, which is why it shouldn't be the default.
> OK, let's go with that, then.

Yay! :-)

>  You don't want seekApproximate(T) to always land on the same T'. For
>> example, if a player wants to "seek forward approximately N seconds" via
>> seekApproximate(currentTime + N), but the approximation to currentTime + N
>> is fixed to be some T' less than or equal to currentTime, that would be
>> broken.
>> I would say that seekApproximate(T) should be specified to aim as close as
>> possible to T while being "fast", but the only guarantee is that it seeks
>> somewhere after currentTime if T > currentTime, or somewhere before
>> currentTime if T < currentTime.
> 1. There's a race condition here, seekApproximate(currentTime+0.001) will
> be quite random since currentTime changes while the script is running.

Interesting. It doesn't in Firefox; script always sees a snapshot of a
consistent state until it returns to the event loop or does something modal
(although audio, and soon video, will continue to play while script runs).
I'm not sure if the spec should require that ... overall our APIs try pretty
hard not to expose races to JS.

But maybe you want seekApproximateRelative(deltaT) then...

2. No media framework I've worked with seems to provide fast seeking with
> any guarantee of direction, so it might be hard to actually implement this
> way on many platforms, while fast seeking in general is very easy.

Perhaps you could implement it as "seek fast to T + deltaT, then if that
didn't land us on the right side of currentTime (hopefully rare), do an
exact seek to T + deltaT"?

If approximate seeking can't be used to reliably implement "go forward/back
a bit", then it'll be significantly less useful IMHO.

(I'm becoming increasingly glad we didn't go with the approach of using an
off-the-shelf media framework!)

"Now the Bereans were of more noble character than the Thessalonians, for
they received the message with great eagerness and examined the Scriptures
every day to see if what Paul said was true." [Acts 17:11]

More information about the whatwg mailing list