Populate SoundCloud player

Hi, I would like to populate 3 SoundCloud players on User profile pages(Dynamic), So i have a means for people to upload embed codes from SoundCloud and i have stored them in and array in the database against their id and profile. So i have 3 SoundCloud players on the page and want to iterate through the array and populate the 3 Players with ids, sc1 sc2 sc3. Im thinking of using a forEach method but dont know where in the Soundcloud Element i should target to place the embed codes. my first though was $w(“#sc1”).input? any help would be greatly appriciated.
Thanks in advance

Hi Josh,

Currently the soundcloud player does not have an API for setting the source of the playlist.
You can add a feature request here .

For now, if you actually have an HTML embed code (which also includes the view of soundcloud), you can consider using an HTML element to set it (or even $w()'s text to set HTML as rich text).

Hope this helps,
Liran.

Thanks that clears alot up for me, Going to give the HTML shot a go!

Hi Liran, Ive had a go at embedding the Soundcloud Iframe embed code via the HTML Iframe/Embed widget, the Soundcloud iframe pops up for less then a second and i disappears and returns this {“widgetId”:“widget_1509371995924”,“method”:“ready”,“value”:null}, it works for a split second which is confusing me and then shows the above Object… Really confused any help would be greatly appreciated !

$w.onReady(function () {
//TODO: write your page related code here…
let user = wixUsers.currentUser; // current user recognised
let userId = user.id; // "Grab Users Id "

let SClinks; 
 
//	console.log(userId); 
wixData.get("Members", userId) // grabs row of user from Database 
	.then((results) => { 
		userUrls = results; // assign row from database to variable 
		SClinks = JSON.parse(userUrls.links);		 
		SClinks.forEach((link) => { 
			console.log(link); 
			$w("#SoundCloud").postMessage(link); 
		}); 

	}); 

});

The Code above is what i have in my console, the problem is once it gets to the $w(“#SoundCloud”).postMessage(link);
Part, its doesn’t push the Iframe code their but if i console.log(link) i get the iframes that i’m wanting pushed to the HTML element.
Hopefully someone can dissesct whats going wrong ?

Hi Again Josh,
Can you please share a link to your site?
I’ll try to take a look.

Liran.

Hi Sorry its taken so long to reply Liran i didn’t see that you had replied :confused: Still Having problems its seems that the HTML Component isnt receiving the PostMessage as its not firing any functions on the Object being received!
Here is a link to the Page with the problem.
https://www.concorde.global/Members/f3688ec6-2b78-4aae-8053-29f1f9100f37