This is what works. This gets the src URL entered into the custom field using get_post_meta and prints the video using wp_video_shortcode
function video() {
$self_hosted = get_post_meta( get_the_ID(), 'self_hosted', true );
$video_src_url = $self_hosted ? $self_hosted : wp_get_attachment_url( get_theme_mod( 'customizer-video' ) );
if ( $video_src_url ) {
echo '<div class="video-container">';
$attr = array(
'src' => $video_src_url,
'poster' => $video_thumb,
'preload' => 'none',
);
echo wp_video_shortcode( $attr );
echo '</div>';
}
}
You can use this code to display a video added via the customizer otherwise a video added via custom field is shown if present.