Video plugin outputting at top of kt() textarea

Just run into a small issue with my video plugin for some reason, with 3.2.2 it outputs the video at the top of the kirby text out put, regardless of where i put the kirby tag. If i stick it between paragraphs 4 and 5 for example, it still comes out at the top of the page in the browser.

The plugin renders a snippet in the field where the kirby tag is placed. This worked previously, but does not seem to do so in 3.2.2.

What could be causing this?

Problem with empty lines in snippet or indentation? I think I’ve seen this before…

I tried that before posting, but no luck.

I see your snippet call has the third param set to false (which is the default, anyway), but if you store it in a variable, it should be set to true.

That sorted it :slight_smile: thanks.

Did this really work with a previous Kirby version? I’m tempted not to believe that (because one thing I’ve learned in all these years is “Don’t take their word for it when users say it worked before, I didn’t change anything” :wink:.

Well, im sure it did when i first tested it, since i would have investigated if i had seen it happen :slight_smile:

Unless i put it at the top when i tested it…

That was probably the case, because I bet a quick test would reveal the same issue in a prior version :woman_shrugging:

The code on GitHub is still set on false.
Happy that I found this thread, wished I didn’t had to search for it :wink:

Another issue:
The plugin picks a .png from the the same page, rather than the addressed .mp4.
Only if I make the .mp4 alphabetically first, the plugin picks the video file.

Thanks…Can you please log these as Github issues?

I made a Github account to report this issue.
But it does not seem to impress you much :wink:

I looked into the plugin myself but was not able to fix the problem.
I’m sure it should not be a birg problem for you, since the poster-image works fine.

Thanks for reporting, it’s not a question of being impressed, alot of us make these plugins in our spare time, for love (certainly not money, since people rarely hit donate links…).

I will look into it when i can find the time. PR’s are welcome.

I just took a look at this and it works as expected for me (added 2 different videos, and two different posters). As stated in the plugins readme file…

The plugin makes use of ->file() - be aware that this uses the first image or first video on the page if the desired one is not found. This is by design.

Please check the filenames you are using in the are correct, including case.

@ewalthert Seems there was a problem after all. I just pushed a fix. Please update your copy of the plugin.

Thanks a lot for looking into the problem.
I updated the plugin. The addressing of the video file is indeed fixed now. Thanks :+1:
Unfortunately I’m getting an error now whenever two videos are placed on the same page.

Error
Call to a member function mime() on null

/site/plugins/kirby3-video/snippets/video.php

3. $videsourcetag = Html::tag('source', null, ['src' => $videourl, 'type' => $video->mime()]);

Strange, it works for me with multiple files on the page. Mime types are being pulled in for me. Can you please give me more information? Did you add the tag to a page with no videos or images at all?

@jimbobrjames I only had a quick look, but where do you check that the video actually exists?

Like this…

$file         = $tag->parent()->file($tag->value);
$fileurl      = $file ? $file->url() : '';

Was that silly? Its in the actual tag (line 41), not the snippet.

Well, you check if the file exists before you call the url() method, but then later on, you pass the $file variable to the snippet (in the $args param) and within the snippet, you call $video->mime() without checking if $video is a file object.

Oh yes, so i did. Without knowing how @ewalthert triggered the error, I can’t be sure I’ve fixed it. Wrong file name i guess, since that does it for me.

Edit: @texnixe excuse my manners, i forget to say thanks for looking!

1 Like