making mediaelement.js responsive
-
I am testing WordPress 3.6 Beta 3 and have been having difficulty making the media player responsive.
I have added the following filter which does work.
/** * filter audio shortcodes to add width="100%" * @link https://www.jasonbobich.com/wordpress/making-self-hosted-html5-video-and-audio-players-in-wordpress-3-6-responsive/ */ function ka_express_audio_shortcode( $html ){ return str_replace('<audio', '<audio width="100%"', $html); } add_filter('wp_audio_shortcode', 'ka_express_audio_shortcode');
However there appears to be a bug in mediaelement.js. The css is breaking in responsive mode and the volume slide bar displays outside and below the player. When you change the screen size the volume slider pops into position and out of position repeatedly, suggesting a calculated and returned width issue, within the plugin.
I’m a newbie when it comes to jQuery but this appears to be the fix…
In mediaelement-and-player.js :
Replace: b = this.controls.width() – a – (c.outerWidth(true) – c.width())
with: b = this.controls.width() – a – (c.outerWidth(true) – c.width())-1What this does is always forces .mejs-time-rail width to be 1 px less than calculated so the css is never broken.
Is there any chance of getting someone to look into this.
- The topic ‘making mediaelement.js responsive’ is closed to new replies.