Easiest way to play audio in page.media?

Video seems very well covered by grav but I couldn’t figure out how to play audio. What would be the easiest way to add html5 audio tags to play audio files in page.media? I tried

<audio controls>
  <source src="{{ page.media['audio.ogg'].url }}" type="audio/ogg">
</audio>

but it’s not processed as twig.
(I’m only an end user, I don’t think I can write a plugin… And twig was just a funny English word two or three days ago.)

Well, that was unexpected! Success! I digged through system/src/Grav, duplicated VideoMedium.php, changed it to AudioMedium.php, created the class AudioMedium, added it in MediumFactory.php and now I have a fully functional tag. Just adding

![](audio.ogg)

renders a nice html5 audio player. Mind blown! :slight_smile:

If you submit your new class as a pull request, i can look at adding it to the Grav core.

Nice! True, if working fine please send a pull request to the repository ^^

OK, I knew at some point I would have to figure out how to do a pull request. I’ll look into it.

I see you created one just fine, and i’ve already merged it! Thanks for your contribution. This is how we all make Grav even better!

Glad to be able to contribute, even if it’s just a drop in the bucket. I wish I could do more to repay what you guys are already giving us.

This great new feature is not yet documented in learn.getgrav.org

Yup, not gotten around to this yet. If no one else does it first, i’ll add it to my list.