Reemplazar URL de YouTube en texto con su código de inserción HTML

Esta función incrusta videos de YouTube si se encuentra en una cadena.

Mi pregunta es cuál sería la forma más fácil de capturar solo el video incrustado (el iframe y solo el primero si hay más) e ignorar el resto de la cadena.

function youtube($string,$autoplay=0,$width=480,$height=390)
{
preg_match('#(v\/|watch\?v=)([\w\-]+)#', $string, $match);
  return preg_replace(
    '#((http://)?(www.)?youtube\.com/watch\?[=a-z0-9&_;-]+)#i',
    "<div align=\"center\"><iframe title=\"YouTube video player\" width=\"$width\" height=\"$height\" src=\"http://www.youtube.com/embed/$match[2]?autoplay=$autoplay\" frameborder=\"0\" allowfullscreen></iframe></div>",
    $string);
}

Respuestas a la pregunta(1)

Su respuesta a la pregunta