I can think of two possible options – although I am not been able to test either right now.
Option 1
In theory the cleaner one, as you detect if the mediaelementplayer plugin has loaded itself in the jQuery namespace:
<!--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>
Option 2
If Option 1 doesn’t work, then this should; it tests the current jQuery object to see if it responds to the mediaelementplayer call:
<!--Change WordPress Audio Player Default Volume-->
<script type="text/javascript">
jQuery(document).ready(function ($) {
var audio_widgets = $("audio");
if(audio_widgets.mediaelementplayer) {
audio_widgets.mediaelementplayer({
success: function (mediaElement, domObject) {
mediaElement.setVolume(1.0);
}
});
}
});
</script>
Hops this helps!