Package com.brightcove.player.event
Class BackgroundEventListener
java.lang.Object
com.brightcove.player.event.BackgroundEventListener
- All Implemented Interfaces:
EventListener
Implements an
EventListener
and calls processEvent
on a background thread. By default, EventListener calls processEvent on the main thread.
This class is useful for custom analytics implementation, or other types of event handlers
that need to do work on a background thread (typically to make network calls).
When extending this class, destroyBackgroundThread()
must be called when this class
is no longer needed. Otherwise, if this method is not called, the background thread will live on
until the app it is running in, is terminated.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
backgroundProcessEvent
(Event event) Process a given event to some purpose.void
Stops and destroys the background thread.final void
processEvent
(Event event) Process a given event to some purpose.
-
Constructor Details
-
BackgroundEventListener
public BackgroundEventListener()
-
-
Method Details
-
processEvent
Description copied from interface:EventListener
Process a given event to some purpose. The event can contain or provide payload data via properties.- Specified by:
processEvent
in interfaceEventListener
- Parameters:
event
- The given event.
-
backgroundProcessEvent
Process a given event to some purpose. The event can contain or provide payload data via properties. Called from a background thread.- Parameters:
event
- The event to process
-
destroyBackgroundThread
public void destroyBackgroundThread()Stops and destroys the background thread. This must be called once the EventListener is no longer required. Failure to do so will result in the background thread continuing to run until the app is terminated.
-