Class AdCuePointComponent
- java.lang.Object
-
- com.brightcove.player.event.AbstractComponent
-
- com.brightcove.freewheel.cuepoint.AdCuePointComponent
-
- All Implemented Interfaces:
Component
@Emits(events={"adBreakCompleted","adBreakStarted","adCompleted","adError","adPaused","adProgress","adResumed","adStarted","play","setCuePoints","willInterruptContent","willResumeContent","freewheelLock","freewheelUnlock","showSeekControls","hideSeekControls"}) @ListensFor(events={"completed","cuePoint","didInterruptContent","didResumeContent","play","seekTo","activityStarted","fragmentStarted","activityRestarted","activityResumed","fragmentResumed","activityPaused","fragmentPaused","activityStopped","fragmentStopped"}) public class AdCuePointComponent extends AbstractComponent
Before Video playback, converts Slots in an IAdContext into relevant CuePoints, then during playback is responsible for handling FreeWheel ad Cuepoints emitted by the VideoController. Before Video playback (most likely during SET_SOURCE), the AdCueComponent creates a series of CuePoints based on the current populated AdContext.
It will create one CuePoint for all pre-roll ads (with CuePoint.Type of BEFORE), one CuePoint for all post-roll ads, and one for each mid-roll (POINT_IN_TIME) and overlay ad.
Due to the nature of the hooks in to the EventEmitter that the AdCuePointComponent creates, it should be instantiated as soon as possible after the FreeWheelController
- See Also:
FreeWheelController
,CuePoint
,IAdContext
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLEAR_PLAYED_SLOTS
Flag that when added to a COMPLETED event enables the clearing of the playedSlots, so ads will be shown again upon replay.static java.lang.String
CUSTOM_ID
static java.lang.String
LINEAR
static java.lang.String
NONLINEAR
static java.lang.String
SLOT
static java.lang.String
TYPE
-
Fields inherited from class com.brightcove.player.event.AbstractComponent
eventEmitter, listenerTokens
-
-
Constructor Summary
Constructors Constructor Description AdCuePointComponent(EventEmitter emitter)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCuePoints(tv.freewheel.ad.interfaces.IAdContext context)
Given an instance of IAdContext, parses the Ad slots contained in the context and generates CuePoints.void
disable()
Removes the listeners from the Component.void
enable()
java.util.List<tv.freewheel.ad.interfaces.ISlot>
getCurrentVideoAdSlots()
java.util.List<tv.freewheel.ad.interfaces.ISlot>
getPlayedSlots()
java.util.List<tv.freewheel.ad.interfaces.ISlot>
getPostRollSlots()
java.util.List<tv.freewheel.ad.interfaces.ISlot>
getPreRollSlots()
boolean
isLocked()
Determine if the controller is currently in 'isLocked' state.void
lock()
'Locks' the FreeWheelController; afterwards, certain events will be stopped and prevented from bubblingvoid
setLiveVideoChecker(LiveVideoChecker liveVideoChecker)
void
skipCurrentAd()
Skips the currently playing advertisement within the active Ad break (a.k.aISlot
) and plays the next advertisement in the break.void
skipCurrentAdBreak()
Skips the current advertisement break (a.k.aISlot
).void
skipCurrentAds()
Deprecated.This method will be removed in a future release.void
unlock()
Tell the control to 'unlock' the normal Video playback control flow by re-emitting the Intercepted Event-
Methods inherited from class com.brightcove.player.event.AbstractComponent
addListener, addOnceListener, getEventEmitter, removeListener, removeListeners
-
-
-
-
Field Detail
-
TYPE
public static final java.lang.String TYPE
- See Also:
- Constant Field Values
-
LINEAR
public static final java.lang.String LINEAR
- See Also:
- Constant Field Values
-
NONLINEAR
public static final java.lang.String NONLINEAR
- See Also:
- Constant Field Values
-
CLEAR_PLAYED_SLOTS
public static final java.lang.String CLEAR_PLAYED_SLOTS
Flag that when added to a COMPLETED event enables the clearing of the playedSlots, so ads will be shown again upon replay.- See Also:
- Constant Field Values
-
CUSTOM_ID
public static final java.lang.String CUSTOM_ID
- See Also:
- Constant Field Values
-
SLOT
public static final java.lang.String SLOT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AdCuePointComponent
public AdCuePointComponent(EventEmitter emitter)
-
-
Method Detail
-
setLiveVideoChecker
public void setLiveVideoChecker(@Nullable LiveVideoChecker liveVideoChecker)
-
enable
public void enable()
-
disable
public void disable()
Removes the listeners from the Component. Should be called before a new AdCuePointComponent is created
-
getPreRollSlots
public java.util.List<tv.freewheel.ad.interfaces.ISlot> getPreRollSlots()
- Returns:
- the pre-roll Ad Slots list.
-
getPostRollSlots
public java.util.List<tv.freewheel.ad.interfaces.ISlot> getPostRollSlots()
- Returns:
- the post-roll Ad Slots list.
-
getCurrentVideoAdSlots
public java.util.List<tv.freewheel.ad.interfaces.ISlot> getCurrentVideoAdSlots()
- Returns:
- the list of Ad Slots that are about to be played in the Ad break. As soon as the ad starts playing, it's removed from the list. Returns empty if there is only one slot.
-
getPlayedSlots
public java.util.List<tv.freewheel.ad.interfaces.ISlot> getPlayedSlots()
- Returns:
- the list of played Ad slots. As soon as the next Ad slot starts playing, it's added to the list.
-
skipCurrentAd
public void skipCurrentAd()
Skips the currently playing advertisement within the active Ad break (a.k.a
ISlot
) and plays the next advertisement in the break. If there are no pending advertisements with in current Ad break, then the normal playback will be resume automatically.This method must be called while an Ad break is progress. Calling the method at other times will have no effect.
- See Also:
skipCurrentAdBreak()
-
skipCurrentAdBreak
public void skipCurrentAdBreak()
Skips the current advertisement break (a.k.a
ISlot
). Subsequent advertisement breaks will play at scheduled cue points and can be skipped again by calling the skipCurrentAdBreak method again.This method must be called while an Ad break is progress. Calling the method at other times will have no effect.
Please note that an break may contain more than one advertisement. Calling this method at any point during the break will cause all advertisements in the current break to be skipped.
- See Also:
skipCurrentAd()
-
skipCurrentAds
public void skipCurrentAds()
Deprecated.This method will be removed in a future release. Please update your code at the earliest to useskipCurrentAdBreak()
method instead.Functions the same asskipCurrentAdBreak()
-
unlock
public void unlock()
Tell the control to 'unlock' the normal Video playback control flow by re-emitting the Intercepted Event
-
lock
public void lock()
'Locks' the FreeWheelController; afterwards, certain events will be stopped and prevented from bubbling
-
isLocked
public boolean isLocked()
Determine if the controller is currently in 'isLocked' state. If in isLocked state, certain events will be blocked from travelling down the event chain if seen by the controller.- Returns:
- TRUE iff the controller is currently in a locked state.
-
addCuePoints
public void addCuePoints(tv.freewheel.ad.interfaces.IAdContext context)
Given an instance of IAdContext, parses the Ad slots contained in the context and generates CuePoints. It will generate one Cuepoint for PreRoll Ads, one for PostRoll, and individual cue points for the midroll and overlay.- Parameters:
context
- A populated IAdContext (i.e. it contains ad information) from which to create CuePoints- See Also:
CuePoint
,IAdContext
-
-