How to add muted and playsinline attributes to video?


#1

I have a site in which I would like some videos to behave as GIFs. For these videos to be properly handled on iOS and in Chrome I need to add the following attributes to the video tag:

  • autoplay
  • loop
  • muted
  • playsinline

The first 2 tags seem to be supported in grav, but I can’t find out how to add the muted and playsinline tags. Is there a way to add these too?


#2

Unless the docs are incomplete (possible!), looks like you need to revert to HTML to achieve this.

I notice you logged an issue to add these attributes to Grav’s media Markdown parameters, which should hopefully see it implemented in the near future.


#3

Thanks.

Indeed, I did some more digging and noticed in VideoMedium.php that the tags were not supported. Thought it might be a good enhancement so logged an enhancement request.


#4

Won’t be a difficult PR to code yourself if you are comfortable with PHP. :slight_smile: I will if you don’t.


#5

I’ve created a pull request. My first one, yay :raised_hands: Hope I did it right…