Search code examples
javascripthtmlsoundcloudvolume

SoundCloud Volume Control


So I'm working on a website, integrated the iframe of a soundcloud playlist and tried to adjust the volume. I looked at the general values of the iframe, saw that there was no value for volume. I proceeded to check how it could be done otherwise. Looked at several posts on stackoverflow, found a "solution" with the soundcloud-api. I did the javascripting, still didn't work. Looked more, found more. But every solution I found just didn't set the volume. The steps I performed: Get the SoundCloudAPI

<script src="http://w.soundcloud.com/player/api.js" type="text/javascript"></script>

I gave my iframe the id="SoundCloud". So:

function adjustVolume() {
var widget2 = SC.Widget("SoundCloud");
widget2.setVolume(0.1);
}

All the variations I tried:

-instead of using the .setVolume value range from 0 to 1, used 0 to 100

-getting the API inside the same js-file instead the html

-copying all other solutions I could find in the webz, with no success

I also tried to control the volume of the iframe by wrapping it in an audio-tag. Didn't work.


Solution

  • You can't use setVolume on the widget player, you need to be using the SoundCloud JavaScript SDK. Set up your track using the JS SDK instead of the widget.