Make WordPress Core

Ticket #42643: 42643.3.patch

File 42643.3.patch, 1.3 KB (added by Clorith, 8 years ago)
  • src/wp-includes/js/mediaelement/wp-mediaelement.js

     
    4444                                }
    4545                        };
    4646
     47                        /**
     48                         * Custom error handler.
     49                         *
     50                         * Sets up a custom error handler in case a video render fails, and provides a download
     51                         * link as the fallback.
     52                         *
     53                         * @since 4.9.2
     54                         *
     55                         * @param {object} media The wrapper that mimics all the native events/properties/methods for all renderers.
     56                         * @param {object} node  The original HTML video, audio or iframe tag where the media was loaded originally.
     57                         *
     58                         * @returns {string}
     59                         */
     60                        settings.customError = function ( media, node ) {
     61                                // Make sure we only fall back to a download link for flash files.
     62                                if ( -1 !== media.rendererName.indexOf( 'flash' ) || -1 !== media.rendererName.indexOf( 'flv' ) ) {
     63                                        return '<a href="' + node.src + '">Download ' + node.src.substring( node.src.lastIndexOf( '/' ) + 1 ) + '</a>';
     64                                }
     65                        };
     66
    4767                        // Only initialize new media elements.
    4868                        $( '.wp-audio-shortcode, .wp-video-shortcode' )
    4969                                .not( '.mejs-container' )