[wp-trac] [WordPress Trac] #40144: Media: Unable to selectively opt for MediaElement.js for just audio or video shortcodes

WordPress Trac noreply at wordpress.org
Mon Mar 13 17:29:55 UTC 2017


#40144: Media: Unable to selectively opt for MediaElement.js for just audio or
video shortcodes
--------------------------+-----------------------------
 Reporter:  westonruter   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Let's say someone adds a plugin that does the following:

 * `add_filter( 'wp_video_shortcode_library', function(){ return
 'some_other_library'; } );`
 * `add_filter( 'wp_audio_shortcode_library', function(){ return
 'some_other_library'; } );`

 If both of the filters are added, then `wp-mediaelement` won't be
 enqueued. However, if only one of the filters are added, then `wp-
 mediaelement` will still get enqueued. When `wp-mediaelement` is enqueued,
 it uses this selector to find the elements to initialize with
 MediaElement.js:

 `$( '.wp-audio-shortcode, .wp-video-shortcode' )`

 Naturally this means that even if I have filtered
 `wp_video_shortcode_library` to not be `mediaelement`, the JS will still
 try to set it up for MediaElement.js if I didn't also filter
 `wp_audio_shortcode_library` to not be `mediaelement`.

 The JS needs to be aware of what the `wp_video_shortcode_library` and
 `wp_audio_shortcode_library` filters so that it can know whether or not to
 include `.wp-audio-shortcode` and `.wp-video-shortcode` among the
 selectors.

 Originally raised in https://github.com/xwp/wp-core-media-
 widgets/pull/5#issuecomment-285198669

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40144>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list