<?php
$src = null;
$providerAttr = null;
$provider = null;
if ($block->location() == 'web') {
    $src = $block->src();
} elseif ($block->location() == 'vimeo') {
    $providerAttr = 'data-vimeo-id="' . $block->vimeoID() . '"';
    $provider = 'vimeo';
} elseif ($block->location() == 'youtube') {
    $providerAttr = 'data-youtube-id="' . $block->youtubeID() . '"';
    $provider = 'youtube';
} elseif ($video = $block->video()->toFile()) {
    $src = $video->url();
}
?>


<?php if ($src) : ?>
    <video id="<?= $block->id() ?>" class="vlite-js modal__video <?= e($block->cover()->toBool(), 'cover') ?>" src="<?= $src ?>" crossorigin>
    </video>
<?php elseif ($provider) : ?>
    <div id="<?= $block->id() ?>" class="vlite-js modal__video <?= e($block->cover()->toBool(), 'cover') ?>" <?= $providerAttr ?> <?= "provider='" . $provider . "'" ?>></div>
<?php else : ?>
    <div>No video selected</div>
<?php endif ?>

