WordPress has an awesome oEmbed feature where a user just has to enter the url of the media you want embedded and WordPress takes care of the rest. Sadly, this only works when you put the link in the content. If you're creating custom post types, a plugin, or using custom meta data you may run into a situation where you want to embed some media that isn't in the content in which case you need to do a little coding.
Apply Filters to the Media
The first thing we have to do is add a filter right before you print your content. You can think of the apply_filters() function as a placeholder for more code.
Add WordPress Embed Functionality to Filter
The last thing we have to do is tell WordPress to add the default oEmbed functionality to anything in our filter.
Conclusion
You're custom post data has the awesome oEmbed functionality. Time to celebrate. 🙂