Hacker News new | ask | show | jobs
by ehsankia 1989 days ago
Maybe this is a stupid request, but I'd like <img> (or maybe the newer <picture> tag) to take a video but with autoplay=true, loop=true, muted=true and controls=false when given a video source
1 comments

Safari already supports playing MP4 in <img> tags [1]. I think that's how "animated GIF" type of animations should be handled in the Web.

It's silly that there are video formats with excellent compression but image formats want to reinvent it (such as animated PNG, animated WebP, animated AVIF...). It just adds extra complexity to image formats.

[1] https://developer.apple.com/documentation/webkit/delivering_...

Ah, that seems exactly like I was asking for, unfortunately in the 3 years since Safari added it, I can't find much pick up on it. I found this on Chromium but with not much progress. It seems their code path doesn't quite let img decode a video, I assumed it would be as easy as creating a fake <video muted loop autoplay> but it's probably much more messy.

https://bugs.chromium.org/p/chromium/issues/detail?id=791658

It's the other way around for "animated AVIF". It's 2 generations better than H.264 used in MP4, and (basically) not patent-encumbered.