2 ms·
> Unlike <img> tags, <video> posters have no standard way of specifying many URLs for fetching the optimal format supported by the client. Actually, you can do
by chrismorgan 3y ago
> Unlike <img> tags, <video> posters have no standard way of specifying many URLs for fetching the optimal format supported by the client.
Actually, you can do it without needing any scripting, though the technique is convoluted: use as the poster an SVG image (encoded inline as a data URI), containing a <foreignObject>, containing an HTML <picture> element. It ends up roughly this (with superfluous whitespace added):
<video
poster='data:image/svg+xml,
<svg xmlns="http://www.w3.org/2000/svg" …>
<foreignObject …>
<picture xmlns="http://www.w3.org/1999/xhtml">
…
</picture>
</foreignObject>
</svg>
'>
</video>
- efortis 3y agoThank you. This is handy for requesting with options besides the image format.