Class Cue
- java.lang.Object
-
- com.google.android.exoplayer2.text.Cue
-
- All Implemented Interfaces:
Bundleable
public final class Cue extends Object implements Bundleable
Contains information about a specific cue, including textual content and formatting data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceCue.AnchorTypeThe type of anchor, which may be unset.static classCue.BuilderA builder forCueobjects.static interfaceCue.LineTypeThe type of line, which may be unset.static interfaceCue.TextSizeTypeThe type of default text size for this cue, which may be unset.static interfaceCue.VerticalTypeThe type of vertical layout for this cue, which may be unset (i.e.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Bundleable
Bundleable.Creator<T extends Bundleable>
-
-
Field Summary
Fields Modifier and Type Field Description static intANCHOR_TYPE_ENDAnchors the right (for horizontal positions) or bottom (for vertical positions) edge of the cue box.static intANCHOR_TYPE_MIDDLEAnchors the middle of the cue box.static intANCHOR_TYPE_STARTAnchors the left (for horizontal positions) or top (for vertical positions) edge of the cue box.BitmapbitmapThe cue image, or null if this is a text cue.floatbitmapHeightThe bitmap height as a fraction of the of the viewport size, orDIMEN_UNSETif the bitmap should be displayed at its natural height given the bitmap dimensions and the specifiedsize.static Bundleable.Creator<Cue>CREATORstatic floatDIMEN_UNSETAn unset position, width or size.static CueEMPTYThe empty cue.floatlineThe position of the cue box within the viewport in the direction orthogonal to the writing direction (determined byverticalType), orDIMEN_UNSET.static intLINE_TYPE_FRACTIONstatic intLINE_TYPE_NUMBER@com.google.android.exoplayer2.text.Cue.AnchorType intlineAnchor@com.google.android.exoplayer2.text.Cue.LineType intlineTypeThe type of thelinevalue.Layout.AlignmentmultiRowAlignmentThe alignment of multiple lines of text relative to the longest line, or null if the alignment is undefined.floatpositionThe fractional position of thepositionAnchorof the cue box within the viewport in the direction orthogonal toline, orDIMEN_UNSET.@com.google.android.exoplayer2.text.Cue.AnchorType intpositionAnchorThe cue box anchor positioned byposition.floatshearDegreesThe shear angle in degrees to be applied to this Cue, expressed in graphics coordinates.floatsizeThe size of the cue box in the writing direction specified as a fraction of the viewport size in that direction, orDIMEN_UNSET.CharSequencetextThe cue text, or null if this is an image cue.static intTEXT_SIZE_TYPE_ABSOLUTEText size is measured in number of pixels.static intTEXT_SIZE_TYPE_FRACTIONALText size is measured as a fraction of the viewport size minus the view padding.static intTEXT_SIZE_TYPE_FRACTIONAL_IGNORE_PADDINGText size is measured as a fraction of the viewport size, ignoring the view paddingLayout.AlignmenttextAlignmentThe alignment of the cue text within the cue box, or null if the alignment is undefined.floattextSizeThe default text size for this cue's text, orDIMEN_UNSETif this cue has no default text size.@com.google.android.exoplayer2.text.Cue.TextSizeType inttextSizeTypeThe default text size type for this cue's text, orTYPE_UNSETif this cue has no default text size.static intTYPE_UNSETAn unset anchor, line, text size or vertical type value.static intVERTICAL_TYPE_LRVertical left-to-right (e.g.static intVERTICAL_TYPE_RLVertical right-to-left (e.g.@com.google.android.exoplayer2.text.Cue.VerticalType intverticalTypeThe vertical formatting of this Cue, orTYPE_UNSETif the cue has no vertical setting (and so should be horizontal).intwindowColorThe fill color of the window.booleanwindowColorSetSpecifies whether or not thewindowColorproperty is set.
-
Constructor Summary
Constructors Constructor Description Cue(CharSequence text)Deprecated.UseCue.Builder.Cue(CharSequence text, Layout.Alignment textAlignment, float line, @com.google.android.exoplayer2.text.Cue.LineType int lineType, @com.google.android.exoplayer2.text.Cue.AnchorType int lineAnchor, float position, @com.google.android.exoplayer2.text.Cue.AnchorType int positionAnchor, float size)Deprecated.UseCue.Builder.Cue(CharSequence text, Layout.Alignment textAlignment, float line, @com.google.android.exoplayer2.text.Cue.LineType int lineType, @com.google.android.exoplayer2.text.Cue.AnchorType int lineAnchor, float position, @com.google.android.exoplayer2.text.Cue.AnchorType int positionAnchor, float size, @com.google.android.exoplayer2.text.Cue.TextSizeType int textSizeType, float textSize)Deprecated.UseCue.Builder.Cue(CharSequence text, Layout.Alignment textAlignment, float line, @com.google.android.exoplayer2.text.Cue.LineType int lineType, @com.google.android.exoplayer2.text.Cue.AnchorType int lineAnchor, float position, @com.google.android.exoplayer2.text.Cue.AnchorType int positionAnchor, float size, boolean windowColorSet, int windowColor)Deprecated.UseCue.Builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Cue.BuilderbuildUpon()Returns a newCue.Builderinitialized with the same values as this Cue.booleanequals(Object obj)inthashCode()BundletoBundle()Returns aBundlerepresenting the information stored in this object.
-
-
-
Field Detail
-
EMPTY
public static final Cue EMPTY
The empty cue.
-
DIMEN_UNSET
public static final float DIMEN_UNSET
An unset position, width or size.- See Also:
- Constant Field Values
-
TYPE_UNSET
public static final int TYPE_UNSET
An unset anchor, line, text size or vertical type value.- See Also:
- Constant Field Values
-
ANCHOR_TYPE_START
public static final int ANCHOR_TYPE_START
Anchors the left (for horizontal positions) or top (for vertical positions) edge of the cue box.- See Also:
- Constant Field Values
-
ANCHOR_TYPE_MIDDLE
public static final int ANCHOR_TYPE_MIDDLE
Anchors the middle of the cue box.- See Also:
- Constant Field Values
-
ANCHOR_TYPE_END
public static final int ANCHOR_TYPE_END
Anchors the right (for horizontal positions) or bottom (for vertical positions) edge of the cue box.- See Also:
- Constant Field Values
-
LINE_TYPE_FRACTION
public static final int LINE_TYPE_FRACTION
- See Also:
- Constant Field Values
-
LINE_TYPE_NUMBER
public static final int LINE_TYPE_NUMBER
- See Also:
- Constant Field Values
-
TEXT_SIZE_TYPE_FRACTIONAL
public static final int TEXT_SIZE_TYPE_FRACTIONAL
Text size is measured as a fraction of the viewport size minus the view padding.- See Also:
- Constant Field Values
-
TEXT_SIZE_TYPE_FRACTIONAL_IGNORE_PADDING
public static final int TEXT_SIZE_TYPE_FRACTIONAL_IGNORE_PADDING
Text size is measured as a fraction of the viewport size, ignoring the view padding- See Also:
- Constant Field Values
-
TEXT_SIZE_TYPE_ABSOLUTE
public static final int TEXT_SIZE_TYPE_ABSOLUTE
Text size is measured in number of pixels.- See Also:
- Constant Field Values
-
VERTICAL_TYPE_RL
public static final int VERTICAL_TYPE_RL
Vertical right-to-left (e.g. for Japanese).- See Also:
- Constant Field Values
-
VERTICAL_TYPE_LR
public static final int VERTICAL_TYPE_LR
Vertical left-to-right (e.g. for Mongolian).- See Also:
- Constant Field Values
-
text
@Nullable public final CharSequence text
The cue text, or null if this is an image cue. Note theCharSequencemay be decorated with styling spans.
-
textAlignment
@Nullable public final Layout.Alignment textAlignment
The alignment of the cue text within the cue box, or null if the alignment is undefined.
-
multiRowAlignment
@Nullable public final Layout.Alignment multiRowAlignment
The alignment of multiple lines of text relative to the longest line, or null if the alignment is undefined.
-
bitmap
@Nullable public final Bitmap bitmap
The cue image, or null if this is a text cue.
-
line
public final float line
The position of the cue box within the viewport in the direction orthogonal to the writing direction (determined byverticalType), orDIMEN_UNSET. When set, the interpretation of the value depends on the value oflineType.The measurement direction depends on
verticalType:- For
TYPE_UNSET(i.e. horizontal), this is the vertical position relative to the top of the viewport. - For
VERTICAL_TYPE_LRthis is the horizontal position relative to the left of the viewport. - For
VERTICAL_TYPE_RLthis is the horizontal position relative to the right of the viewport.
- For
-
lineType
@LineType public final @com.google.android.exoplayer2.text.Cue.LineType int lineType
The type of thelinevalue.LINE_TYPE_FRACTIONindicates thatlineis a fractional position within the viewport (measured to the part of the cue box determined bylineAnchor).LINE_TYPE_NUMBERindicates thatlineis a viewport line number. The viewport is divided into lines (each equal in size to the first line of the cue box). The cue box is positioned to align with the viewport lines as follows:lineAnchor) is ignored.- When
lineis greater than or equal to 0 the first line in the cue box is aligned with a viewport line, with 0 meaning the first line of the viewport. - When
lineis negative the last line in the cue box is aligned with a viewport line, with -1 meaning the last line of the viewport. - For horizontal text the start and end of the viewport are the top and bottom respectively.
-
lineAnchor
@AnchorType public final @com.google.android.exoplayer2.text.Cue.AnchorType int lineAnchor
The cue box anchor positioned bylinewhenlineTypeisLINE_TYPE_FRACTION.One of:
For the normal case of horizontal text,
ANCHOR_TYPE_START,ANCHOR_TYPE_MIDDLEandANCHOR_TYPE_ENDcorrespond to the top, middle and bottom of the cue box respectively.
-
position
public final float position
The fractional position of thepositionAnchorof the cue box within the viewport in the direction orthogonal toline, orDIMEN_UNSET.The measurement direction depends on
verticalType.- For
TYPE_UNSET(i.e. horizontal), this is the horizontal position relative to the left of the viewport. Note that positioning is relative to the left of the viewport even in the case of right-to-left text. - For
VERTICAL_TYPE_LRandVERTICAL_TYPE_RL(i.e. vertical), this is the vertical position relative to the top of the viewport.
- For
-
positionAnchor
@AnchorType public final @com.google.android.exoplayer2.text.Cue.AnchorType int positionAnchor
The cue box anchor positioned byposition. One ofANCHOR_TYPE_START,ANCHOR_TYPE_MIDDLE,ANCHOR_TYPE_ENDandTYPE_UNSET.For the normal case of horizontal text,
ANCHOR_TYPE_START,ANCHOR_TYPE_MIDDLEandANCHOR_TYPE_ENDcorrespond to the left, middle and right of the cue box respectively.
-
size
public final float size
The size of the cue box in the writing direction specified as a fraction of the viewport size in that direction, orDIMEN_UNSET.
-
bitmapHeight
public final float bitmapHeight
The bitmap height as a fraction of the of the viewport size, orDIMEN_UNSETif the bitmap should be displayed at its natural height given the bitmap dimensions and the specifiedsize.
-
windowColorSet
public final boolean windowColorSet
Specifies whether or not thewindowColorproperty is set.
-
windowColor
public final int windowColor
The fill color of the window.
-
textSizeType
@TextSizeType public final @com.google.android.exoplayer2.text.Cue.TextSizeType int textSizeType
The default text size type for this cue's text, orTYPE_UNSETif this cue has no default text size.
-
textSize
public final float textSize
The default text size for this cue's text, orDIMEN_UNSETif this cue has no default text size.
-
verticalType
@VerticalType public final @com.google.android.exoplayer2.text.Cue.VerticalType int verticalType
The vertical formatting of this Cue, orTYPE_UNSETif the cue has no vertical setting (and so should be horizontal).
-
shearDegrees
public final float shearDegrees
The shear angle in degrees to be applied to this Cue, expressed in graphics coordinates. This results in a skew transform for the block along the inline progression axis.
-
CREATOR
public static final Bundleable.Creator<Cue> CREATOR
-
-
Constructor Detail
-
Cue
@Deprecated public Cue(CharSequence text)
Deprecated.UseCue.Builder.Creates a text cue whosetextAlignmentis null, whose type parameters are set toTYPE_UNSETand whose dimension parameters are set toDIMEN_UNSET.- Parameters:
text- Seetext.
-
Cue
@Deprecated public Cue(CharSequence text, @Nullable Layout.Alignment textAlignment, float line, @LineType @com.google.android.exoplayer2.text.Cue.LineType int lineType, @AnchorType @com.google.android.exoplayer2.text.Cue.AnchorType int lineAnchor, float position, @AnchorType @com.google.android.exoplayer2.text.Cue.AnchorType int positionAnchor, float size)
Deprecated.UseCue.Builder.Creates a text cue.- Parameters:
text- Seetext.textAlignment- SeetextAlignment.line- Seeline.lineType- SeelineType.lineAnchor- SeelineAnchor.position- Seeposition.positionAnchor- SeepositionAnchor.size- Seesize.
-
Cue
@Deprecated public Cue(CharSequence text, @Nullable Layout.Alignment textAlignment, float line, @LineType @com.google.android.exoplayer2.text.Cue.LineType int lineType, @AnchorType @com.google.android.exoplayer2.text.Cue.AnchorType int lineAnchor, float position, @AnchorType @com.google.android.exoplayer2.text.Cue.AnchorType int positionAnchor, float size, @TextSizeType @com.google.android.exoplayer2.text.Cue.TextSizeType int textSizeType, float textSize)
Deprecated.UseCue.Builder.Creates a text cue.- Parameters:
text- Seetext.textAlignment- SeetextAlignment.line- Seeline.lineType- SeelineType.lineAnchor- SeelineAnchor.position- Seeposition.positionAnchor- SeepositionAnchor.size- Seesize.textSizeType- SeetextSizeType.textSize- SeetextSize.
-
Cue
@Deprecated public Cue(CharSequence text, @Nullable Layout.Alignment textAlignment, float line, @LineType @com.google.android.exoplayer2.text.Cue.LineType int lineType, @AnchorType @com.google.android.exoplayer2.text.Cue.AnchorType int lineAnchor, float position, @AnchorType @com.google.android.exoplayer2.text.Cue.AnchorType int positionAnchor, float size, boolean windowColorSet, int windowColor)
Deprecated.UseCue.Builder.Creates a text cue.- Parameters:
text- Seetext.textAlignment- SeetextAlignment.line- Seeline.lineType- SeelineType.lineAnchor- SeelineAnchor.position- Seeposition.positionAnchor- SeepositionAnchor.size- Seesize.windowColorSet- SeewindowColorSet.windowColor- SeewindowColor.
-
-
Method Detail
-
buildUpon
public Cue.Builder buildUpon()
Returns a newCue.Builderinitialized with the same values as this Cue.
-
toBundle
public Bundle toBundle()
Description copied from interface:BundleableReturns aBundlerepresenting the information stored in this object.- Specified by:
toBundlein interfaceBundleable
-
-