I'd like to set the default audio volume on the wordpress mediaelement.js player to be at 100% volume. It appears that the default is somewhere around 80%.
Can anyone tell me which bit of code I need to change in order to do this?
It'd be great if future versions of Wordpress come with a basic 'Settings' function for the now native player so we can alter thing like default volume and colours.
Got interested too with that question. So you have to go to your folder like:
/wordpress/wp-includes/js/mediaelement/
File name:
mediaelement-and-player.min.js
Ctrl+F
and search for - startVolume
It found me 2 similar results startVolume:0.8;
One probably for video and second for audio. So change it from 0.8
to 1
. Then ctrl+F5 on your page and we're done! :)
Was trying to figure this out and didn't want to edit core files. Inside your theme's footer.php
file add:
<!--Change Wordpress Audio Player Default Volume-->
<script type="text/javascript">
jQuery(document).ready(function ($) {
if($.fn.mediaelementplayer) {
$("audio").mediaelementplayer({
success: function (mediaElement, domObject) {
mediaElement.setVolume(1.0);
}
});
}
});
</script>
Just change the 1.0
to whatever you want between 0.1-1.0
来源:https://stackoverflow.com/questions/18542960/how-do-i-edit-the-default-volume