'
} else {
contentHTML = '
'
}
$wrapper.append(contentHTML)
}
$content.find('.tdc-video-thumb-on-mobile').show()
break;
case 'youtube':
const $iframe = $wrapper.find('iframe')
const autoplayOnMobile = false;
if ( $iframe.length ) {
if ('undefined' === typeof $iframe.data('src-src')) {
$iframe.data('api-src', $iframe.attr('src'));
}
let iframeSettingsStr = '',
iframeSettings = {
autoplay: 1,
loop: 1,
mute: 1,
showinfo: 0,
controls: 0,
start: 2,
playlist: 'j3xLUVsn1tg',
};
for ( let prop in iframeSettings ) {
iframeSettingsStr += prop + '=' + iframeSettings[prop] + '&';
}
$iframe.attr('src', $iframe.data('api-src') + '?' + iframeSettingsStr);
$iframe.on( 'load', function () {
var $iframe = jQuery(this),
iframeWidth = $iframe.width(),
iframeHeight = $iframe.height(),
iframeAspectRatio = iframeHeight / iframeWidth,
wrapperWidth = $wrapper.width(),
wrapperHeight = $wrapper.height(),
wrapperAspectRatio = wrapperHeight / wrapperWidth;
$iframe.attr( 'aspect-ratio', iframeAspectRatio );
if (iframeAspectRatio wrapperAspectRatio) {
$iframe.css({
width: '100%',
height: iframeAspectRatio * wrapperWidth
});
}
setTimeout(function () {
$iframe.addClass('tdc-video-background-visible');
}, 100);
});
if ( !autoplayOnMobile && tdDetect.isMobileDevice ) {
$content.find('.tdc-video-parallax-wrapper iframe').remove();
$content.find('.tdc-video-thumb-on-mobile').show();
}
}
break;
}
});
}, 200);
});