Class APSMediaUnit
java.lang.Object
com.appscend.media.APSMediaTrackableObject
com.appscend.media.events.APSMediaEvent
com.appscend.media.events.APSMediaUnit
- All Implemented Interfaces:
android.os.Parcelable
The APSMediaUnit class represents a clip that's ready to be rendered by the player. A media unit also references an array of
APSMediaOverlay objects, defining the overlays connected to the unit.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSpecifies how the unit should handle seeking through multiple ad breaks.static enumSpecifies how the controls bar should be displayed for a media unit.Nested classes/interfaces inherited from class APSMediaEvent
APSMediaEvent.APSMediaEventStateModifier 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 TypeFieldDescriptionbooleanAn array of other media units to be played instead of the current one, should an error be encountered.booleanDefines whether the player can replay the current unit or not after it has ended in the playlist.Defines how the controls bar will be displayed for the unit.The configuration for the controls bar overlay.static final android.os.Parcelable.Creator<APSMediaUnit> booleanToggle to enable logs.intInitial video playback time in seconds.The associated registered unit manager of this unit (for example the Marlin Unit Manager for DRM encoding.A HashMap containing the metadata associated with the unit.intFor ad breaks assigned to this unit without an ad offset (breaks that should be auto-positioned within the content), this parameter defines the minimum time interval in seconds (relative to the end of the video) that should be ad-free.intFor ad breaks assigned to this unit without an ad offset (breaks that should be auto-positioned within the content), this parameter defines the minimum time interval in seconds to wait before displaying the first ad batch.intFor ad breaks assigned to this unit without an ad offset (breaks that should be auto-positioned within the content), this parameter defines the minimum time interval in seconds to wait between ad batches.booleanDefines if pinch-to-fullscreen should be allowed.booleanThe renderer associated with this unit.Defines how mid content ads should be handled when the user has skipped over several batches.booleanDefines if the unit should start playing as soon as it loads or wait for a play command.The URL of an SubRip subtitles file to be sideloadedThe video clip URL.Fields inherited from class APSMediaEvent
dynamicPosition, loaded, preloadInterval, preloadPoint, repeatAfter, timeoutModifier 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 TypeMethodDescriptionvoidaddEvent(APSMediaEvent event) voidaddOverlay(APSMediaOverlay overlay) Adds anAPSMediaOverlayobject to the unit, to be rendered together.voidRemoves all currently connected overlays.intevents()voidinitWithURL(String url) voidThis method will be invoked on a different thread by the player, before the event start point, as set by the preTriggerInterval field.voidThis code will be executed once the event is triggered by the player.voidonUnload()This method will be invoked by the player once the event has reached the end point and will be deallocated.voidonUpdate()This method will be invoked by the player periodically, giving the event the opportunity to respond to updated playback information.overlays()Returns an array containing allAPSMediaOverlayobjects currently connected to the unit.voidConnects an array of APSMediaEvent objects to the current unit (for example APSVastAdBreak objects)voidsetOverlays(ArrayList<Object> overlays) Connects an array ofAPSMediaOverlayobjects to the current unit.voidsetSkippedEvents(List<APSMediaEvent> events) Events a seek skipped in the unit this copy continues; a backward seek re-arms them.voidwriteToParcel(android.os.Parcel dest, int flags) Methods inherited from class APSMediaEvent
adjustForAbsoluteDuration, adjustRelativeToDuration, claimPreload, endPoint, getState, incrementStartAndEndPointsWithInterval, needsToBeAdjustedRelativeToDuration, preload, preloadFor, registerEventStateListener, registerTimeoutListener, releaseClaim, releaseListeners, setEndPoint, setStartPoint, startPoint, trigger, unload, unregisterEventStateListener, unregisterEventTimeoutListener, updateStateModifier 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.intendPoint()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.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 state
-
Field Details
-
url
The video clip URL. -
subtitlesUrl
The URL of an SubRip subtitles file to be sideloaded -
initialPlaybackTime
public int initialPlaybackTimeInitial video playback time in seconds. -
controlsDisplay
Defines how the controls bar will be displayed for the unit. SeeAPSMediaControlsDisplayfor possible values. -
controlsParameters
The configuration for the controls bar overlay. Construct this using the configurationFromDictionary: method ofAPSMediaPlayerControlsOverlayController. -
buffet
An array of other media units to be played instead of the current one, should an error be encountered. The unit at index 0 has the highest priority. -
metadata
-
pinchToFullscreen
public boolean pinchToFullscreenDefines if pinch-to-fullscreen should be allowed. -
debug
public boolean debugToggle to enable logs. -
shouldAutoplay
public boolean shouldAutoplayDefines if the unit should start playing as soon as it loads or wait for a play command. -
played
public boolean played -
canReplay
public boolean canReplayDefines whether the player can replay the current unit or not after it has ended in the playlist. -
manager
The associated registered unit manager of this unit (for example the Marlin Unit Manager for DRM encoding. -
seekHandling
Defines how mid content ads should be handled when the user has skipped over several batches. Use this parameter to instruct the player to render: only the first ad batch, only the last ad batch or all passed ad batches. Defaults to `APSHandleSeekEventPlayLastBreak`. -
midcontentAdMinimumInitialOffset
public int midcontentAdMinimumInitialOffsetFor ad breaks assigned to this unit without an ad offset (breaks that should be auto-positioned within the content), this parameter defines the minimum time interval in seconds to wait before displaying the first ad batch. Defaults to 300 seconds. -
midcontentAdMinimumFinalOffset
public int midcontentAdMinimumFinalOffsetFor ad breaks assigned to this unit without an ad offset (breaks that should be auto-positioned within the content), this parameter defines the minimum time interval in seconds (relative to the end of the video) that should be ad-free. Defaults to 300 seconds. -
midcontentAdMinimumSpacing
public int midcontentAdMinimumSpacingFor ad breaks assigned to this unit without an ad offset (breaks that should be auto-positioned within the content), this parameter defines the minimum time interval in seconds to wait between ad batches. Defaults to 300 seconds. -
renderer
The renderer associated with this unit. By default, the ExoPlayer renderer is used in 4.1+ and MediaPlayer for 4.0.x -
_positionedDynamicEvents
public boolean _positionedDynamicEvents -
sourceAdBreak
-
CREATOR
-
-
Constructor Details
-
APSMediaUnit
public APSMediaUnit() -
APSMediaUnit
protected APSMediaUnit(android.os.Parcel in)
-
-
Method Details
-
initWithURL
-
addOverlay
Adds anAPSMediaOverlayobject to the unit, to be rendered together.- Parameters:
overlay- TheAPSMediaPlayerobject to be connected to the unit.
-
addEvent
-
setOverlays
Connects an array ofAPSMediaOverlayobjects to the current unit.- Parameters:
overlays- An array ofAPSMediaOverlayobjects to be connected to the unit.
-
setEvents
-
clearOverlays
public void clearOverlays()Removes all currently connected overlays. -
overlays
Returns an array containing allAPSMediaOverlayobjects currently connected to the unit.- Returns:
- An array of
APSMediaOverlayobjects.
-
events
-
skippedEvents
Events a seek skipped in the unit this copy continues; a backward seek re-arms them. -
setSkippedEvents
-
dynamicEvents
-
copyWithZone
-
onPreload
public void onPreload()Description copied from class:APSMediaEventThis method will be invoked on a different thread by the player, before the event start point, as set by the preTriggerInterval field.- Specified by:
onPreloadin classAPSMediaEvent
-
onTrigger
public void onTrigger()Description copied from class:APSMediaEventThis code will be executed once the event is triggered by the player.- Specified by:
onTriggerin classAPSMediaEvent
-
onUnload
public void onUnload()Description copied from class:APSMediaEventThis method will be invoked by the player once the event has reached the end point and will be deallocated.- Specified by:
onUnloadin classAPSMediaEvent
-
onUpdate
public void onUpdate()Description copied from class:APSMediaEventThis method will be invoked by the player periodically, giving the event the opportunity to respond to updated playback information.- Specified by:
onUpdatein classAPSMediaEvent
-
describeContents
public int describeContents()- Specified by:
describeContentsin interfaceandroid.os.Parcelable- Overrides:
describeContentsin classAPSMediaEvent
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags) - Specified by:
writeToParcelin interfaceandroid.os.Parcelable- Overrides:
writeToParcelin classAPSMediaEvent
-