So, I set too and here is a snippet for my
https://plugins.bludit.com/plugin/addcode2page
plugin.
It allows iframe sizing and is responsive.
Code: Select all
<?php
// NB aspect-ratio was introduced in 2021 so should be reasonably browser compatible
// unless the ratio needs changing all you need to do is consider the .wrap width and
// paste in the embed code from the youTube video [this is the iframe section]
$snipData .= '<style> .video { aspect-ratio: 16/9;} .video > * { width: 100%; height: 100%; }
.wrap { max-width: 444px; } // CHANGE WIDTH: size or units
</style>';
$snipData .= '<div class="wrap"><div class="video">';
// PASTE EMBEDDED IFRAME CODE HERE
$snipData .= '<iframe width="560" height="315" src="https://www.youtube.com/embed/NAf3UCCXugU?si=aInQKcEtRXVWHtgz" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>';
$snipData .= '</div></div>';
?>

