Package com.castlabs.android.player.models

# Class PlayerModel

java.lang.Object
com.castlabs.android.player.models.PlayerModel

public class PlayerModel extends Object
General player model that contains information about tracks.

Since:
  3.0.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PlayerModel()`
  Creates a new PlayerModel.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAudioTrack(AudioTrack audioTrack)`
  Adds the given audio track to the list of audio tracks
  `void`
  `addAudioTrack(AudioTrack audioTrack, int groupIndex, int trackIndex, int rendererIndex)`
  Adds the given audio track to the list of audio tracks
  `void`
  `addSubtitleTrack(SubtitleTrack subtitleTrack)`
  Adds a subtitle track to the list of subtitle tracks
  `void`
  `addSubtitleTrack(SubtitleTrack subtitleTrack, int groupIndex, int trackIndex, int rendererIndex)`
  Adds the given subtitle track to the list of subtitle tracks
  `void`
  `addThumbnailTrack(ThumbnailDataTrack thumbnailDataTrack)`
  Adds the given thumbnail track to the list of thumbnail tracks
  `void`
  `addVideoTrack(VideoTrack videoTrack)`
  Adds the given video track to the list of video tracks
  `boolean`
  `equals(Object obj)`
  `AudioTrack`
  `getAudioTrack(int trackIndex)`
  Gets the audio track at the given index.
  `List<AudioTrack>`
  `getAudioTracks()`
  Gets the list of audio tracks.
  `VideoTrackQuality`
  `getCurrentVideoQuality()`
  Gets the current video quality.
  `List<SubtitleTrack>`
  `getSideloadedSubtitleTracks()`
  Gets the list of sideloaded subtitle tracks.
  `SubtitleTrack`
  `getSubtitleTrack(int trackIndex)`
  Gets the subtitle track at the given index.
  `List<SubtitleTrack>`
  `getSubtitleTracks()`
  Gets the list of subtitle tracks.
  `List<ThumbnailDataTrack>`
  `getThumbnailDataTracks()`
  Gets the list of thumbnail data tracks.
  `VideoTrack`
  `getVideoTrack(int trackIndex)`
  Gets the video track at the given index.
  `List<VideoTrack>`
  `getVideoTracks()`
  Gets the list of video tracks.
  `int`
  `hashCode()`
  `VideoTrackQuality`
  `setVideoFormat(com.google.android.exoplayer2.Format format)`
  Callback that is triggered when the current video quality changes
  `void`
  `updateEmbeddedThumbnailTracks(Collection<ThumbnailDataTrack> newEmbeddedTracks)`
  Replaces embedded (not sideloaded) thumbnail tracks with the provided ones.

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

  `getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PlayerModel

    public PlayerModel()
    Creates a new PlayerModel.

- ## Method Details

  - ### addVideoTrack

    public void addVideoTrack(@NonNull VideoTrack videoTrack)
    Adds the given video track to the list of video tracks
    Parameters:
      `videoTrack` - the video track

  - ### addAudioTrack

    public void addAudioTrack(@NonNull AudioTrack audioTrack)
    Adds the given audio track to the list of audio tracks
    Parameters:
      `audioTrack` - the audio track

  - ### addAudioTrack

    public void addAudioTrack(@NonNull AudioTrack audioTrack, int groupIndex, int trackIndex, int rendererIndex)
    Adds the given audio track to the list of audio tracks
    Parameters:
      `audioTrack` - the audio track
      `groupIndex` - the original group index
      `trackIndex` - the original track index within the group
      `rendererIndex` - the renderer index

  - ### addSubtitleTrack

    public void addSubtitleTrack(@NonNull SubtitleTrack subtitleTrack)
    Adds a subtitle track to the list of subtitle tracks
    Parameters:
      `subtitleTrack` - the subtitle track

  - ### addSubtitleTrack

    public void addSubtitleTrack(@NonNull SubtitleTrack subtitleTrack, int groupIndex, int trackIndex, int rendererIndex)
    Adds the given subtitle track to the list of subtitle tracks
    Parameters:
      `subtitleTrack` - the subtitle track
      `groupIndex` - the original group index
      `trackIndex` - the original track index within the group
      `rendererIndex` - the renderer index

  - ### addThumbnailTrack

    public void addThumbnailTrack(@NonNull ThumbnailDataTrack thumbnailDataTrack)
    Adds the given thumbnail track to the list of thumbnail tracks
    Parameters:
      `thumbnailDataTrack` - the thumbnail track

  - ### getThumbnailDataTracks

    @NonNull public List<ThumbnailDataTrack> getThumbnailDataTracks()
    Gets the list of thumbnail data tracks.
    Returns:
      An unmodifiable list of currently registered thumbnail tracks

  - ### updateEmbeddedThumbnailTracks

    public void updateEmbeddedThumbnailTracks(Collection<ThumbnailDataTrack> newEmbeddedTracks)
    Replaces embedded (not sideloaded) thumbnail tracks with the provided ones.
    Parameters:
      `newEmbeddedTracks` - new tracks

  - ### getVideoTracks

    public List<VideoTrack> getVideoTracks()
    Gets the list of video tracks.
    Returns:
      An unmodifiable list of currently registered video tracks

  - ### getAudioTracks

    public List<AudioTrack> getAudioTracks()
    Gets the list of audio tracks.
    Returns:
      An unmodifiable list of currently registered audio tracks

  - ### getSubtitleTracks

    public List<SubtitleTrack> getSubtitleTracks()
    Gets the list of subtitle tracks.
    Returns:
      An unmodifiable list of currently registered subtitle tracks

  - ### getSideloadedSubtitleTracks

    @NonNull public List<SubtitleTrack> getSideloadedSubtitleTracks()
    Gets the list of sideloaded subtitle tracks.
    Returns:
      An unmodifiable list of all sideloaded subtitle tracks

  - ### getSubtitleTrack

    @Nullable public SubtitleTrack getSubtitleTrack(int trackIndex)
    Gets the subtitle track at the given index.
    Parameters:
      `trackIndex` - the track index
    Returns:
      The subtitle track that matches the given index or null

  - ### getAudioTrack

    @Nullable public AudioTrack getAudioTrack(int trackIndex)
    Gets the audio track at the given index.
    Parameters:
      `trackIndex` - the track index
    Returns:
      The audio track with the given index or null if the index is out of bounds

  - ### getVideoTrack

    @Nullable public VideoTrack getVideoTrack(int trackIndex)
    Gets the video track at the given index.
    Parameters:
      `trackIndex` - the track index
    Returns:
      The video track with the given index or null if the index is out of bounds

  - ### getCurrentVideoQuality

    @Nullable public VideoTrackQuality getCurrentVideoQuality()
    Gets the current video quality.
    Returns:
      The current video quality or null

  - ### setVideoFormat

    @Nullable public VideoTrackQuality setVideoFormat(@Nullable com.google.android.exoplayer2.Format format)
    Callback that is triggered when the current video quality changes
    Parameters:
      `format` - the new video quality format
    Returns:
      The selected video track quality or `null` of no quality matched the given format

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`