url()->value(); $caption = $block->caption()->value(); // Fonction pour détecter le type de vidéo function getVideoEmbedCode($url) { // YouTube if (preg_match('/youtube\.com\/watch\?v=([^&]+)/', $url, $matches) || preg_match('/youtu\.be\/([^?]+)/', $url, $matches)) { $videoId = $matches[1]; return ''; } // Vimeo if (preg_match('/vimeo\.com\/(\d+)/', $url, $matches)) { $videoId = $matches[1]; return ''; } // Vidéo directe (mp4, webm, etc.) if (preg_match('/\.(mp4|webm|ogg)$/i', $url)) { return ''; } // Par défaut, iframe return ''; } ?>