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) Gets the audio track at the given index.Gets the list of audio tracks.Gets the current video quality.Gets the list of sideloaded subtitle tracks.getSubtitleTrack
(int trackIndex) Gets the subtitle track at the given index.Gets the list of subtitle tracks.Gets the list of thumbnail data tracks.getVideoTrack
(int trackIndex) Gets the video track at the given index.Gets the list of video tracks.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()Creates a new 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
Gets the list of thumbnail data tracks.- 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
Gets the list of video tracks.- Returns:
- An unmodifiable list of currently registered video tracks
-
getAudioTracks
Gets the list of audio tracks.- Returns:
- An unmodifiable list of currently registered audio tracks
-
getSubtitleTracks
Gets the list of subtitle tracks.- Returns:
- An unmodifiable list of currently registered subtitle tracks
-
getSideloadedSubtitleTracks
Gets the list of sideloaded subtitle tracks.- Returns:
- An unmodifiable list of all sideloaded subtitle tracks
-
getSubtitleTrack
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
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
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
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() -
equals
-