Trouble creating custom sanitization function when uploading video files

validate_file doesn’t quite work the way you’re expecting it to – it checks if $file is in the allowed files array, not just its extension/mime type.

You’re looking for wp_check_filetype. However, all that ultimately does is check the extension (i.e. it doesn’t read the headers of the file/ascertain the mime type otherwise).

Unless you implement your own PHP library for mime checking, it’d be quicker & easier to perform a simple regex check on the filename:

return preg_match( '/\.(mpe?g4?|webm)$/', $file ); // Or similar