Video not loading with Kirby

I am loading a video uploaded via panel in the frontend. The file is not loading, is my blueprint set up correctly or is my PHP incorrect?

    type: files
    layout: cards
    template: video
    info: "{{ file.dimensions }}"
    max: 1
    size: small
    headline: Video Home

            <?php if ( $video = $page->HomeVideo()->toFile()): ?>
                <video class="video-1" autoplay loop muted data-keepplaying>
                    <source src="<?php echo $video->url() ?>" type="<?= $video->mime() ?>" />
            <?php endif ?>

I fixed it by putting this inside the fields section in my yml.

You cannot fetch a file from a section like this, this only works with a field.

In this case, you have to fetch the file via the template

<?php if ( $video = $page->video()->template('video')->first()): ?>

Okay yes this makes sence, after i put this code in my feild it worked. i will try keeping it in section and use this code, thank you.