-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Feature proposal: declarative way to do art direction for <video> (maybe <source media>) #4544
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
The |
See https://twitter.com/foolip/status/1179031601998516224 (cc @foolip )
I wrote:
|
More complications:
It would be useful to review pages/apps that serve different videos based on MQ (using script), to understand what is needed. |
@zcorpan thank you for attracting attention to this issue. In my opinion, this attribute has the most impact on page loading. Changing MQ and swapping video sources during website lifecycle has a secondary priority. I think all these complications are solvable and implementing almost any behavior is better than not implementing it at all. But I agree that it should be investigated and selected the best available implementation. My thoughts on the above complications:
It should not runs only once, instead it should run when it needed
It should try to seek to the same time in the new video.
Seamless swap for videos is desirable |
Edited badly: To try and clarify use cases and why I've mentioned aspect-ratio. Problem seems to be: Viable Use-Cases:
An example that people may remember is that PayPal used to have a huge banner video on desktop, with a different aspect-ratio video for mobile (or maybe they just trimmer the excess width off with css, to the same effect to a degree). @zcorpan @shrpne I agree that these seem like issues that can be fixed without breaking backwards compatibility or existing implementations of I'd also like to see aspect-ratios #4968 introduced if MQ are indeed going to be added to Reasoning:
I think an attribute on Addition Problem - extending the base problem
In this case should there be an attribute introduced to 'link' them so the browser knows they are identical in video length? This seems a bit convoluted when you start to add MQ (and width/height attributes for aspect-ratio) to each source.. the code gets a bit redundant and bloated. Perhaps a new element, say |
It's impossible to evaluate proposals without first having a common understanding about use cases and requirements. See https://whatwg.org/faq#adding-new-features I think this issue is about the art direction for video use case; please file new issues to discuss other use cases. If you want to experiment with different syntaxes or solutions, I suggest doing that by creating a custom element that polyfills the thing you want. If this identifies missing primitives to be able to do what you want, that's useful to know. If you come up with a pattern that is common on the web and it would be better to have it natively supported, that's also useful to know. And again, if you have examples of live web sites that do this kind of thing today, please share. |
Our current hero element on Harry's is an example of this use case: https://www.harrys.com/en/us?sticky=true. We also heavily rely on art direction using the Being able to differentially load a single video I agree with others that aspect ratio feels important to this discussion, that a seamless swap would be a nice to have, and that questions around seeking behavior are less important than enabling this in the first place. |
We rely heavily on art direction for videos. Many of our articles contain cinemagraphs or short video loops. To give the users the best experience we deliver a different aspect based on the users screen. Often that means delivering a 16:9 video to desktop users and a 1:1 video for mobile devices, as in the example below. We currently use css and a custom element to swap between two or more video elements. |
Thank you both for sharing, and my apologies for the long delay in analyzing them.
I don't see a video there anymore, but, WayBackMachine to the rescue: https://web.archive.org/web/20191010102520/https://www.harrys.com/en/us Switching between a big viewport and a small viewport in devtools, a script seems to replace the Thanks! This (right now) uses both art direction between two different aspect ratios, and small/medium/large versions for each aspect ratio. So total of 6 videos, all in different So, from these two examples I gather this:
Are these correct? If so, from what I can tell, if |
@zcorpan Broad support / standardisation for video in picture/img that would solve of this use case. I have a few comments though. "1x is good enough". looping playback control |
I would add that this should IMHO not be limited to videos without audio. I guess support for soundless videos in |
Here's an example that would not be solved with https://www.nrk.no/vestland/xl/slik-var-det-ekstreme-sommarregnet-i-jolster-1.15030175 An animation provided from the graphics team was split into short videos and played back (without looping) as the reader scrolls through the story. Art direction is used to provide the user a video based on the aspect-ratio of their device. This requires control over whether the video is looping and when to start and stop the playback. |
Are there examples of "2x" videos used on the web? Can users tell the difference between 1x and 2x when the picture is in motion? (cc @eeeps)
Indeed it doesn't. Author control over looping could be added to
Indeed.
Thank you! Indeed this example starts to stretch what is appropriate for Question: If the user rotates their device or resize the browser window, should the new video be switched in seamlessly (that is, at least retain |
Technically we serve 640x380 video to the smallest screens, which would be equivalent to 2x. If support was on par with
I don't have numbers on how many users rotate their devices while consuming the content, but my gut feeling is that it while it would be preferable to retain currentTime, it would be OK to start over. We do in some cases listen to currentTime and adjust the playbackRate and or currentTime to sync video to text as the user reads. (This is used in articles similar to https://www.nytimes.com/interactive/2019/03/29/business/boeing-737-max-8-flaws.html). If the UA doesn't seamlessly switch over it should be possible to build support in js. Emitting an event when switching source would be helpful. |
It is the technique I use sometimes to reduce video file size 2x video with bad quality may have better looking and smaller file size than 1x video with good quality |
@shrpne interesting, thanks. Do you serve the 2x video to everyone? |
@shrpne this is what the Compressive Images hack provided back when we didn't have native responsive images yet. I guess it means the browsers consumes much more CPU and RAM (and battery), though. |
Forward-duping this issue to #6363 |
https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element:the-source-element-10
Spec says:
I don't understand why and I think it's a big mistake. These attributes can save much more bytes for video content than for images.
Someone says, that video media query was supported before Google Chrome 34+: https://walterebert.com/playground/video/media-queries/
I assume they removed it because of spec.
I think spec should be changed to allow these attributes for media elements.
The text was updated successfully, but these errors were encountered: