[wp-trac] [WordPress Trac] #37642: Switch from mediaelement to video.js

WordPress Trac noreply at wordpress.org
Fri Aug 12 15:56:31 UTC 2016


#37642: Switch from mediaelement to video.js
--------------------------------+------------------------------
 Reporter:  Ninos Ego           |       Owner:
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  External Libraries  |     Version:  3.9
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:
--------------------------------+------------------------------

Comment (by ocean90):

 Replying to [comment:2 Ninos Ego]:
 > ATM wp also uses an older mediaelement lib, so I cannot use the
 sourcechooser feature for changing sources e.g. from 1080p to 720p like
 youtube is doing it.

 [https://github.com/johndyer/mediaelement/blob/2.22.0/src/js/mep-feature-
 sourcechooser.js Source chooser] is a feature which isn't in the
 [https://github.com/johndyer/mediaelement/blob/2.22.0/Gruntfile.js#L51-L61
 default build]. If you want to use it you have to add it by yourself.
 Something like the following should work:
 {{{#!php
 <?php
 /**
  * Plugin name: mep-feature-sourcechooser
  */

 namespace Ticket37642;

 function register_script() {
         wp_register_script( 'mep-feature-sourcechooser', plugins_url(
 'mep-feature-sourcechooser.js', __FILE__ ), array( 'mediaelement' ),
 '2.22.0', false );
 }
 add_action( 'init', __NAMESPACE__ . '\register_script' );

 function mejs_settings( $settings ) {
         $settings['features'] = array( 'playpause', 'current', 'progress',
 'duration', 'tracks', 'volume', 'fullscreen', 'sourcechooser' );
         return $settings;
 }
 add_filter( 'mejs_settings', __NAMESPACE__ . '\mejs_settings' );

 function wp_video_shortcode( $html ) {
         wp_enqueue_script( 'mep-feature-sourcechooser' );
         return $html;
 }
 add_filter( 'wp_video_shortcode', __NAMESPACE__ . '\wp_video_shortcode' );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37642#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list