Since I was seeing the error on Discuss I decided to take a look, and it did happen on every try on my developer instance as well.
The problem seems to be specifically the referrerpolicy="strict-origin-when-cross-origin" attribute that should be added to the iframe, but the MediaEmbed plugin from TextFormatter doesn't set that attribute.
A solution is to modify the MediaEmbed template, for example with this local extender:
<?php
use Flarum\Extend;
return [
(new Extend\Formatter)
->configure(function ($configurator) {
$tag = $configurator->MediaEmbed->add('youtube');
// Modify MediaEmbed's YouTube template to include the allow and referrerpolicy attributes recommended by Google
$tag->template = str_replace('allowfullscreen=""', 'allowfullscreen="" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin"', $tag->template);
}),
];
This code also adds the missing allow attribute to make sure all YouTube features work as intended.
Note: when this code is used, you probably cannot disable YouTube anymore in my Selective MediaEmbed extension. Don't forget to remove the code from the local extenders if you want to disable YouTube at a later point.