Package com.castlabs.android.player

# Class DefaultTrackTypeProvider

java.lang.Object
com.castlabs.android.player.TrackTypeProvider
com.castlabs.android.player.DefaultTrackTypeProvider

public class DefaultTrackTypeProvider extends TrackTypeProvider
Default implementation of `TrackTypeProvider` with the video tracks separated according to the following video resolutions: SD, HD or UHD.

Since:
  4.0.7

- ## Field Summary

  ### Fields inherited from class com.castlabs.android.player.TrackTypeProvider

  `TYPE_UNDEFINED`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultTrackTypeProvider()`
  Default pixel values are specified as: HD = 1280x720 FHD = 1920x1080 UHD = 3840x2160
  `DefaultTrackTypeProvider(Point hdMinPx, Point fhdMinPx, Point uhdMinPx)`
  Specify pixels for each resolution type: HD, FHD and UHD.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getGroupType(int type1, int type2)`
  Gets the track group type by provided track or track group types.
  `int`
  `getTrackType(com.google.android.exoplayer2.Format format)`
  Defines the type of the track with the provided format.
  `float`
  `getTrackTypeWeight(int type)`
  Defines the weight of the provided track.
  `boolean`
  `typesOverlap(int type1, int type2)`
  Returns `true` if the types overlap otherwise `false`.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DefaultTrackTypeProvider

    public DefaultTrackTypeProvider()
    Default pixel values are specified as: HD = 1280x720 FHD = 1920x1080 UHD = 3840x2160

  - ### DefaultTrackTypeProvider

    public DefaultTrackTypeProvider(@NonNull Point hdMinPx, @NonNull Point fhdMinPx, @NonNull Point uhdMinPx)
    Specify pixels for each resolution type: HD, FHD and UHD. Some values can be equal for instance if HD and FHD are both specified as 1920 then 720 rendition is considered FHD and will not be merged with adaptation having 1920 renditions.
    Parameters:
      `hdMinPx` - HD min pixels
      `fhdMinPx` - FHD min pixels
      `uhdMinPx` - UHD min pixels

- ## Method Details

  - ### getTrackType

    public int getTrackType(@NonNull com.google.android.exoplayer2.Format format)
    Description copied from class: `TrackTypeProvider`
    Defines the type of the track with the provided format. The type itself could be defined as one of the `int` bits set.
    Specified by:
      `getTrackType` in class `TrackTypeProvider`
    Parameters:
      `format` - The track format
    Returns:
      The track type or `TrackTypeProvider.TYPE_UNDEFINED`

  - ### getTrackTypeWeight

    public float getTrackTypeWeight(int type)
    Description copied from class: `TrackTypeProvider`
    Defines the weight of the provided track. The value should be normalized to 0f .. 1.0f
    Specified by:
      `getTrackTypeWeight` in class `TrackTypeProvider`
    Parameters:
      `type` - The track or track group type
    Returns:
      The normalized to 0f .. 1.0f weight

  - ### getGroupType

    public int getGroupType(int type1, int type2)
    Description copied from class: `TrackTypeProvider`
    Gets the track group type by provided track or track group types. In case the track types are defined as bit-sets then the implementation here would be just logical OR of the track group and track types.
    Specified by:
      `getGroupType` in class `TrackTypeProvider`
    Parameters:
      `type1` - The track or track group type one
      `type2` - The track or track group type two
    Returns:
      The track group type

  - ### typesOverlap

    public boolean typesOverlap(int type1, int type2)
    Description copied from class: `TrackTypeProvider`
    Returns `true` if the types overlap otherwise `false`. In case the track types are defined as bit-sets then the implementation here would be just logical AND of the track group and track types.
    Specified by:
      `typesOverlap` in class `TrackTypeProvider`
    Parameters:
      `type1` - The track or track group type one
      `type2` - The track or track group type two
    Returns:
      True if the types overlap otherwise false