Get first file > image or video, inside a gallery, php

Dear Kirby team,

I’m struggling to insert some video files inside my swiper and can’t find the right php loop to make it works (it’s working well in html).
I have a simple content structure, (Index > a list of projects > files). I’m trying to get the first file of each project to show it in a gallery. (either a video or a img file)

Can you help?
Thank you