{block name='productdetails-mediafile-youtube-embed'}
    {et_isShopVersionAtLeast value="5.3.0-rc.3" assign='shopIsAtLeast53'}
    {if $shopIsAtLeast53}
        {include 'snippets/video.tpl' video=$oMedienDatei->video class='yt-container'}
    {else}
        {$height     = 'auto'}
        {$width      = '100%'}
        {$related    = '?rel=0'}
        {$fullscreen = ' allowfullscreen'}
        {if (isset($oMedienDatei->oMedienDateiAttribut_arr) && count($oMedienDatei->oMedienDateiAttribut_arr) > 0)}
            {foreach $oMedienDatei->oMedienDateiAttribut_arr as $attr}
                {if $attr->cName === 'related' && $attr->cWert === '1'}
                    {$related = ''}
                {elseif $attr->cName === 'width' && is_numeric($attr->cWert)}
                    {$width = $attr->cWert}
                {elseif ($attr->cName === 'height' && is_numeric($attr->cWert))}
                    {$height = $attr->cWert}
                {elseif ($attr->cName === 'fullscreen' && ($attr->cWert === '0' || $attr->cWert === 'false'))}
                    {$fullscreen = ''}
                {/if}
            {/foreach}
        {/if}
        {$search                     = ['https://', 'youtu.be/', 'watch?v=']}
        {$replace                    = ['//', 'youtube.com/embed/', 'embed/']}
        {$embedURL                   = str_replace($search, $replace, $oMedienDatei->cURL)}
        <a href="#" class="trigger give-consent" data-consent="youtube">{et_language key="et360_youtube_consent"}</a>
        <div class="yt-container">
            <iframe class="needs-consent youtube"
                    data-consent="youtube"
                    width="{$width}"
                    height="{$height}"
                    data-src="{$embedURL}{$related}"
                    frameborder="0"{$fullscreen}>
            </iframe>
        </div>
    {/if}
{/block}
