WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/31/2014 08:40:05 PM (6 years ago)
Author:
wonderboymusic
Message:

Support chromeless Vimeo via MEjs:

  • Bump MediaElement script loader versions to 2.16.2 - missed in [30634], oops!
  • Add Froogaloop to js/mediaelement scripts for Vimeo
  • Check for Vimeo in the same locations that YouTube is checked
  • Dynamically load Froogaloop script in admin when editing a TinyMCE view
  • Edit MediaElement to call mejs.$.extend instead of $.extend in mejs.HtmlMediaElementShim.createPlugin(), since $ is not available via WP's jQuery (I will report this upstream):

https://github.com/johndyer/mediaelement/blob/6f9a78e008de2de796a1797077a74a94763320f9/src/js/me-shim.js#L631

Fixes #29267.

File:
1 edited

Legend:

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

    r30685 r31016  
    5151    $video_types = wp_get_video_extensions();
    5252?>
    53 <#  var w_rule = h_rule = '',
     53<#  var w_rule = h_rule = '', classes = [],
    5454        w, h, settings = wp.media.view.settings,
    55         isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
     55        isYouTube = isVimeo = false;
     56
     57    if ( ! _.isEmpty( data.model.src ) ) {
     58        isYouTube = data.model.src.match(/youtube|youtu\.be/);
     59        isVimeo = -1 !== data.model.src.indexOf('vimeo');
     60    }
    5661
    5762    if ( settings.contentWidth && data.model.width >= settings.contentWidth ) {
     
    7378        h_rule = 'height: ' + h + 'px;';
    7479    }
     80
     81    if ( isYouTube ) {
     82        classes.push( 'youtube-video' );
     83    }
     84
     85    if ( isVimeo ) {
     86        classes.push( 'vimeo-video' );
     87    }
     88
    7589#>
    7690<div style="{{ w_rule }}{{ h_rule }}" class="wp-video">
    7791<video controls
    78     class="wp-video-shortcode{{ isYouTube ? ' youtube-video' : '' }}"
     92    class="wp-video-shortcode {{ classes.join( ' ' ) }}"
    7993    <# if ( w ) { #>width="{{ w }}"<# } #>
    8094    <# if ( h ) { #>height="{{ h }}"<# } #>
     
    101115        if ( isYouTube ) { #>
    102116        <source src="{{ data.model.src }}" type="video/youtube" />
     117        <# } else if ( isVimeo ) { #>
     118        <source src="{{ data.model.src }}" type="video/vimeo" />
    103119        <# } else { #>
    104120        <source src="{{ data.model.src }}" type="{{ settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
     
    10931109                <div class="wp-video-holder">
    10941110                <#
    1095                 var isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
    1096                     w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
     1111                var w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
    10971112                    h = ! data.model.height ? 360 : data.model.height;
    10981113
Note: See TracChangeset for help on using the changeset viewer.