Volume Controller

0

I have a script for the controller, and it stipples a value, and this value I wanted to put as volume. Is it possible to do this? Below I will show where I want the value to be:

<script type="text/javascript">
    new WHMSonic({
        path : "http://gerador.hostseries.com.br/HostSeriesPlayer.swf",
        source : "http://192.99.181.93:9960",
        volume : 50,
        autoplay : true,
        width: 372,
        height: 60,
        twitter : "http://twitter.com/HostSeries",
        facebook : "http://facebook.com/HostSeries",
        logo : "http://www.hostseries.com.br",
    });
    </script>

And here's my script:

NOTE: The value of it goes to <div id="valor"></div>

 <script type='text/javascript'>
window.onload=function(){
var slider = document.querySelector('.controlar .bola');
var limites = document.querySelector('.controlar').getBoundingClientRect();
var valor = document.getElementById('valor');
// arrastar slider
var ativo = false;
var offset = 0;

function toggleAtivo(e) {
    if (e.target != slider) return;
    ativo = (e.type == 'mousedown');
    var sliderPosition = slider.getBoundingClientRect().left;
    offset = sliderPosition - e.pageX;
}
window.addEventListener('mousedown', toggleAtivo);
window.addEventListener('mouseup', toggleAtivo);
window.addEventListener('mousemove', function (e) {
    if (!ativo) return;
    var position = e.pageX + offset;
    if (position < limites.left || position > limites.right) return;
    slider.style.left = position + 'px';
    valor.innerHTML = position * limites.width / 100;
});
}//]]>  

</script>
    
asked by anonymous 24.07.2015 / 09:28

0 answers