@extends('public.layout.app') @php // Helper: build embed URL for YouTube/Vimeo $embedUrl = function($video){ $provider = strtolower($video->provider ?? ''); $url = $video->url ?? ''; if($provider === 'youtube'){ // supports youtu.be/ID or youtube.com/watch?v=ID or /embed/ID preg_match('~(youtu\.be/|v=|/embed/)([A-Za-z0-9_-]{6,})~', $url, $m); $id = $m[2] ?? null; return $id ? "https://www.youtube.com/embed/{$id}" : null; } if($provider === 'vimeo'){ preg_match('~vimeo\.com/(?:video/)?([0-9]+)~', $url, $m); $id = $m[1] ?? null; return $id ? "https://player.vimeo.com/video/{$id}" : null; } return null; // local will be handled by