Class PlayerModel
java.lang.Object
com.castlabs.android.player.models.PlayerModel
General player model that contains information about tracks.
- Since:
- 3.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAudioTrack
(AudioTrack audioTrack) Adds the given audio track to the list of audio tracksvoid
addAudioTrack
(AudioTrack audioTrack, int groupIndex, int trackIndex, int rendererIndex) Adds the given audio track to the list of audio tracksvoid
addSubtitleTrack
(SubtitleTrack subtitleTrack) Adds a subtitle track to the list of subtitle tracksvoid
addSubtitleTrack
(SubtitleTrack subtitleTrack, int groupIndex, int trackIndex, int rendererIndex) Adds the given subtitle track to the list of subtitle tracksvoid
addThumbnailTrack
(ThumbnailDataTrack thumbnailDataTrack) Adds the given thumbnail track to the list of thumbnail tracksvoid
addVideoTrack
(VideoTrack videoTrack) Adds the given video track to the list of video tracksboolean
getAudioTrack
(int trackIndex) getSubtitleTrack
(int trackIndex) getVideoTrack
(int trackIndex) int
hashCode()
setVideoFormat
(com.google.android.exoplayer2.Format format) Callback that is triggered when the current video quality changesvoid
updateEmbeddedThumbnailTracks
(Collection<ThumbnailDataTrack> newEmbeddedTracks) Replaces embedded (not sideloaded) thumbnail tracks with the provided ones.
-
Constructor Details
-
PlayerModel
public PlayerModel()
-
-
Method Details
-
addVideoTrack
Adds the given video track to the list of video tracks- Parameters:
videoTrack
- the video track
-
addAudioTrack
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 trackgroupIndex
- the original group indextrackIndex
- the original track index within the grouprendererIndex
- the renderer index
-
addSubtitleTrack
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 trackgroupIndex
- the original group indextrackIndex
- the original track index within the grouprendererIndex
- the renderer index
-
addThumbnailTrack
Adds the given thumbnail track to the list of thumbnail tracks- Parameters:
thumbnailDataTrack
- the thumbnail track
-
getThumbnailDataTracks
- Returns:
- An unmodifiable list of currently registered thumbnail tracks
-
updateEmbeddedThumbnailTracks
Replaces embedded (not sideloaded) thumbnail tracks with the provided ones.- Parameters:
newEmbeddedTracks
- new tracks
-
getVideoTracks
- Returns:
- An unmodifiable list of currently registered video tracks
-
getAudioTracks
- Returns:
- An unmodifiable list of currently registered audio tracks
-
getSubtitleTracks
- Returns:
- An unmodifiable list of currently registered subtitle tracks
-
getSideloadedSubtitleTracks
- Returns:
- An unmodifiable list of all sideloaded subtitle tracks
-
getSubtitleTrack
- Parameters:
trackIndex
- the track index- Returns:
- The subtitle track that matches the given index or null
-
getAudioTrack
- Parameters:
trackIndex
- the track index- Returns:
- The audio track with the given index or null if the index is out of bounds
-
getVideoTrack
- Parameters:
trackIndex
- the track index- Returns:
- The video track with the given index or null if the index is out of bounds
-
getCurrentVideoQuality
- 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() -
equals
-