Video block issue (conversion from K3.5.x to K3.6.x)

Dear all,

I am about to convert a Kirby site from K3.5.8 to K3.6.x .

Current issue: the conversion of video blocks does not work.

Under K3.5.x the video block definition works fine, when I switch to K3.6.x the panel shows error messages
1/ in case there was a video block already defined, the error message reads: "Cannot read properties of undefined (reading ‘includes’) "
2/ in case a new video block shall be created, the error message reads: "Cannot read properties of undefined (reading ‘open’) "

The error messages are displayed in the panel page at the place where the block should be displayed.

If I switch back (even on the fly) from K3.6.x to K3.5.x, it works as expected without error messages.

The issue even happens, if I do not use a modified /blueprints/blocks/video.yml file, but use the standard off-the-shelf video.yml .

What is the reason, what is my mistake?
Thank you for your support.

Have you deleted the media folder after updating?

(I thought deleting the media folder solved it, but I confused the K-Versions. I did some more tests now.)

No, the media folder deletion does not solve the issue, neither before or after Kirby version change. I cannot convert from K5.3.8 to K3.6.2, because the video blocks still throw error messages in the panel.

If K3.6.2 is active, media folder deleted, and I try to insert a new video block, it show the error message. If I save this change and then turn back to K3.5.8 (with or without media folder deletion), then it accepts the change in K3.5.8 and displays the newly by K3.6.2 inserted empty video block correctly applying the intended modified bluescript. Deleting the media folder again and turning again to K3.6.2 does cause the error message again for the newly inserted video block. In consequence, previously or newly inserted video blocks cause panel error messages.

I compared the underlying page text files and indeed the video block has been inserted under K3.6.2 as all the others. The entry looks good at least to me.

It seems to me that there is an incompatibility or adverse configuration regarding video blocks in K3.6.x . Could there be other steps for me to be performed to solve the issue? How should I start to investigate the issue root cause? Status variable readouts, status checking with hooks, or so? Should I hand in or share log files, code or files with you?
Thank you for your advice!

I have run a few tests to isolate the cause of the error.
For the test I applied a plain kit each for Kirby V3.5.8 und V3.6.2.

1/ I created minimum code files (see below) to get the test environment running.

2/ Under V3.5.8, in the panel I can insert blocks as intended and they are rendered in the frontend browser as intended.

3/ If I switch the Kirby from V3.5.8 to V3.6.2, it still renders all blocks well in the frontend (Kirby cache), but in the backend panel, if a video block has or is been created, immediately an error message is created and no more blocks can be, viewed, inserted or modified.

4/ UNUSUAL aspect: if I create a video block under V3.5.8, switch to V3.6.2 and then rename in file video.yml the field identifier “vid” to “url”, THEN the panel (V3.6.2) does not display an error anymore in V3.6.2, but works as intended (blocks can be inserted etc.). It is just the identifier “url”, I have not found yet any other field identifier wording than “url” (in video.yml), which results in the same (intended) behaviour. The frontend still renders the video (despite the “url” change), because still in the Kirby cache (I assume).
If I insert a new videoblock under V3.6.2, then the code file video.php is called again (still with the now wrong “vid” identifier) and the frontend renderings of videos fails. Changing the “->vid()” chain element to “->url()” is not an option as “url()” is a predefined keyword.

What is the reason for this behaviour? What do I do wrong? How can I achieve the intended Kirby V3.6.2 behaviour for video blocks, and avoid the error messages?
Thank you for your help.

My code files (both for V3.5.8 and V3.6.2):
(note: it’s the simplest version, e.g. if no video file is referenced in the video block, then an default.php error message is thrown in the frontend of course.)

/site/blueprint/site.yml

title: Video Block Test
type: fields
fields:
  dieblocks:
    type: blocks
    label: Folien
    fieldsets:
      - image
      - text
      - video

/site/blueprint/blocks/video.yml

name: VideoBlockTest
icon: video
preview: video
fields:
  vid:
    type: files
    multiple: false

/site/templates/default.php

<h1><?= $page->title() ?></h1>
<?= $site->dieblocks()->toBlocks() ?>

/site/snippets/blocks/video.php

<?php if ($block->isNotEmpty()): ?>
  <figure>
    <video controls autoplay id="mVideo" loop muted>
      <source src="<?= $block->vid()->toFile()->url() ?>" type="video/mp4">
      Your browser does not support the video tag.
    </video>
  </figure>
<?php else: echo "<h1>Block is empty</h1>"; ?>
<?php endif ?>

Do you have a custom preview for the Panel? Looks like you are using the default preview but that doesn’t make sense if your fields is the video.yml are named differently and are also different field types. The default video block doesn’t use a files field.

If you have a custom Panel preview, then please post it here.

Thank you for your response.

According to the documentation to override the default video.yml block blueprint, a custom file is to be put in /site/blueprints/blocks/video.yml . (The customised video.yml file is listed in the previous posting above.)

This is the only customisation done.
Is that what you mean? Is something wrong with the customised video.yml?

Thank you very much for your help.

As I wrote above, the default video.yml uses a url field and a caption field. So the preview uses this field to embed the video via

    video() {
      return this.$helper.embed.video(this.content.url, true);
    }

As you can see, it passes the url from the url field to the embed helper: Helpers | Kirby CMS, which needs a url to a YouTube or Vimeo video.

Now you neither have a field called url (yours is called vid) nor does this field return a url, to a YouTube or Vimeo video, but a file id. With this setup, you need to create your own preview with a HTML video tag. See this audio block recipe for an example:

It’s the same stuff, only difference is that you will use a video tag instead of an audio tag.

So in your case, modifying alone is not enough, you either have to create a custom preview or use no preview at all.