@props(['data' => []]) @php $url = $data['url'] ?? ''; $provider = null; $embedUrl = null; // YouTube detection if (preg_match('/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]{11})/', $url, $matches)) { $provider = 'youtube'; $embedUrl = 'https://www.youtube-nocookie.com/embed/' . $matches[1]; } // Vimeo detection elseif (preg_match('/vimeo\.com\/(\d+)/', $url, $matches)) { $provider = 'vimeo'; $embedUrl = 'https://player.vimeo.com/video/' . $matches[1]; } @endphp
@if($provider && $embedUrl) {{-- Responsive 16:9 iframe for YouTube/Vimeo --}}
@elseif($url) {{-- Native HTML5 video --}} @endif @if(!empty($data['caption']))

{{ $data['caption'] }}

@endif