@php $yt = optional($siteSettings)->youtube_live_url ?? env('YOUTUBE_LIVE_URL'); $fb = optional($siteSettings)->facebook_live_url ?? env('FACEBOOK_LIVE_URL'); // Prefer YouTube if both present $hasLive = !empty($yt) || !empty($fb); @endphp @if($hasLive)
LIVE Now streaming
@if(!empty($yt)) YouTube Live @elseif(!empty($fb)) Facebook Live @endif
@if(!empty($yt)) @php $embed = $yt; // Accept channel live URLs or direct video/streams if (preg_match("~youtu\.be/([\w-]+)~", $yt, $m)) { $embed = 'https://www.youtube.com/embed/' . $m[1] . '?autoplay=0&modestbranding=1&rel=0'; } elseif (preg_match("~v=([\w-]+)~", $yt, $m)) { $embed = 'https://www.youtube.com/embed/' . $m[1] . '?autoplay=0&modestbranding=1&rel=0'; } elseif (preg_match("~/embed/([\w-]+)~", $yt, $m)) { $embed = 'https://www.youtube.com/embed/' . $m[1] . '?autoplay=0&modestbranding=1&rel=0'; } @endphp @elseif(!empty($fb)) @php // Facebook Page Live Video plugin expects a page URL; if full plugin URL passed, use directly $src = $fb; if (!str_contains($fb, 'facebook.com/plugins/video.php')) { $enc = urlencode($fb); $src = "https://www.facebook.com/plugins/video.php?href={$enc}&show_text=false&autoplay=false"; } @endphp @endif
@endif