MP3 Audio Player
Documentation
Search for articles about the Audio Player and WordPress Theme

Using Javascript API

You can use some javascript code to call the STICKY Footer player and its functions. Here are a couple of javascript functions you can use.

Load the sticky player and Play a specific playlist:

IRON.sonaar.player.setPlayerAndPlay({ id:"1218", trackid:"0"});

id 1218 is the post ID of your playlist post type you want to play. To find out your post ID, see screenshot: https://d.pr/i/KH79f2
trackid 0 would be the first track of the playlist, 1 would be the second track, 2 would be the third track, etc.
Attributes parameters available: “id”, “trackid”, “shuffle”,”soundwave” and “notrackskip”.

Play the track that is set in the sticky player:

IRON.sonaar.player.play();

Pause the current track:

IRON.sonaar.player.pause();

Set the volume at 50%

sr_setVolume(0.5);

Start a specific playlist or widget player at a specific time:

sonaar_ts_shortcode({id:"", widget_id:"", trackid:", time:""});

id is the post ID of your playlist post type you want to play. To find out your post ID, see screenshot: https://d.pr/i/KH79f2
widget_id would target the player/widget ID set in your DOM.
trackid:”1″ would be the first track of the playlist, trackid:”2″ the second track, trackid:”3″ the third track.
time:”10:00″ would start the player at 10 minutes.


If you want to trigger click on the NON sticky player (aka free player), you can use this JS code:

jQuery(‘[data-albums=”75″]’).find(‘li:nth-child(2) .audio-track’).trigger( “click” );

Updated on February 23, 2022
Was this article helpful?
Still Stuck?
How can we help?