Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeking to individual frames #15

Open
ocram opened this issue Jul 19, 2018 · 0 comments
Open

Seeking to individual frames #15

ocram opened this issue Jul 19, 2018 · 0 comments

Comments

@ocram
Copy link
Contributor

ocram commented Jul 19, 2018

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant