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()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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)` |
    `List<AudioTrack>` | `getAudioTracks()` |
    `VideoTrackQuality` | `getCurrentVideoQuality()` |
    `List<SubtitleTrack>` | `getSideloadedSubtitleTracks()` |
    `SubtitleTrack` | `getSubtitleTrack​(int trackIndex)` |
    `List<SubtitleTrack>` | `getSubtitleTracks()` |
    `List<ThumbnailDataTrack>` | `getThumbnailDataTracks()` |
    `VideoTrack` | `getVideoTrack​(int trackIndex)` |
    `List<VideoTrack>` | `getVideoTracks()` |
    `int` | `hashCode()` |
    `void` | `setVideoTrackQuality​(VideoTrackQuality videoTrackQuality)` | Sets the current video track quality
    `void` | `updateEmbeddedThumbnailTracks​(Collection<ThumbnailDataTrack> newEmbeddedTracks)` | Replaces embedded (not sideloaded) thumbnail tracks with the provided ones.
    `VideoTrackQuality` | `videoTrackChanged​(com.google.android.exoplayer2.Format format)` | Callback that is triggered when the current video quality changes

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

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

- - ### Constructor Detail

    - #### PlayerModel

          public PlayerModel()

  - ### Method Detail

    - #### 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()

      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()

      Returns:
        An unmodifiable list of currently registered video tracks

    - #### getAudioTracks

          public List<AudioTrack> getAudioTracks()

      Returns:
        An unmodifiable list of currently registered audio tracks

    - #### getSubtitleTracks

          public List<SubtitleTrack> getSubtitleTracks()

      Returns:
        An unmodifiable list of currently registered subtitle tracks

    - #### getSideloadedSubtitleTracks

          @NonNull
          public List<SubtitleTrack> getSideloadedSubtitleTracks()

      Returns:
        An unmodifiable list of all sideloaded subtitle tracks

    - #### getSubtitleTrack

          @Nullable
          public SubtitleTrack getSubtitleTrack​(int trackIndex)

      Parameters:
        `trackIndex` - the track index
      Returns:
        The subtitle track that matches the given index or null

    - #### getAudioTrack

          @Nullable
          public AudioTrack getAudioTrack​(int trackIndex)

      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)

      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()

      Returns:
        The current video quality or null

    - #### videoTrackChanged

          @Nullable
          public VideoTrackQuality videoTrackChanged​(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

    - #### setVideoTrackQuality

          public void setVideoTrackQuality​(@Nullable
                                           VideoTrackQuality videoTrackQuality)

      Sets the current video track quality
      Parameters:
        `videoTrackQuality` - Video track quality or null

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals​(Object obj)

      Overrides:
        `equals` in class `Object`