Class APSMediaEvent

java.lang.Object
com.appscend.media.APSMediaTrackableObject
com.appscend.media.events.APSMediaEvent
All Implemented Interfaces:
android.os.Parcelable
Direct Known Subclasses:
APSMediaOverlay, APSMediaUnit, APSVastAdBreak

public abstract class APSMediaEvent extends APSMediaTrackableObject implements android.os.Parcelable
The APSMediaEvent class describes a container that developers can use to instruct the player to run specific blocks of code at specific moments of time. Objects extending and implementing this class can be added to the player�s main queue and can also be attached to a specific APSMediaUnit object, for runtime triggering.
  • Field Details

    • preloadInterval

      public long preloadInterval
      Defines the number of seconds before the scheduled start point when the event should receive the preload call.
    • preloadPoint

      public long preloadPoint
      Set by the player to the current playback time in seconds, after the current event begins preloading. Defaults to -1 if the event did not start preloading.
    • repeatAfter

      public long repeatAfter
      If this parameter is greater than 0, then the event will be retriggered by the media player after the specific time interval (in seconds).
    • timeout

      public long timeout
      Defines the maximum number of seconds the event is allowed to live once it has been pretriggered, without setting the loaded property to true.
    • loaded

      protected boolean loaded
    • dynamicPosition

      public boolean dynamicPosition
  • Constructor Details

    • APSMediaEvent

      public APSMediaEvent()
    • APSMediaEvent

      protected APSMediaEvent(android.os.Parcel in)
  • Method Details

    • onPreload

      public abstract void onPreload()
      This method will be invoked on a different thread by the player, before the event start point, as set by the preTriggerInterval field.
    • onTrigger

      public abstract void onTrigger()
      This code will be executed once the event is triggered by the player.
    • onUnload

      public abstract void onUnload()
      This method will be invoked by the player once the event has reached the end point and will be deallocated.
    • onUpdate

      public abstract void onUpdate()
      This method will be invoked by the player periodically, giving the event the opportunity to respond to updated playback information.
    • trigger

      public void trigger()
    • preload

      public void preload()
    • preloadFor

      public void preloadFor(APSMediaPlayer poster)
      Preloads the event for the player that scheduled it; onPreload stops if that player has finished.
    • claimPreload

      public boolean claimPreload()
      Atomically moves an unloaded event to preloading; only the caller that gets true may preload it.
    • releaseClaim

      public boolean releaseClaim()
      Returns a claim whose preload never started to the unloaded state; false if the event is not preloading.
    • unload

      public void unload()
    • setStartPoint

      public void setStartPoint(String startPoint)
      Sets the starting time point of the overlay.
      Parameters:
      startPoint - A string format describing the time point when the player needs to display the overlay. Possible values are seconds (e.g.: "60") or a percentage relative to the total duration of the parent clip (e.g.: "50%").
    • setEndPoint

      public void setEndPoint(String endPoint)
      Sets the ending time point of the overlay.
      Parameters:
      endPoint - A string format describing the time point when the player needs to remove the overlay. Possible values are seconds (e.g.: "60") or a percentage relative to the total duration of the parent clip (e.g.: "50%").
    • startPoint

      public int startPoint()
      The time interval (in seconds) when the player needs to display the overlay.
      Warning: If percentual values were set via setStartPoint, this value will change immediately after the current clip's duration is available.
      Returns:
      The initial time interval.
    • endPoint

      public int endPoint()
      The time interval (in seconds) when the player needs to remove the overlay.
      Warning: If percentual values were set via setStartPoint, this value will change immediately after the current clip's duration is available.
      Returns:
      The final time interval.
    • incrementStartAndEndPointsWithInterval

      public void incrementStartAndEndPointsWithInterval(float duration)
      Shifts air-time for an overlay by a defined amount of time.
      Parameters:
      duration - Shift duration in seconds.
    • adjustRelativeToDuration

      public void adjustRelativeToDuration(int duration)
      Translates percentual values set via setStartPoint to actual time intervals in seconds, relative to a specified total duration.
      Parameters:
      duration - The total duration.
    • adjustForAbsoluteDuration

      public void adjustForAbsoluteDuration()
    • needsToBeAdjustedRelativeToDuration

      public boolean needsToBeAdjustedRelativeToDuration()
      Determines if an overlay has start points, end points or duration relative to the unit duration.
    • updateState

      public void updateState(APSMediaEvent.APSMediaEventState newState)
      Update the event state
    • getState

      Get the current event state
    • registerEventStateListener

      public void registerEventStateListener(APSMediaEventStateListener newListener)
      Register a new listener for event state changes.
      Parameters:
      newListener - - an object implementing the APSMediaEventStateListener interface.
    • unregisterEventStateListener

      public void unregisterEventStateListener(APSMediaEventStateListener listener)
      Unregister a previously registered event state listener
      Parameters:
      listener - - an object implementing APSMediaEventStateListener that has previously been use to subscribe to events
    • releaseListeners

      public boolean releaseListeners(Object listener)
      Unregisters both listeners; true only for the one caller that removed the state listener.
    • registerTimeoutListener

      public void registerTimeoutListener(APSMediaEventTimeoutListener newListener)
      Register a new listener for event timeout notifications.
      Parameters:
      newListener - - an object implementing the APSMediaEventTimeoutListener interface.
    • unregisterEventTimeoutListener

      public void unregisterEventTimeoutListener(APSMediaEventTimeoutListener listener)
      Unregister a previously registered event timeout listener
      Parameters:
      listener - an object implementing APSMediaEventTimeoutListener * that has previously been use to subscribe to events
    • describeContents

      public int describeContents()
      Specified by:
      describeContents in interface android.os.Parcelable
    • writeToParcel

      public void writeToParcel(android.os.Parcel dest, int flags)
      Specified by:
      writeToParcel in interface android.os.Parcelable