Attaching and detaching events - Storm Android Player

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

Attaching an event listener

Attaching an event listener is a straightforward task

                        
StormPlayerView stormPlayerView = findViewById(R.id.stormPlayerView);
stormPlayerView.setStormLibrary(stormLibrary);


stormPlayerView.addEventListener(new StormPlayerView.EventListener(){
    @Override
    public void onPlayClicked() {

    }
});

                    

We can listen to more than one event at a time.

                        
stormPlayerView.addEventListener(new StormPlayerView.EventListener(){
    @Override
    public void onPlayClicked() {

    }

    @Override
    public void onPauseClicked() {

    }

    @Override
    public void onEnterFullscreenClicked() {

    }

    @Override
    public void onExitFullscreenClicked() {

    }

    @Override
    public void onVideoClicked() {

    }
});
                    

A full list of library events can be found here.

Detaching an event listener

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

                        
stormPlayerView.removeEventListener(listenerObject);