protected function render()
{
$settings = $this->get_settings();
if ('hosted' !== $settings['video_type']) {
add_filter('oembed_result', [$this, 'filter_oembed_result'], 50, 3);
$video_link = 'youtube' === $settings['video_type'] ? $settings['link'] : $settings['vimeo_link'];
if (empty($video_link)) {
return;
}
$video_html = wp_oembed_get($video_link, wp_embed_defaults());
remove_filter('oembed_result', [$this, 'filter_oembed_result'], 50);
} else {
$video_html = wp_video_shortcode($this->get_hosted_params());
}
if ($video_html) {
?>
<div class="elementor-video-wrapper">
<?php
echo $video_html;
if ($this->has_image_overlay()) {
?>
<div class="elementor-custom-embed-image-overlay" style="background-image: url(<?php
echo $settings['image_overlay']['url'];
?>
);">
<?php
if ('yes' === $settings['show_play_icon']) {
?>
<div class="elementor-custom-embed-play">
<i class="fa fa-play-circle"></i>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>
<?php
} else {
echo $settings['link'];
}
}