@php $url = (string) ($url ?? ''); $title = $title ?? 'ভিডিও'; $isFile = (bool) preg_match('/\.(mp4|webm|ogg|mkv)(\?.*)?$/i', $url); $embed = null; if (! $isFile && $url !== '') { $parts = parse_url($url); $host = strtolower(preg_replace('/^www\./', '', $parts['host'] ?? '')); $segments = array_values(array_filter(explode('/', $parts['path'] ?? ''))); $query = []; if (! empty($parts['query'])) { parse_str($parts['query'], $query); } $id = null; if (in_array($host, ['youtube.com', 'm.youtube.com', 'youtube-nocookie.com'], true)) { $id = $query['v'] ?? null; if (empty($id) && in_array($segments[0] ?? '', ['embed', 'shorts', 'live'], true)) { $id = $segments[1] ?? null; } } elseif ($host === 'youtu.be') { $id = $segments[0] ?? null; } if (! empty($id)) { $embed = 'https://www.youtube-nocookie.com/embed/'.$id; } } @endphp @if($url !== '') @if($isFile)
@elseif($embed)
@else

ভিডিও লিঙ্ক: {{ $url }}

@endif @endif