Try something like this:
function realistic_get_first_embed_video($post_id)
{
$post = get_post($post_id);
$content = do_shortcode(apply_filters('the_content', $post->post_content));
$embeds = get_media_embedded_in_content($content);
if (!empty($embeds)) {
//check what is the first embed containg video tag, youtube or vimeo
$counter = 0;
foreach ($embeds as $embed) {
// Check condition if count is 0 then
// it is the first iteration
if( $counter == 0 ) {
return '';
}
/*
if (strpos($embed, 'video') || strpos($embed, 'youtube') || strpos($embed, 'vimeo') || strpos($embed, 'dailymotion') || strpos($embed, 'vine') || strpos($embed, 'wordPress.tv') || strpos($embed, 'hulu')) {
return $embed;
}
*/
$counter = $counter + 1;
}
} else {
//No video embedded found
return;
}
}