Storm docs logo
Search the docs.../
Explore Storm Products

Events & Listeners Basics - Storm JS Player Core

Learn how to use event-listener system inbuilt into Storm JS Player Core for direct communication with your code.

Attaching an Event Listener

The concept of attaching events is the same as in standard JavaScript.

Code iconjavascript
const storm = stormPlayerCore(config);

storm.addEventListener("playerReady", onPlayerReady);
Note

The API for all JavaScript bundle formats (IIFE, UMD, AMD etc.) is the same. The example above uses IIFE format.

In this example, we have added a new event listener (called playerReady) to the player. Whenever the player is ready, an attached function will be called. The function can also be of an inline type.

Now we need to define our function.

Code iconjavascript
function onPlayerReady(event) {
    console.log(event.ref); // reference to the player object
};

We can also use inline functions.

Code iconjavascript
storm.addEventListener("playerReady", function(event){
      console.log(event.ref); // reference to the player object
});

Detaching an Event Listener

In order to detach (remove) an event listener just use:

Code iconjavascript
storm.removeEventListener("playerReady", onPlayerReady);

For obvious reasons, inline functions cannot be removed (unless stored as a variable), however, there is a way to remove all events of specific type:

Code iconjavascript
storm.removeEventListener("playerReady");

We can also remove all event listeners from our player element:

Code iconjavascript
storm.removeAllEventListeners();
Next Step

For the next step please check our Storm JS Player Core - Events where you'll learn about available events for player behaviour.

Blog
Support
About us
Patents
Term of use
Privacy policy
Contact
©2026 Storm Streaming Media. All Rights Reserved.