-
Notifications
You must be signed in to change notification settings - Fork 707
[web-animations-2][css-animations-2] Allow controlling video playback via an animation timeline #11611
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
Comments
For what it's worth, when we designed the Web Animations API, the intention was that driving video playback would happen via different types of effects and you'd synchronize it with other animations via group effects. |
Yeah, that would be a more coherent method. I suppose if we have So, how would a declarative API look like? It seems to me that all we need here is WDYT? |
I can see possible use cases for some other Sebastian |
Bikeshedding: maybe
I feel like that’s the type of thing authors would be able to make themselves using an (Also see https://brm.us/scroll-driven-video#the-demos where I built this type of thing – using a My feeling here is that instead of trying to determine all sorts of new If the To make these effects available in CSS, they could register it using something like (Personally I believe an Winging back to Rob’s proposal: What I like about it is that it allows an author to take a |
I agree with @SebastianZ . Having Having the rest of the options/properties could be useful with a regular document timeline as well. I.e. one could use end-delay to play a video to predefined stop. Direction would allow us to do that in reverse, effectively allowing us to play a video step-by-step. (I would love a |
So what I'm hearing is that we should have an easy way to make an effect that drives the video. I wonder if this would be something like CSS: video {
animation-name: video();
} Or, in JS: new Animation(new VideoEffect(video), { /* animation options */ }); To the concern from @bramus about just wanting to drive a video, this would be as simple as: video {
animation-name: video();
animation-timeline: view();
} |
Isn’t that inverted? I would imagine the code to look more like this: #elem {
animation: anim 5s linear infinite;
animation-timeline-name: --timeline-from-the-elem;
}
video {
playback-timeline: --timeline-from-the-elem; /* Link my playback to the progress of the timeline of the animation */
} I know, |
These are two different features:
Example for the first can be playing a canvas-based effect on a video. Both are valid, but in this case we're referring to the second. I like the Just wondering as possible future extensions, other things we may want to control on a video could be:
Just to keep in the background. |
So do I. With (In hindsight maybe we should have called |
The reason to use a video effect, is that you get to re-use the rest of the animation ecosystem. With
Building this on top of an animation effect gets you all of these things implicitly. I think of it as that you are animating the video progress, which is similar to animating some internal css property that sets the video time. The only part I'm uncertain of, which |
Like you said,
Yes, agreed.
I think that But another thing that comes to mind, we need to think whether |
While we were focusing on video playback so far, I want to note that any solution we come up here should also apply to audio playback. So the functionality and naming of the new feature should be general enough to cover both.
This was proposed by @bramus in #9110. Sebastian |
Audio is a bit more problematic because of autoplay policy, but that aside, I'm not sure how desired, or even viable, it is to scrub an audio file using scroll or pointer. Audio behaves differently from video in these cases, e.g. pitch will change based on playback rate. |
Similar to #9110, authors often want the ability to drive videos by animation timelines. See #11587 and #6861 (comment).
We'll need to figure out the details, but this could be something like
Possibly also with css support, e.g.:
The text was updated successfully, but these errors were encountered: