How does mediaelement.js work in WordPress?

WordPress core handles the enqueuing of the MediaElement.js scripts and styles automatically when the shortcode is used:

From wp_video_shortcode()

/**
 * Filters the media library used for the video shortcode.
 *
 * @since 3.6.0
 *
 * @param string $library Media library used for the video shortcode.
 */
$library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
if ( 'mediaelement' === $library && did_action( 'init' ) ) {
    wp_enqueue_style( 'wp-mediaelement' );
    wp_enqueue_script( 'wp-mediaelement' );
}

The code above shows that the MediaElement.js JavaScript is added to the header, since that’s how things are handled by wp_enqueue_script() by default.