Integrate other video streaming

Dear all,
Is it possible to implement other streaming videos than YouTube or Vimeo?
For example this one here

Any hints appreciated :slight_smile:

Regards Matthias 22

Hi Matthias, welcome to the forum.

Yes, that is possible. What exactly do you need help with? Creating a block type that supports fair.tube? Or an alternative to the video() helper to output it in a template?

Hi Texnixe,
thanks for the swift reponse.
Asctually we are using kirby with YouTube-videos which is actually not compliant. We would like to test a different streaming method using server from european supplier. But it must be performant enough.

Actual in the panel intro we have a (video: YouTube) command. As IΒ΄m personally not a developer it would it perfect to have a different command to video. Is there any kind of method to stream from other sources?

Regards
Matthias

Oh, ok, this is about kirbytags then.

You have two options here:

  1. Create a custom kirbytag for your new video streaming service

  2. Overwrite the existing video kirbytag.

Check out the source code for the existing video Kirbytag to get an idea how to create your own.

The original tag is rather complicated, because it works with both YouTube and Vimeo videos with all sorts of options.

Your custom Kirbytag can be much simpler, it only has to return an iframe with the url you pass as argument to the tag.

1 Like

Thanks texnixe - will talk to our developer. Greetings vom Buchholz to Mainz.
Matthias

A simple example could look like this:

Kirbytext:

(fairtube: https://fair.tube/videos/embed/90719da2-f719-4195-84e0-cb1230e088e6)

Plugin’s index.php

<?php
use Kirby\Cms\App as Kirby;
use Kirby\Toolkit\Html;

Kirby::plugin('texnixe/fairtube', [
    'tags' => [
        'fairtube' => [
            'attrs' => [
                'caption',
                'class',
                'height',
                'style',
                'width',
            ],
            'html' => function($tag) {
                $src = $tag->value;
                $attrs = [
                    'height'      => $tag->height,
                    'width'       => $tag->width,
                    'frameborder' => 0,
                    // other attributes
                ];
                $video = Html::iframe($src, Html::videoAttr($attrs));
               
                return Html::figure([$video ?? ''], $tag->caption, [
                    'class' => $tag->class ?? 'video',
                    'style' => $tag->style
                ]);
            }
        ]
    ]
]);