Okay
  Public Ticket #3453752
Is there any Javascript API to show playlist
Closed

Comments

  • Mehdi started the conversation

    Hi,

    I've found a Javascript API to load a playlist in the sticky player on this link:

    https://sonaar.io/docs/using-javascript-api/

    I need another JS API to show playlist tracks and when a user clicks on a track that track plays in the sticky player.

    I don't want to use PHP shortcodes on this link :

    https://sonaar.io/docs/add-audio-player-with-shortcode/

    because they need to reload the header and I don't want to reload my website header to view the shortcode.


    Is there any Javascript API to show the playlist tracks?

    Thanks

  •  647
    Alexandre replied

    Hi Mehdi, 

    I'm not sure if this is what you want but here is a js code to load a playlist in the sticky player and open the sticky tracklist:
    (You have to replace the id value by a playlist post id)

    IRON.sonaar.player.setPlayer({ id:"4494"});
    if(!IRON.sonaar.player.setshowList()){
        IRON.sonaar.player.setshowList();
    }

    Thanks,


    Alexandre from the Sonaar.io Crew

  • Mehdi replied

    Hi Alexandre,

    Thanks for your answer,

    I want to show the tracklist on the page like the image that I've attached.

    if there is not any js API to achieve this,

    1. Is there any REST API endpoint that loads the tracklist? (I've found sr_playlist endpoint but it doesn't load the tracklist)

    2. Is there any function to get the tracklist from it?

    Attached files:  playlist.JPG

  •  647
    Alexandre replied

    Hi Mehdi, 

    No sorry. We dont have any js code to provide to achieve what you want.

    Thanks,


    Alexandre from the Sonaar.io Crew