Class CuePoint

java.lang.Object
com.brightcove.player.model.MetadataObject
com.brightcove.player.model.CuePoint
All Implemented Interfaces:
Serializable, Comparable<CuePoint>

public class CuePoint extends MetadataObject implements Comparable<CuePoint>
Represents the data of a single cue point.
See Also:
  • Constructor Details

    • CuePoint

      @Deprecated public CuePoint(CuePoint.PositionType positionType, @NonNull String type, Map<String,Object> properties)
      Deprecated.
      Use the construtor that use a CuePointType rather than a string. This will guarantee that the CuePoint is of a known type and can be handled properly by the system. This method now throws IllegalArgumentException if the string value describing the cue point type does not specify a known cue point type. Currently supported values are "AD" or "CODE".
      Used to create a before (pre-roll) or after (post-roll) cue point.
      Parameters:
      positionType - Either PositionType.Before (pre-roll) or PositionType.After (post-roll).
      type - The type of the cue point. Valid values are: "AD" or "CODE".
      properties - The properties describing this cue point.
    • CuePoint

      public CuePoint(@NonNull CuePoint.PositionType positionType, @NonNull CuePoint.CuePointType type, Map<String,Object> properties)
      Used to create a pre-roll (PositionType.BEFORE) or post-roll (PositionType.AFTER) cue point.
      Parameters:
      positionType - Either CuePoint.PositionType.BEFORE (pre-roll) or CuePoint.PositionType.AFTER (post-roll).
      type - Either CuePoint.CuePointType.AD or CuePoint.CuePointType.CODE
      properties - The properties describing this cue point.
    • CuePoint

      @Deprecated public CuePoint(int position, @NonNull String type, Map<String,Object> properties)
      Deprecated.
      Use the construtor that takes a CuePointType rather than a string. This will guarantee that the CuePoint is of a known type and can be handled properly by the system. This method now throws IllegalArgumentException if the string value describing the cue point type does not specify a known cue point type. Currently supported values are "AD" and "CODE".
      Used to create a point in time (mid-roll) cue point at a specific position.
      Parameters:
      position - The offset from the beginning of the video, in milliseconds.
      type - The type of the cue point. Valid values are "AD" or "CODE".
      properties - The properties describing this cue point.
    • CuePoint

      @Deprecated public CuePoint(int position, @NonNull CuePoint.CuePointType type, Map<String,Object> properties)
      Deprecated.
      Used to create a mid-roll (PositionType.POINT_IN_TIME) cue point at a specific position.
      Parameters:
      position - The offset from the beginning of the video, in milliseconds.
      type - Either CuePointType.AD or CuePointType.CODE
      properties - The properties describing this cue point.
    • CuePoint

      public CuePoint(long position, @NonNull CuePoint.CuePointType type, Map<String,Object> properties)
      Used to create a mid-roll (PositionType.POINT_IN_TIME) cue point at a specific position.
      Parameters:
      position - The offset from the beginning of the video, in milliseconds.
      type - Either CuePointType.AD or CuePointType.CODE
      properties - The properties describing this cue point.
  • Method Details

    • getPositionType

      public CuePoint.PositionType getPositionType()
      Returns:
      The CuePoint.PositionType of this cue point.
    • getPosition

      @Deprecated public int getPosition()
      Deprecated.
      Returns the time offset of the cue point from the beginning of the video, in milliseconds.

      Note that this is only valid for PositionType.POINT_IN_TIME cue points.

      Returns:
      The position of the cue point as the number of milliseconds from the start of the video.
      Throws:
      IllegalStateException - if you call this method on any CuePoint instance whose position type is not PositionType.POINT_IN_TIME.
    • getPositionLong

      public long getPositionLong()
      Returns the time offset of the cue point from the beginning of the video, in milliseconds.

      Note that this is only valid for PositionType.POINT_IN_TIME cue points.

      Returns:
      The position of the cue point as the number of milliseconds from the start of the video.
      Throws:
      IllegalStateException - if you call this method on any CuePoint instance whose position type is not PositionType.POINT_IN_TIME.
    • getType

      @Deprecated public String getType()
      Deprecated.
      Use getPositionType()
      Returns:
      A string representation of the CuePointType of this cue point.
    • getCuePointType

      public CuePoint.CuePointType getCuePointType()
      Returns:
      The CuePointType of this cue point.
    • compareTo

      public int compareTo(CuePoint cuePoint)
      Compares this CuePoint object with the specified CuePoint object.

      For all CuePoints:
      CuePoint.PositionType.BEFORE < CuePoint.PositionType.POINT_IN_TIME < CuePoint.PositionType.AFTER

      When both cue points being compared are PositionType.POINT_IN_TIME, then this < cuePoint if this.position < cuePoint.position.

      Specified by:
      compareTo in interface Comparable<CuePoint>
      Parameters:
      cuePoint - The CuePoint to compare to this CuePoint.
      Returns:
      -1 if this CuePoint is earlier in the timeline than the specified CuePoint; 0 if the two CuePoints are at the same time; 1 if this CuePoint is later in the timeline than the specified CuePoint.
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class MetadataObject