Volume controller

Asked

Viewed 79 times

0

I have a script for the controller, and it sets 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: Its value goes to the <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>
  • I don’t understand, what’s wrong with inserting the volume? http://websiteshotel.com.br/whmsonic/

  • The value does not go to volume, I wanted to know how it goes.

  • I don’t know this WHMSonic. Can you do a jsFiddle with an example? What I think is possible is to do var player = new WHMSonic({ and then use a method of this plugin to change the volume. Type player.setVolume(position * limites.width / 100);... I’m not saying the method has that name, but I imagine it’s something out there.

  • I think this way you said it works. I could put as an answer?

  • You are saying that sound is not defined by the player variable?

  • You have checked these links: http://www.whmsonic.com/v2/tutorials/ and http://help.sonicpanel.com/

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.