Package 

Class BackgroundEventListener

  • All Implemented Interfaces:
    com.brightcove.player.event.EventListener

    
    public abstract class BackgroundEventListener
     implements 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, destroyBackgroundThreadmust 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.

    • Method Summary

      Modifier and Type Method Description
      final void processEvent(Event event) Process a given event to some purpose.
      abstract void backgroundProcessEvent(Event event) Process a given event to some purpose.
      void destroyBackgroundThread() Stops and destroys the background thread.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BackgroundEventListener

        BackgroundEventListener()
    • Method Detail

      • processEvent

         final void processEvent(Event event)

        Process a given event to some purpose. The event can contain or provide payload datavia properties.

        Parameters:
        event - The given event.
      • backgroundProcessEvent

         abstract void backgroundProcessEvent(Event event)

        Process a given event to some purpose. The event can contain or provide payload data viaproperties. Called from a background thread.

        Parameters:
        event - The event to process
      • destroyBackgroundThread

         void destroyBackgroundThread()

        Stops and destroys the background thread. This must be called once the EventListener is nolonger required. Failure to do so will result in the background thread continuing torun until the app is terminated.