Events & Listeners Basics - Storm Android Library

Storm Android Library utilizes the classic Java event-listener model for API communication.

Attaching an Event Listener

Attaching an event listener is a straightforward task.

                        
StormLibrary stormLibrary = new StormLibrary();

stormLibrary.addEventListener(new StormLibrary.EventListener() {
    @Override
    public void onVideoConnecting() {

    }
});
                    

We can listen to more than one event a time.

                        
stormLibrary.addEventListener(new StormLibrary.EventListener() {
    @Override
    public void onVideoConnecting() {

    }

    @Override
    public void onVideoMetaData(VideoMetaData videoMetaData) {

    }

    @Override
    public void onVideoConnectionError(Exception e) {

    }

    @Override
    public void onVideoNotFound() {

    }

    @Override
    public void onVideoProgress(VideoProgress videoProgress) {

    }
});
                    

A full list of events can be found in Library Events section and Video Events section.

Detaching an Event Listener

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

                        
stormLibrary.removeEventListener(listenerObject);
                    
Next Step

In the next step you'll learn more about available events in Library Events guide.

Support Needed?

Create a free ticket and our support team will provide you necessary assistance.