Audio player within accordion?

Is it possible to place the audio player or multiple instances of the audio player within an accordion?

I’ve tried some html code but that player within the accordion looks different than than the X-theme player and the multiple instances of it within the accordion play audio at the same time instead of automatically muting the previous player when play is selected for another. Are there any workarounds for those issues?


Hi @pinkzebra,

I would suggest you to add the Audio element into the Global Block and use that as a shortcode in your Accordion element content.
Here you can learn how to create a Global Blocks and use it as shortcode.

Hope that helps.

That’s awesome! Perfect solution. Thanks for pointing me in the right direction :slight_smile:

Hi @pinkzebra,

You’re welcome and it’s our pleasure to help you. If you have any other concerns regarding our theme features, feel free to reach us.

Thank you.

These accordions work great, except that I worry that all the additional accordion-hidden audio players might be slowing the loading of my page too much. I have between 100-150 players on the page. On a fresh browser that hasn’t cached the page yet there can be long delays when attempting to play random audio tracks, depending on which tracks the browser is loading at the time.

Here is the page with all the audio players:

I have all the audio players set to preload “metadata.” Should I set them to “none” for more efficient loading? Or is there a way to tell the browser to prioritize the loading of any track that the user selects? I feel like the browser is making me wait to hear my selected track while it loads 50% of the data for tracks I’m not currently waiting to listen to.

Any suggestions?

Hello @pinkzebra,

Preloading the audio will benefit your users from not waiting for the audio. As soon as the user hits the play button, the audio plays and that is because of the preload option. By the way, 70% of the page file size is from your audio. You can check out the breakdown here:

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.