Skip to content

Seeking to individual frames #15

Open
@ocram

Description

@ocram

In HTML5 and JavaScript’s DOM, there is the HTMLMediaElement with its currentTime property, which we use to seek forward, backward, and to individual positions. That property supports a higher precision than this project currently makes use of in the web editor.

In effect, we could more or less seek to any individual frame, and support moving forward or backward by single frames in the web editor.

HTMLMediaElement.currentTime += 1/10;
HTMLMediaElement.currentTime += 1/12;
HTMLMediaElement.currentTime += 1/12.5;
HTMLMediaElement.currentTime += 1/15;
HTMLMediaElement.currentTime += 1/23.976;
HTMLMediaElement.currentTime += 1/23.98;
HTMLMediaElement.currentTime += 1/24;
HTMLMediaElement.currentTime += 1/25;
HTMLMediaElement.currentTime += 1/29.97;
HTMLMediaElement.currentTime += 1/30;
HTMLMediaElement.currentTime += 1/50;
HTMLMediaElement.currentTime += 1/59.94;
HTMLMediaElement.currentTime += 1/60;

The problem is that we won’t know the frame rate of a video being played. At least not automatically, i.e. we’re not able to detect it from code. So we either have to explicitly ask the user for the rate to use, or hard-code the frame rate to a fixed (and common) value, or offer a variety of frame rates to choose from.

Apart from that, the latest Firefox seems to limit the precision of HTMLMediaElement.currentTime to 2 milliseconds. But that’s still pretty useful and allows us to seek by 1 or 2 individual frames. Other browsers may still support a higher precision (or, if we’re unlucky, an even lower one).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions