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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDescribes the current lifecycle state of an APSMediaEvent.Nested classes/interfaces inherited from interface android.os.Parcelable
android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanprotected booleanlongDefines the number of seconds before the scheduled start point when the event should receive the preload call.longSet by the player to the current playback time in seconds, after the current event begins preloading.longIf this parameter is greater than 0, then the event will be retriggered by the media player after the specific time interval (in seconds).longDefines the maximum number of seconds the event is allowed to live once it has been pretriggered, without setting the loaded property to true.Fields inherited from class APSMediaTrackableObject
trackingURLsModifier and TypeFieldDescriptionThis dictionary defines all URLs that need to be notified of specific events from the object's lifecycle.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidadjustRelativeToDuration(int duration) Translates percentual values set viasetStartPointto actual time intervals in seconds, relative to a specified total duration.booleanAtomically moves an unloaded event to preloading; only the caller that gets true may preload it.intintendPoint()The time interval (in seconds) when the player needs to remove the overlay.getState()Get the current event statevoidincrementStartAndEndPointsWithInterval(float duration) Shifts air-time for an overlay by a defined amount of time.booleanDetermines if an overlay has start points, end points or duration relative to the unit duration.abstract voidThis method will be invoked on a different thread by the player, before the event start point, as set by the preTriggerInterval field.abstract voidThis code will be executed once the event is triggered by the player.abstract voidonUnload()This method will be invoked by the player once the event has reached the end point and will be deallocated.abstract voidonUpdate()This method will be invoked by the player periodically, giving the event the opportunity to respond to updated playback information.voidpreload()voidpreloadFor(APSMediaPlayer poster) Preloads the event for the player that scheduled it; onPreload stops if that player has finished.voidregisterEventStateListener(APSMediaEventStateListener newListener) Register a new listener for event state changes.voidregisterTimeoutListener(APSMediaEventTimeoutListener newListener) Register a new listener for event timeout notifications.booleanReturns a claim whose preload never started to the unloaded state; false if the event is not preloading.booleanreleaseListeners(Object listener) Unregisters both listeners; true only for the one caller that removed the state listener.voidsetEndPoint(String endPoint) Sets the ending time point of the overlay.voidsetStartPoint(String startPoint) Sets the starting time point of the overlay.intThe time interval (in seconds) when the player needs to display the overlay.voidtrigger()voidunload()voidUnregister a previously registered event state listenervoidUnregister a previously registered event timeout listenervoidupdateState(APSMediaEvent.APSMediaEventState newState) Update the event statevoidwriteToParcel(android.os.Parcel dest, int flags)
-
Field Details
-
preloadInterval
public long preloadIntervalDefines the number of seconds before the scheduled start point when the event should receive the preload call. -
preloadPoint
public long preloadPointSet 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 repeatAfterIf 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 timeoutDefines 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
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
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
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 viasetStartPointto 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
Update the event state -
getState
Get the current event state -
registerEventStateListener
Register a new listener for event state changes.- Parameters:
newListener- - an object implementing the APSMediaEventStateListener interface.
-
unregisterEventStateListener
Unregister a previously registered event state listener- Parameters:
listener- - an object implementing APSMediaEventStateListener that has previously been use to subscribe to events
-
releaseListeners
Unregisters both listeners; true only for the one caller that removed the state listener. -
registerTimeoutListener
Register a new listener for event timeout notifications.- Parameters:
newListener- - an object implementing the APSMediaEventTimeoutListener interface.
-
unregisterEventTimeoutListener
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:
describeContentsin interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags) - Specified by:
writeToParcelin interfaceandroid.os.Parcelable
-