Is there any way to change the sc-waveform container background from #efefef without having to load the waveform.js library? I have enough libraries loading already and the conainer bg conflicts with our site background color
-
Could you please tell what do you mean by "custom widget"? – Misha Reyzlin Feb 06 '13 at 10:18
-
http://developers.soundcloud.com/docs/api/html5-widget the JavaScript widget? We have one and it is extensively customized in the CSS and some function overrides. – frankie Feb 06 '13 at 12:26
-
As far as I know, you can not customise cross-domain iframe, so it'd be interesting to know how you are doing that. – Misha Reyzlin Feb 06 '13 at 13:23
-
the css is customized. I am just using the custom player with the widget js api - i don't know how to better explain it. i am trying to change the color around the waveform that's all. – frankie Feb 06 '13 at 14:03
-
If I understand you correctly and you are using SoundCloud Custom Player (https://github.com/soundcloud/soundcloud-custom-player/) you should be using this API file, and not HTML5 Widget – https://github.com/soundcloud/Widget-JS-API – Misha Reyzlin Feb 06 '13 at 14:18
2 Answers
I am experiencing the same issue and have had this problem before ( Overlay visible areas of transparent black silhouette PNG with pattern using CSS3 or JS ).
Here is an example with your waveform: http://jsfiddle.net/eLmmA/3/
$(function() {
var canvas = document.createElement('canvas');
canvas.width = 1800; // must match
canvas.height = 280; // must match
var canvas_context = canvas.getContext("2d");
var img = new Image();
img.onload = function(){
var msk = new Image();
msk.onload = function(){
canvas_context.drawImage(img, 0, 0);
canvas_context.globalCompositeOperation = "destination-in";
canvas_context.drawImage(msk, 0, 0);
canvas_context.globalCompositeOperation = "source-over";
};
msk.src = 'WAVEFORM_IMAGE.EXT';
}
img.src = 'OVERLAY_IMAGE.EXT';
document.body.appendChild(canvas);
});
I think I understand what you mean. You want to change the color of the waveform background, the gray stuff around the waveform:
The problem here is that waveforms you get from SoundCloud API are represented as partly transparent PNG images, where waveform itself is transparent and the chrome around it is gray (#efefef
) color.
So, unless the library you want to use for waveform customisation is using HTML5 canvas, you won't be able to use change the color of that chrome (so no, not possible with either HTML5 Widget API or Custom Player API). And you have to use waveform.js or the likes (or modify the waveform image on canvas yourself).
You could try to experiment with newest CSS filters (webkit only for now) and SVG filters, and possibly some MS IE filters for older IE versions, but I am not sure you'd manage to just change the color.

- 13,736
- 4
- 54
- 63
-
ok, thanks for the detailed response. i guess i'll have a go at waveform.js at that seems the most versatile solution atm. – frankie Feb 06 '13 at 14:46