Hi! Very new to this, but am learning (slowly). I really hope a pro can come to my rescue with a problem I just cannot resolve myself.
On my site, I have a basic HTML player. I don't want it 'preloaded' with any audio - I'd like to send some dynamic data to it each time one of my members logs in, so it plays a certain item that is unique to them.
I've found a useful forum post here: https://www.wix.com/corvid/forum/community-discussion/html-audio-player-with-dynamic-url-from-data-collection
... however, I just can't get it to work. I think the explanation is just a little too complex for someone at my level.
Here's what I've got on my site:
PAGE CODE:
$w.onReady(function () {
$w("#html2").postMessage($w("#dynamicDataset").getCurrentItem().audiotestfield);
});
HTML COMPONENT (#html2):
<audio id="audio" controls="controls">
<source id="audioSource" src=""></source>
Your browser does not support the audio format.
</audio>
<script type="text/javascript">
window.onmessage = (event) => {
if (event.data) {
let receivedData = event.data;
document.getElementById(‘audioSource’).src = receivedData
}
};
</script>
Does anyone know where I'm going wrong? And - at risk of making myself sound like a complete novice - could you please explain it in layman's terms, if you know a solution?
Thank you in advance!