How do I edit the Default Volume?

只愿长相守 提交于 2019-12-05 02:03:47

问题


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.


回答1:


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! :)




回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!