Customize video embeds

Hi!

I would like to add custom options to my vimeo embed src URL, to get something like the following:

<iframe src="https://player.vimeo.com/video/00000000?color=ffffff&amp;title=0&amp;byline=0&amp;portrait=0"</iframe>

I have this in my template file (using the Kirby 3 Embed plugin):

  <?php if($embed = $page->embed()->toEmbed()): ?>
    <div class="video-wrapper">
      <?= video($embed->url()) ?>
    </div>
  <?php endif ?>

I am not sure of the syntax to add vimeo options that will be used as query params in the embed URL. (I’m looking to set byline and title to 0, and color to ‘ffffff’).

I have seen similar questions (like this one for Kirby 2) but I am not sure how to implement this in my case.

Thanks!

You can pass the options like this:

<?= video('https://vimeo.com/425396315',[

    'vimeo' => [
        'portrait'=> 1,
        'color' => '000000',
        'title' => 0,
        'byline' => 0,
    ]

]) ?>

This allows you to also set options for YouTube videos, by using the youtube key.

1 Like

So simple — works perfectly, thank you!