I am trying to connect the HTML iframe element to my database on the dynamic page. I have looked at earlier solutions in the discussions, but have run into a new problem that I cannot find the answer to.
![](https://static.wixstatic.com/media/a27d24_aa4f79f0068c4bab9445a7322a8f3e5f~mv2.png/v1/fill/w_49,h_25,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/a27d24_aa4f79f0068c4bab9445a7322a8f3e5f~mv2.png)
This is what I have so far. All of the text and buttons are connected to the Composers database. I have found some code that seems to work for the #html1 element:
$w.onReady(()=>{
$w("#dynamicDataset").onReady(()=> {
const itemUrl = $w('#dynamicDataset').getCurrentItem().recording
$w('#html1').src = itemUrl
});
});
but whenever I preview the issue, this is what I see:
![](https://static.wixstatic.com/media/a27d24_b5be4c0811ac4695a744364f2a10755a~mv2.png/v1/fill/w_49,h_25,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/a27d24_b5be4c0811ac4695a744364f2a10755a~mv2.png)
Right now, the soundcloud url is https:// soundcloud. com/ brendan jacklin/hbeart-niloufar-nourbakhsh, drawing from the recording field in the database (set to url) and I have no idea why it is showing that.
If it is not possible to work with urls, is there a way to do it directly from the embed code on the Soundcloud player?
It's not that your code is wrong, Sound Cloud simply does not allow embedding via URL. They want you to use their source code because they collect data for analytical purposes.
Unfortunately, you cannot change the iFrame code dynamically. You would have to physically embed each iFrame individually and/or embed the playlist individually.
Now they do have API documentation that you may or may not want to research to see if you can find a different way to reach your project goals.
Link: https://developers.soundcloud.com/docs/api/#playing
(Gorgeous music by the way. I am listening to it as I code ---- and it is so moving.)
Hey Brendan,
If the URL isn't working you should be able to use the embed code instead but you will have to use the postMessage() function as the src value will only allow URLs.
You should find the following article helpful, skip down to the messaging section.
Corvid: Working with the HTML Element
Hope this helps!
Dara | Corvid Team