WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/26/2017 11:09:42 PM (2 years ago)
Author:
westonruter
Message:

Widgets: Normalize YouTube and Vimeo URLs in video shortcode (primarily for Video widget) to work around ME.js 2.22 bug.

Props timmydcrawford, jnylen0, westonruter.
See #32417, #39994.
Fixes #40866.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r40813 r40847  
    25472547    }
    25482548
     2549    // Mediaelement has issues with some URL formats for Vimeo and YouTube, so
     2550    // update the URL to prevent the ME.js player from breaking.
     2551    if ( 'mediaelement' === $library ) {
     2552        if ( $is_youtube ) {
     2553            // Remove `feature` query arg and force SSL - see #40866.
     2554            $atts['src'] = remove_query_arg( 'feature', $atts['src'] );
     2555            $atts['src'] = set_url_scheme( $atts['src'], 'https' );
     2556        } elseif ( $is_vimeo ) {
     2557            // Remove all query arguments and force SSL - see #40866.
     2558            $parsed_vimeo_url = wp_parse_url( $atts['src'] );
     2559            $atts['src'] = 'https://' . $parsed_vimeo_url['host'] . $parsed_vimeo_url['path'];
     2560        }
     2561    }
     2562
    25492563    /**
    25502564     * Filters the class attribute for the video shortcode output container.
Note: See TracChangeset for help on using the changeset viewer.