Not able to complete meta box save function and sanitization/validation

Once validated, you just need to update the post meta with the form input:

 if ( url_allowed( $_POST['video-url'] ) ) {
     update_post_meta( $post_id, 'video-url', esc_url( $_POST['video-url'] ) );
 } else {
     //if user edits entry to remove a url from input, it will be deleted
     delete_post_meta( $post_id, 'video-url' );
 }

If you look at the source of esc_url(), you can see it is using wp_allowed_protocols and wp_kses_normalize_entities().


Side Note:

It is also parsing the url with wp_parse_url(), a wrapper for php’s parse_url(), to check the different parts. Not unlike what we did in the url_allowed() function (in fact I’ll update that answer to use wp_parse_url() if you want).