After you add the elements to the DOM, run Amplitude.bindNewElements() and all of those elements you have just added will be hooked up and AmplitudeJS will listen to the events on them. When you add these elements, AmplitudeJS isn’t bound to them. You then add some elements to the page to work with this song like song containers, play/pause buttons, etc.
All methods are called on the Amplitude object so in order to call any of these methods it would be Amplitude.) of course).
You can find a list of them here: Documentation – AmplitudeJS. There are a lot of public methods, pretty much for every feature of AmplitudeJS. In this tutorial, we will touch on how to use some of these public facing methods and dive in on a few common use cases for these methods. As you can see there can be a variety of scenarios where you will need to act directly with your player outside of the scope of a user clicking or touching an element. Maybe you want to shuffle a playlist automatically after another method, call tShufflePlaylist( playlistKey ). Maybe they want to autoplay after an advertisement? Call ay(). This allows the user even more control over their audio player.
Build better software and get user feedback directly in GitHub, GitLab, and more.īeginning with AmplitudeJS 3.0, we’ve really seen the need to open up most of AmplitudeJS’ functionality to be called directly.