<?php

/**

 * Ortak medya bileşeni — net, tam görünüm (PC + mobil).

 */

$mClass = $mClass ?? '';

$mAutoplay = $mAutoplay ?? true;

$mAlt = $mAlt ?? '';

$poster = media_poster($mImage ?? null);

?>

<?php if (!empty($mVideo)): ?>

<video class="media-vid <?= e($mClass) ?>"

    <?= $mAutoplay ? 'autoplay muted loop playsinline webkit-playsinline' : 'controls playsinline webkit-playsinline' ?>

    preload="<?= $mAutoplay ? video_preload($mClass === 'media-hero') : 'metadata' ?>"

    poster="<?= e($poster) ?>"

    disablePictureInPicture

    playsinline>

    <source src="<?= e(media_url($mVideo)) ?>" type="video/mp4">

</video>

<?php elseif (!empty($mImage)): ?>

<img class="media-img <?= e($mClass) ?>"

    src="<?= e(media_poster($mImage)) ?>"

    alt="<?= e($mAlt) ?>"

    loading="lazy"

    decoding="async">

<?php endif; ?>

