For the next step please check our Storm JavaScript Player Events where you’ll learn about available events for player behaviour.
Storm player utilizes a simple event-lister model for a direct communication. While actions can be executed using available methods (API), a feedback from player is also necessary.
Attaching an event lister is a straightforward task:
const player = stormPlayer(playerConfig, streamConfig);
player.addEventListener("interfaceReady", function(event){
console.log("onPlayerReady",event);
});
In this example, we have added a new event listener (called guiInitialized) to the player. Whenever the player GUI becomes ready, an attached function will be called. The function can also be of an inline type.
player.addEventListener("interfaceReady", onGUIInitialized);
In order to detach (remove) an event listener just use:
player.removeEventListener("interfaceReady", onGUIInitialized);
For obvious reasons, inline functions cannot be removed (unless stored as a variable), however, there is a way to remove all events from the player:
player.removeAllEventListeners();
Create a free ticket and our support team will provide you necessary assistance.