Attaching and detaching events - 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);