The html 5 audio element appears to have a volume getter/setter on it, so you could do something like this in jQuery:
<script type="text/javascript" charset="utf-8">
$(function() {
var audio = $( #clip )[0];
$( #start ).click(function() {
audio.play();
});
$( #stop ).click(function() {
audio.pause();
});
$( #quiet ).click(function() {
audio.volume = audio.volume - 0.2
});
$( #loud ).click(function() {
audio.volume = audio.volume + 0.2
});
});
</script>
<audio id="clip">
<source src="/audio/safari.mp3" />
</audio>
<button id="start">start music</button
<button id="quiet">quieter</button>
<button id="loud">louder</button>
Source: http://www.whatwg.org/specs/web-apps/current-work/#user-interface
This seems to work in Safari 4, though I couldn t get it to play with FF 3.5.
(Note there s no bounds checking in the code above... you ll get a javascript error if you try to set the value below 0 or above 1.)
-John