I recently purchased and am using Udesly’s audio player for Webflow. So far, I’m really enjoying the product, but have run into an “issue.” My client (an audio production company) would love to, in the editor, change an audio player’s audio. While that’s not immediately possible, I think I might’ve thought of a work-around, but can’t seem to figure out exactly how it might work.
Udesly’s audio player is built inside a parent div with the custom attribute name: “udesly-audio-player” and value: “audio url.”
Here’s my question: Is there a way to access the code “behind the scenes” to change that div’s value based on a CMS field? I know that you can link to CMS fields in an embed, but don’t know how to access Webflow’s code.
If you can move that custom attribute inside of an embed then you can defs manage it with the CMS, but I’m not exactly sure how possible that is. Hopefully someone can chime in around that.
If its in an embed you can just add a CMS filed that pulls from the CMS to fill a specific line. For example this code I’ve used here, the CMS addfield fills the parts of the code that are unique from the CMS. In your case the CMS could fill the value audio URL part from the CMS.
From what it looks like in this screenshot from the post I linked, it’s possible to access Webflow via Javascript? I just don’t know how to access a div’s custom attribute’s.
I had the same problem and found the solution. Add a ID to the Udesly Audio Player Wrapper corresponding with the code below and put it before your “/body” tag.
<script>
var anchor = document.getElementById("audio-player-single-track-wrapper");
var att = document.createAttribute("udesly-audio-player");
att.value = "INSERT URL HERE";
anchor.setAttributeNode(att);
</script>