Soundcloud HTML5 Player Volume Control

I tried to use the example provided on the Soundcloud blog page to lower the volume.

I just resized iframeboth src=to my playlist and set the volume to 10 so that I can notice the difference if that worked. So far I have not observed any changes, the volume is still 100%.

I tried this with and without posting the following in the header of my template. It does not matter.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

Here is the code that I configured from the Soundcloud example:

    <iframe id="sc-widget" width="350" height="332" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F1417174&auto_play=true&show_artwork=false&color=37415f"></iframe>

  <script src="http://w.soundcloud.com/player/api.js" type="text/javascript"></script>
  <script type="text/javascript">
  (function(){
    var widgetIframe = document.getElementById('sc-widget'),
        widget       = SC.Widget(widgetIframe);

    widget.bind(SC.Widget.Events.READY, function() {
      widget.bind(SC.Widget.Events.PLAY, function() {
        // get information about currently playing sound
        widget.getCurrentSound(function(currentSound) { 
          console.log('sound ' + currentSound.get('') + 'began to play');
        });
      });
      // get current level of volume
      widget.getVolume(function(volume) {
        console.log('current volume value is ' + volume);
      });
      // set new volume level
      widget.setVolume(10);
    });

  }());
  </script>

This code is available on the Joomla website.

Can someone help me understand what I am missing to adjust the volume?

Is this a jQuery conflict? If so, are there any thoughts on how to solve this?

+5
2

0 1, . , 10%, :

var widgetIframe = document.getElementById('sc-widget'),
widget       = SC.Widget(widgetIframe);

widget.setVolume(0.1);
+6

. SetVolume() api /, int 0 100.

, SoundCloud iframe -. . https://gist.github.com/propagated/78aaedfbc0c23add7691bb975b51a3ff

//load soundcloud js api if needed
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://w.soundcloud.com/player/api.js';
document.head.appendChild(script);

//get the id of the player iframe or inject it using chrome
var id = 'scplayer',
    widgetIframe = document.getElementById(id),
    fixWidget = SC.Widget(widgetIframe);
fixWidget.setVolume(50); //% between 1 and 100
0

All Articles