No buttons on WordPress Media Player
One of the big changes that came with WordPress 3.6 was the introduction of an embedded media player.
I have had occasion to embedd audio files in the past and I used a plugin for the purpose. However, if I can avoid plugins then all the better, so I ran some tests with the new version.
The first trial showed the player all right, but there were no buttons.
I tried clicking on the left-hand end of the graphic and the player worked. However I wanted a “Play” button.
I searched the Internet and once again discovered that I wasn’t the only one with this problem Apparently the breakdown is because of the use of the SVG mime-type, and not all sites support this.
The main solution given was to add the mime-type to the site’s .htaccess file –
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
This solves the problem, but not every site owner has access to the .htaccess file, and some may just be nervous about meddling in that area. I devised an alternative method.
The button graphic in question is stored in two formats – .SVG and .PNG so a simple tweak to the CSS file changing the file from .SVG to PNG will also work. However, finding the references is not easy, and anyway any modification will be overwritten by any upgrade to WordPress. The solution is to add the following to your theme’s “style.css” file –
.mejs-overlay-button {
background:url("/wp-includes/js/mediaelement/bigplay.png") no-repeat !important;
}
.mejs-controls .mejs-button button {
background:transparent url("/wp-includes/js/mediaelement/controls.png") no-repeat !important;
}
The “!important” directive will ensure that the code takes precedent over any WordPress CSS.
Either method will have the required result –
Thanks for the tip, R! It's working splendidly on my site.
or change the "wp-includes/js/mediaelementplayer.min.css" the "controls.svg" to "controls.png" 😉
That's actually not a good idea as those files get overwritten on each WordPress update.
Thanks for the clear explanation. Changing the .htaccess file didn't help, nor did creating a new .htaccess in the blog directory, but substituting the svg with png did the trick. (There might be some parent directory .htaccess file restricting subdirectory changes perhaps) Kinda resigned to redoing this every update.Now if I only could fix the width of the audio player to 640px I'd be set. Thanks for your help.
Thank you! Your CSS code works perfectly, whereas I could find no solution elsewhere. Thanks!
Thanks. Use "background-image" to maintain the "background-position" needed for the mute button. Htaccess does not work.
There's an easier way. Just add 'no-svg' as a class to the container for your media player. Then it'll use the .png instead by default.
==> Thanks very much for the invaluable tip! Had tried modifying .htaccess to no avail, et cetera, et cetera. Feels so good when one stops banging one’s head against the proverbial wall! . . . .
~ t s e B
e k i M ~
This worked to bring the play button back, but the pause/stop buttonis now the same image. Suggestions? Thanks.
Thank YOU !!!This worked!!
You saved my hair! Thanks!!!