Use YouTube URLs from custom field in video player element

I have a custom post type with a field called “YouTube URL” to store video URLs for YouTube playback. I’d like the user to be able to enter the URL for a YouTube video in here (because they never paste the ID correctly) AND I’m working with an external source for the initial posts data which has the URL in the field data too.

Is there a way of making this data work with the video player element which currently expects the video ID to be the video source?

I think the easiest way to write a php function with str_replace to remove everything except id and then call it via {echo}