How do I embed in a text widget?

I’m trying to embed a YouTube video in a Text Widget and WordPress 4.0 is stripping out the embed when rendering. For example, if I put this in the body of the widget:


then when I inspect the div in the browser I end up with this:

<div class="textwidget">Before


How can I get WordPress to keep the embed in the widget?

Solutions Collecting From Web of "How do I embed in a text widget?"

Shortcodes are not supported in the Text Widget by default. Add the following to your functions.php:

// Enable shortcodes in WP Text Widget
add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode', 11);

Instead of wrapping the video URL in the [embed] shortcode, use the following in the Text Widget:

[video src=""]

For more info on the [video] shortcode, see the Codex.

The suggested code from @Gabriel do not work for me but this one do.

add_filter( 'widget_text', array( $wp_embed, 'run_shortcode' ), 8 );
add_filter( 'widget_text', array( $wp_embed, 'autoembed'), 8 );