Class AdCuePointComponent

  • All Implemented Interfaces:

    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 Detail


        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
    • 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<> getPreRollSlots()
        the pre-roll Ad Slots list.
      • getPostRollSlots

        public java.util.List<> getPostRollSlots()
        the post-roll Ad Slots list.
      • getCurrentVideoAdSlots

        public java.util.List<> getCurrentVideoAdSlots()
        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<> getPlayedSlots()
        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

        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:
      • skipCurrentAds

        public void skipCurrentAds()
        This method will be removed in a future release. Please update your code at the earliest to use skipCurrentAdBreak() method instead.
        Functions the same as skipCurrentAdBreak()
      • 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.
        TRUE iff the controller is currently in a locked state.
      • addCuePoints

        public void addCuePoints​( 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.
        context - A populated IAdContext (i.e. it contains ad information) from which to create CuePoints
        See Also:
        CuePoint, IAdContext