Normally when you want to embed media you use the [ embed ] shortcode which automatically does it for you

However if you are trying to embed media in a template file (perhaps because you have a custom post type or custom fields) then you would thin that you can use do_shortcode() function to handle it for you.

But with media embeds you actually need to use the following:

echo wp_oembed_get( '' );