This is what I crafted to override the defaults, I set a default media width, choose an aspect ratio (16:9) and then replace the video shortcode output.
$defaultMediaWidth = 960;
if ( ! isset( $content_width ) ) {
$content_width = $defaultMediaWidth;
}
add_filter( 'embed_defaults', 'bigger_embed_size');
function bigger_embed_size()
{
global $content_width;
$width = $content_width;
// aspect ratio 16:9
$r1 = 16;
$r2 = 9;
$r = $width / $r1;
$height = $r * $r2;
return array( 'width' => $width, 'height' => $height );
}
function EMP_video_shortcode_override(
$output="",
$atts = [],
$video = '',
$post_id = 0,
$library = ''
){
$defaults = wp_embed_defaults();
$searchfor = [
'width="' . $atts['width'] . '"',
'width: ' . $atts['width'] . 'px;',
'height="' . $atts['height'] . '"'
];
$replaceto = [
'width="' . $defaults['width'] . '"',
'width:' . $defaults['width'] . 'px;',
'height="' . $defaults['height'] . '"'
];
return str_ireplace( $searchfor, $replaceto, $output );
}
add_filter('wp_video_shortcode', 'EMP_video_shortcode_override', 10 , 5);