Okay
  Public Ticket #2196574
Trigger sticky player from button
Closed

Comments

  • daniel benton-smith started the conversation

    Hi there - I notice you have a feature within elementor pro to trigger the sticky player with a button, which is great!

    I want to trigger the sticky player from a custom button that I coded, and need to know which class or attribute to use within the button, or can I add the tracklist shortcode within the button code?

    Thanks

  •  1,111
    Max replied

    You can start the player with javascript. An example of a JS call would be IRON.sonaar.player.setPlayer({ id:"1218"})

    Thanks,


    Max from the Sonaar.io Crew

  • daniel benton-smith replied

    Hi - could you possibly give me an example of how this JS call would be used inside a custom HTML button?

    Thanks

  •  1,111
    Max replied

    Never tried with a custom button but it would look like this:

    <a href="javascript:IRON.sonaar.player.setPlayer({ id:"1218"})>Text Here</a>


    Thanks,


    Max from the Sonaar.io Crew

  • daniel benton-smith replied

    ok thanks - and where exactly do I find the playlist ID?

    Thanks

  •  1,111
    Max replied

    When you edit your playlist. see screenshot: https://d.pr/i/fQnDRb

    Thanks,


    Max from the Sonaar.io Crew

  • daniel benton-smith replied

    Ok thanks for your help - unfortunately this does not work with my tracklist ID added: <a href="javascript:IRON.sonaar.player.setPlayer({ id:"1646"})>Text Here</a>


    Thanks

  • daniel benton-smith replied

    Please see this example - I have added the JS to the button and it worked once, but then did not work again thereafter (I didn't change anything). All I am trying to do is to call the sticky player from a custom button.

    Please see the "Listen To Demo" button.

    http://dev6.radioexpress.com/programming/joe-elliot-show/

    I appreciate all your help.

    Thanks

  •  1,111
    Max replied

    Its because the player and its scripts are not loaded in your page so it does not fire.

    You must have either the player on your page (then you might hide it via custom css), or to use the elementor button (because when you use the button, we do load the player script in the page)


    Thanks,


    Max from the Sonaar.io Crew

  • daniel benton-smith replied

    Ah okay that makes sense!


    Thanks for this!

  •  1,111
    Max replied

    you are welcome

    Thanks,


    Max from the Sonaar.io Crew

  • Samuel replied

    Hello,


    I wonder if it's possible to trigger the player from a generic button in a product table (31dbmusic.com/musique)

    Any help would be highly appreciated.


    Best regards.


    Sam.

  •  1,111
    Max replied

    Yes you can load the stickyplayer from any link by putting this as your link URL:

    javascript:IRON.sonaar.player.setPlayerAndPlay({ id:"3463"})

    id is the ID of your post that contains the tracklist. 


    You can also use the Elementor's button widget and select Launch Audio Player. See screenshot: https://d.pr/i/CQrOHu


    hope it helps,


    Thanks,


    Max from the Sonaar.io Crew

  • Samuel replied

    Yes I know how to do that, I'd like to automate the integration of the post ID, in the end I will have thousands of files to deal with...

    I'd like to ease the thing...


    Thx.

  •  1,111
    Max replied

    This depends more on your page listing (the page you list all your items) and feature capabilitie. you need to be able to generate dynamic shortcode or dynamic JS calls..

    I know that Essential Grid allows this, but I dont know about other plugins/themes im sorry.



    Thanks,


    Max from the Sonaar.io Crew

  • Samuel replied

    OK I'm going to take a look this way.


    thx