⁨2⁩ ⁨Comments⁩

Toby Toby Waterhole Founder Oct 27, 2024

Hey @Tyler DuPont, while Waterhole will automatically embed .mp4 links, unfortunately embedding a YouTube video isn't as simple as appending the .mp4 extension to the URL.

However there is a TextFormatter plugin that can automatically embed YouTube videos (among other things). Take a look at Waterhole's Formatter documentation to learn how to configure the formatter, and the TextFormatter MediaEmbed plugin. The code will end up looking something like this:

use Waterhole\Extend;
use s9e\TextFormatter\Configurator;

Extend\Formatter::configure(function (Configurator $configurator) {
    $configurator->MediaEmbed->add('youtube');
});

Hi, Sir,

For your reference,

On my test forum, I added the following code in the "WaterholeServiceProvider.php":

use Waterhole\Extend;
use s9e\TextFormatter\Configurator;

class WaterholeServiceProvider extends Extend\ServiceProvider
{
    public function boot()
    {
        Extend\Formatter::configure(function (Configurator $configurator) {
            $configurator->MediaEmbed->add('facebook');
            $configurator->MediaEmbed->add('youtube');
            $configurator->MediaEmbed->add('instagram');
            $configurator->MediaEmbed->add('tiktok');
            $configurator->MediaEmbed->add('twitter');
            $configurator->MediaEmbed->add('imgur');
        });
    }
}

This allows for quick and simple embedding of the above media platforms.

image.png