Package com.castlabs.android.player

# Class PlayerController

java.lang.Object
com.castlabs.android.player.PlayerController

Direct Known Subclasses:
  `SingleControllerPlaylist`

public class PlayerController extends Object
This class allows you to control and manage the video player instance and receive feedback during playback.

Note that you usually do not need to create instances of the controller manually. Use the `PlayerView` implementation and its `PlayerView.getPlayerController()` method to get the controller instance for the current view.

You can add `PlayerListener` instances to this controller to get informed about state changes of the underlying player. All listener methods are called from within the main thread of your application.

Since:
  1.1.0

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `PlayerController.ExperimentalApi`
  Experimental features that are not yet stable.
  `static enum`
  `PlayerController.State`
  Represents states of the player backend.
  `static @interface`
  `PlayerController.TrackType`
  Types of tracks.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `AUDIO_RENDERER`
  Identifies the audio track
  `static final int`
  `DTS_RENDERER`
  Identifies the dts audio renderers
  `final PlayerController.ExperimentalApi`
  `EXPERIMENTAL`
  Contains experimental features that are not yet stable.
  `static final int`
  `METADATA_RENDERER`
  Identifies the metadata renderers for HLS ID3 metadata
  `static final int`
  `TEXT_RENDERER`
  Identifies the subtitle track
  `static final int`
  `UNKNOWN_RENDERER`
  Identifies an unknown track
  `static final int`
  `VIDEO_RENDERER`
  Identifies the video track

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PlayerController(Context context)`
  Create a new player controller using the given context

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAudioRendererListener(AudioRendererListener listener)`
  Add an audio renderer listener
  `void`
  `addCatchupListener(CatchupListener listener)`
  Add a Catchup listener
  `void`
  `addCustomDashEventListener(CustomDashEventListener listener)`
  Add a new event listener to receive custom DASH events
  `void`
  `addDrmEventListener(DrmEventListener listener)`
  Add a `DrmEventListener`.
  `void`
  `addEventMessagesListener(EventMessagesListener eventMessagesListener)`
  Add a new event message listener
  `void`
  `addEventStreamListener(EventStreamListener listener)`
  Add a new listener to receive cue-start and cue-end for stream events, corresponding to the event duration.
  `void`
  `addEventStreamListListener(EventStreamListListener listener)`
  Add a new listener to receive all the events corresponding to the event-streams as a list.
  `void`
  `addFormatChangeListener(FormatChangeListener listener)`
  Add a new Format change listener.
  `void`
  `addHttpListener(HttpListener listener)`
  Add a HTTP listener
  `void`
  `addLoadControlListener(LoadControlListener listener)`
  Add a `LoadControlListener`.
  `void`
  `addMetadataListener(MetadataListener listener)`
  Add a new event listener to receive updates on ID3 Meta-Data tags from HLS streams.
  `void`
  `addPeriodChangedListener(PeriodChangedListener listener)`
  Adds a listener to receive updates on `Timeline.Period` changes
  `void`
  `addPlayerControllerListener(PlayerControllerListener listener)`
  Add a new player controller listener
  `void`
  `addPlayerListener(PlayerListener listener)`
  Add a `PlayerListener`.
  `void`
  `addPlayerModelFilter(PlayerModelFilter filter)`
  Adds a `PlayerModelFilter`.
  `void`
  `addRequestModifier(RequestModifier modifier)`
  Add a request modifier.
  `void`
  `addRequestModifierListener(RequestModifier.Listener listener)`
  Add a `Request` Modifier listener
  `void`
  `addResponseModifier(ResponseModifier modifier)`
  Add a response modifier.
  `void`
  `addStreamingEventListener(StreamingEventListener listener)`
  Add a new event listener.
  `void`
  `addSubtitleTrack(String url, String mimeType, String language, String name)`
  Add a subtitles track to be side-loaded when content is opened.
  `void`
  `addThumbnailTrack(ThumbnailDataTrack thumbnailDataTrack)`
  Adds a thumbnail track.
  `void`
  `addTimelineChangedListener(TimelineChangedListener listener)`
  Adds a listener to receive updates on `Timeline` updates
  `void`
  `addTimelineListener(TimelineListener listener)`
  Deprecated.
  Use `addTimelineChangedListener(TimelineChangedListener)` or `addPeriodChangedListener(PeriodChangedListener)` instead.
  `void`
  `addTrackSelectionListener(TrackSelectionListener listener)`
  Add a new event listener to receive updates related to track selection.
  `void`
  `addVideoMetadataListener(VideoMetadataListener listener)`
  Add a video metadata listener
  `void`
  `addVideoRendererListener(VideoRendererListener listener)`
  Add a video renderer listener
  `com.google.android.exoplayer2.source.MediaSource`
  `createContentMediaSource(PlayerConfig playerConfig, boolean attachInitialPositionProvider, PlayerPlugin playerPlugin)`
  Creates a MediaSource for just one PlayerConfig.
  `void`
  `destroy()`
  Call this method when the activity that displays the video player is destroyed.
  `void`
  `disableAudioFocus()`
  Disables the audio focus for the stream regardless of the `PlayerConfig.audioAttributes`
  `void`
  `enableTrickplayMode(boolean enable)`
  Enables or disables trickplay playback.
  `AbrConfiguration`
  `getAbrConfiguration()`
  Returns the current ABR configuration
  `AdClientInterface`
  `getAdClientInterface()`
  Gets access to `AdClientInterface` APIs
  `AdInterface`
  `getAdInterface()`
  Gets access to `AdInterface` APIs
  `AnalyticsMetaData`
  `getAnalyticsMetaData()`
  Returns the analytics meta-data associated with the controller.
  `AnalyticsSession`
  `getAnalyticsSession()`
  Get the current analytics session if there is one.
  `com.google.android.exoplayer2.audio.AudioAttributes`
  `getAudioAttributes()`
  Returns the audio attributes for this player.
  `com.google.android.exoplayer2.AudioFocusCallback`
  `getAudioFocusCallback()`
  Gets the audio focus callback for this player.
  `AudioTrack`
  `getAudioTrack()`
  Returns the current audio track.
  `List<AudioTrack>`
  `getAudioTracks()`
  Returns a list of audio track assets found in the opened movie meta data.
  `long`
  `getBackBufferTime()`
  Returns the oldest position that still has buffered content, in microseconds.
  `BandwidthMeterWrapper`
  `getBandwidthMeterWrapper()`
  The bandwidth meter wrapper
  `long`
  `getBitrateEstimate()`
  Returns the estimated bandwidth in bits/sec.
  `BufferConfiguration`
  `getBufferConfiguration()`
  Returns the buffer configuration of this controller
  `int`
  `getBufferedPercentage()`
  Returns an estimate of the percentage in the current content window or ad up to which data is buffered, or 0 if no estimate is available.
  `long`
  `getBufferedPosition()`
  Returns an estimate of the position in the current content window or ad up to which data is buffered, in microseconds.
  `int`
  `getBufferSizeBytes()`
  Return the current buffer size in bytes
  `long`
  `getBufferSizeTime()`
  Return the current buffer size ahead of the playhead in media time microseconds
  `CmcdConfigurationFactory`
  `getCmcdConfigurationFactory()`
  Gets the `CmcdConfigurationFactory` that will be used to create `CmcdConfiguration` instances.
  `<T> T`
  `getComponent(Class<T> type)`
  Returns the player component of the given type if it exists.
  `View`
  `getComponentView(int viewId)`
  Returns a View previously set through `setComponentView(int, View)` and indexed with a view id.
  `Context`
  `getContext()`
  Returns the context associated with this controller.
  `static int`
  `getCurrentPeriodIndexInCurrentWindow(com.google.android.exoplayer2.ExoPlayer player)`
  Get the index of the current `Period` in the current `Window`.
  `DataSourceFactory`
  `getDataSourceFactory()`
  Provides access to the `DataSourceFactory`.
  `long`
  `getDuration()`
  Get the duration in microseconds of a region of media currently available for playback (including both live and static streams) or -1 if no duration is available for the current stream.
  `HlsClearKeyCache`
  `getHlsKeyCache()`
  Returns the current `HlsClearKeyCache` used for HLS Clearkey requests.
  `String`
  `getIdHashCode()`
  Returns a stable identifier for log messages based on this controller instance.
  `static KeyStore`
  `getKeyStore()`
  Returns the `KeyStore` that will be used to store offline IDs or null if no store is configured.
  `long`
  `getLicenseRemainingDurationSec()`
  Returns the remaining license duration for the current DRM session.
  `long`
  `getLicenseRemainingDurationSec(TrackRendererPlugin.Type trackType)`
  Returns the remaining license duration for the current DRM session.
  `LiveConfiguration`
  `getLiveConfiguration()`
  Returns the live configuration of this controller
  `int`
  `getLiveEdgeLatency()`
  For live streams, the number of milliseconds that the playback should lag behind the "live edge" (i.e.
  `long`
  `getLiveEdgeUs()`
  Returns the live edge time in microseconds, or `C.TIME_UNSET` if unknown or not applicable.
  `long`
  `getLiveEdgeUs(boolean applyOffset)`
  Returns the live edge time in microseconds, or `C.TIME_UNSET` if unknown or not applicable.
  `long`
  `getLiveStartTime()`
  Get the live start time in microseconds since the epoch or -1 if unknown or not applicable.
  `Handler`
  `getMainHandler()`
  Get the main handler of this controller.
  `int`
  `getMaxBufferSizeBytes()`
  Return the maximum buffer size in bytes
  `com.google.android.exoplayer2.mediacodec.MediaCodecSelector`
  `getMediaCodecSelector()`
  Returns the `MediaCodecSelector`.
  `DataSourceFactory`
  `getModifierDataSourceFactory(int requestType)`
  Provides access to the `DataSourceFactory` that will be for the specific request type.
  `NetworkConfiguration`
  `getNetworkConfiguration()`
  Returns the current network configuration of this controller.
  `String`
  `getOfflinePath()`
  Gets the local path to the currently played content if it is played offline, otherwise `null`
  `String`
  `getPath()`
  Returns the path set in this controller or null
  `com.google.android.exoplayer2.ExoPlayer`
  `getPlayer()`
  Access the player API instance.
  `PlayerConfig`
  `getPlayerConfig()`
  Returns the current player configuration.
  `PlayerListeners`
  `getPlayerListeners()`
  Returns the `PlayerListeners` that are used to notify about player events.
  `Looper`
  `getPlayerLooper()`
  Gets player's Looper
  `PlayerController.State`
  `getPlayerState()`
  Returns the current player state.
  `IPlayerView`
  `getPlayerView()`
  Returns the current `IPlayerView` that is associated with this controller.
  `long`
  `getPosition()`
  Get the position in microseconds which is the playback position within the region of media currently available for playback.
  `long`
  `getPositionInPeriod()`
  Get the position in microseconds which is the playback position within the period of media currently available for playback.
  `long`
  `getPreBufferTime()`
  Gets an estimate of the absolute position in microseconds up to which data is buffered.
  `List<RequestModifier>`
  `getRequestModifiers()`
  Access the list of currently registered request modifier plugins
  `List<ResponseModifier>`
  `getResponseModifiers()`
  Access the list of currently registered response modifier plugins
  `int`
  `getSecondaryDisplay()`
  The secondary display setting, which is a bitmap of `SdkConsts.SECONDARY_DISPLAY_NEVER`, `SdkConsts.SECONDARY_DISPLAY_ALLOW_UNPROTECTED_CONTENT`, `SdkConsts.SECONDARY_DISPLAY_ALLOW_SECURE_DISPLAY`, and `SdkConsts.SECONDARY_DISPLAY_ALLOW_ALWAYS`.
  `long`
  `getSeekRangeEndUs()`
  Get the end of the current seek range in microseconds or `C.TIME_UNSET`.
  `float`
  `getSpeed()`
  Returns the current playback speed.
  `SSLSocketFactory`
  `getSSLSocketFactory()`
  Provides access to previously set `SSLSocketFactory`
  `com.castlabs.subtitles.presentation.SubtitlesStyle`
  `getSubtitlesStyle()`
  Returns the current subtitles style settings.
  `SubtitleTrack`
  `getSubtitleTrack()`
  Returns the currently active subtitle track.
  `List<SubtitleTrack>`
  `getSubtitleTracks()`
  Returns a list of the currently registered subtitles.
  `List<ThumbnailDataTrack>`
  `getThumbnailTracks()`
  Returns a list of thumbnail track assets found in the opened DASH manifest.
  `Timeline`
  `getTimeline()`
  Returns the current `Timeline`.
  `TrickplayConfiguration`
  `getTrickplayConfiguration()`
  Returns the current `TrickplayConfiguration`
  `VideoFilterConfiguration`
  `getVideoFilterConfiguration()`
  Returns the current video filter configuration.
  `List<VideoTrackQuality>`
  `getVideoQualities()`
  Returns a list of video qualities for the currently active video track.
  `VideoTrackQuality`
  `getVideoQuality()`
  Returns the current displayed video quality.
  `int`
  `getVideoQualityMode()`
  Returns the current video quality mode.
  `Point`
  `getVideoSizeFilter()`
  Deprecated.
  Use `getVideoFilterConfiguration()`.
  `VideoTrack`
  `getVideoTrack()`
  Returns the current video track.
  `List<VideoTrack>`
  `getVideoTracks()`
  Returns a list of video tracks.
  `float`
  `getVolume()`
  Returns the current output volume (gain) of the audio track.
  `long`
  `getWindowPositionInFirstPeriod()`
  The position of the start of the current window relative to the start of the first period belonging to it, in microseconds.
  `boolean`
  `isBackgrounded()`
  Returns whether the player is currently backgrounded.
  `boolean`
  `isCatchingUp()`
  Checks if the current playback is in catch-up mode.
  `boolean`
  `isHdPlaybackEnabled()`
  Returns true if this controllers filter setting allows HD content playback.
  `boolean`
  `isLive()`
  Returns true if the live stream is currently played otherwise false
  `boolean`
  `isLoopingEnabled()`
  Returns true if looping is enables and the player will automatically restart the playback on finish.
  `boolean`
  `isPlaying()`
  Returns true if the player is currently playing
  `boolean`
  `isPlayWhenReady()`
  Returns true if the player will start playing as soon as it fills enough buffer.
  `boolean`
  `isSeeking()`
  Returns true if the player is currently seeking to a new position.
  `static boolean`
  `isSupportedAudioCodec(String codec)`
  Checks if the given audio codec is supported.
  `boolean`
  `isTrickplayMode()`
  Returns whether the player is currently in trickplay mode or not.
  `void`
  `movePlayerListeners(PlayerController playerController)`
  Migrates all the listeners from this PlayerController to the given one.
  `void`
  `open(Bundle bundle)`
  This method takes a `Bundle` and extracts the information to create a `PlayerConfig` from the bundle.
  `void`
  `open(PlayerConfig playerConfig)`
  Opens the given URL to the video.
  `void`
  `openState(Bundle bundle)`
  Opens the {link PlayerController} with the given `Bundle` which is the saved state obtained with `saveState(Bundle)`
  `void`
  `pause()`
  Stop player
  `void`
  `play()`
  Start player
  `void`
  `prepareAnalyticsSession(PlayerConfig playerConfig)`
  Use this method to prepare the analytics session according to the player configuration before `open(android.os.Bundle)` the player controller.
  `Map<String,String>`
  `queryKeyStatus()`
  Queries the Key Status for the currently loaded session.
  `Map<String,String>`
  `queryKeyStatus(TrackRendererPlugin.Type trackType)`
  Queries the Key Status for the currently active session.
  `void`
  `release()`
  Release the player instance and reset the underlying player model.
  `void`
  `release(boolean preservePlayerResources, boolean preservePlayerViewSurface)`
  Release the player instance and reset the underlying player model.
  `void`
  `releaseWithException(CastlabsPlayerException exception)`
  Releases the player resources and throws an exception to indicate that the player is in an error state.
  `void`
  `removeAudioRendererListener(AudioRendererListener listener)`
  Remove an audio renderer listener
  `void`
  `removeCatchupListener(CatchupListener listener)`
  Remove a Catchup listener
  `void`
  `removeCustomDashEventListener(CustomDashEventListener listener)`
  Remove the given listener.
  `void`
  `removeDrmEventListener(DrmEventListener listener)`
  Remove a registered `DrmEventListener`
  `void`
  `removeEventMessagesListener(EventMessagesListener eventMessagesListener)`
  Remove the given listener.
  `void`
  `removeEventStreamListener(EventStreamListener listener)`
  Remove the given listener.
  `void`
  `removeEventStreamListListener(EventStreamListListener listener)`
  Remove the given listener.
  `void`
  `removeFormatChangeListener(FormatChangeListener listener)`
  Remove the given listener.
  `void`
  `removeHttpListener(HttpListener listener)`
  Remove a HTTP listener
  `void`
  `removeLoadControlListener(LoadControlListener listener)`
  Remove a registered `LoadControlListener`
  `void`
  `removeMetadataListener(MetadataListener listener)`
  Remove the given listener.
  `void`
  `removePeriodChangedListener(PeriodChangedListener listener)`
  Remove the given listener.
  `void`
  `removePlayerControllerListener(PlayerControllerListener listener)`
  Remove the given listener.
  `void`
  `removePlayerListener(PlayerListener listener)`
  Remove a registered `PlayerListener`
  `void`
  `removePlayerModelFilter(PlayerModelFilter filter)`
  Removes a `PlayerModelFilter` previously added with `addPlayerModelFilter(PlayerModelFilter)`.
  `void`
  `removeRequestModifier(RequestModifier modifier)`
  Remove a request modifier.
  `void`
  `removeRequestModifierListener(RequestModifier.Listener listener)`
  Remove a Modifier listener
  `void`
  `removeResponseModifier(ResponseModifier modifier)`
  Remove a response modifier.
  `void`
  `removeStreamingEventListener(StreamingEventListener listener)`
  Remove the given listener.
  `void`
  `removeTimelineChangedListener(TimelineChangedListener listener)`
  Remove the given listener.
  `void`
  `removeTimelineListener(TimelineListener listener)`
  Remove the given listener.
  `void`
  `removeTrackSelectionListener(TrackSelectionListener listener)`
  Remove the given listener.
  `void`
  `removeVideoMetadataListener(VideoMetadataListener listener)`
  Remove video metadata listener
  `void`
  `removeVideoRendererListener(VideoRendererListener listener)`
  Remove a video renderer listener
  `void`
  `resetAudioFocus()`
  Resets the audio focus for the stream according to the `PlayerConfig.audioAttributes`
  `boolean`
  `saveState(Bundle targetBundle)`
  Saves the state of this controller to the given target bundle.
  `void`
  `scanComponentViews(ViewGroup container)`
  Scans the given ViewGroup for specific PlayerControllerPlugin Views.
  `void`
  `seekWith(long offsetUs)`
  Sets the player to the new position by applying the offset to the current position i.e.
  `void`
  `setAbrConfiguration(AbrConfiguration abrConfiguration)`
  Set the ABR configuration used by the player
  `void`
  `setAnalyticsMetaData(AnalyticsMetaData analyticsMetaData)`
  Set the analytics meta-data.
  `void`
  `setAnalyticsSession(AnalyticsSession analyticsSession)`
  Set an already existing AnalyticsSession.
  `void`
  `setAudioFocusCallback(com.google.android.exoplayer2.AudioFocusCallback audioFocusCallback)`
  Sets the `AudioFocusCallback`.
  `void`
  `setAudioTrack(AudioTrack track)`
  Sets the current audio track.
  `void`
  `setBackgrounded(boolean backgrounded)`
  This sends or restores the player from background playback.
  `void`
  `setBufferConfiguration(BufferConfiguration bufferConfiguration)`
  Set the buffer configuration for this controller.
  `void`
  `setChangeFramerateStrategy(@com.google.android.exoplayer2.C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy)`
  Sets a `C.VideoChangeFrameRateStrategy` that will be used by the player when provided with a video output `Surface`.
  `void`
  `setCmcdConfigurationFactory(CmcdConfigurationFactory cmcdConfigurationFactory)`
  Sets the `CmcdConfigurationFactory` that will be used to create `CmcdConfiguration` instances.
  `void`
  `setComponentView(int viewId, View view)`
  Set a specific component View.
  `void`
  `setConfigurationProvider(ConfigurationProvider configurationProvider)`
  Sets the configuration provider e.g.
  `void`
  `setDataSourceFactory(DataSourceFactory dataSourceFactory)`
  Set the `DataSourceFactory` that will be used to create connections.
  `void`
  `setDisableAnalytics(boolean disableAnalytics)`
  Sets whether analytics should be disabled for the user's session.
  `void`
  `setExternalSourceSelector(ExternalSourceSelector externalSourceSelector)`
  Set the `ExternalSourceSelector` that will be used during CDN fallback Set `null` to disable the CDN fallback
  `void`
  `setHdPlaybackEnabled(int filter)`
  Set the HD content filter criteria for this specific controller.
  `void`
  `setHlsKeyCache(HlsClearKeyCache hlsKeyCache)`
  Sets the `HlsClearKeyCache` used for HLS Clearkey requests.
  `void`
  `setInitialPositionProvider(InitialPositionProvider provider)`
  Sets the `InitialPositionProvider`.
  `void`
  `setInternalSourceSelectorFactory(com.google.android.exoplayer2.source.dash.manifest.InternalSourceSelector.Factory sourceSelectorFactory)`
  Set the `InternalSourceSelector.Factory` that will be used during CDN fallback Set `null` to use the default `PlayerSDK.DEFAULT_INTERNAL_SOURCE_SELECTOR_FACTORY`
  `void`
  `setLiveConfiguration(LiveConfiguration liveConfiguration)`
  Set the live configuration for this controller.
  `void`
  `setLoopingEnabled(boolean loopingEnabled)`
  Enable/Disable looping
  `void`
  `setMaxVideoSizeFilter(Point maxVideoSize)`
  Deprecated.
  use `setVideoFilterConfiguration(VideoFilterConfiguration, VideoFilterConfiguration)`
  `void`
  `setPeriodInfoProvider(PeriodInfoProvider periodInfoProvider)`
  Set the `PeriodInfoProvider` that will be used to get additional information for the played period.
  `void`
  `setPlayerView(IPlayerView playerView)`
  Sets the `IPlayerView` instance that is used to provide the surface and render the video.
  `void`
  `setPosition(long newPositionUs)`
  Seek the player to the new position in microseconds.
  `void`
  `setPosition(long newPositionUs, int seekMode)`
  Seek the player to the new position in microseconds using specified seek mode The corresponding event will be sent to analytics session (if any)
  `void`
  `setPositionInPeriod(long newPositionUs)`
  Seek the player to the new position in microseconds.
  `void`
  `setSecondaryDisplay(int secondaryDisplay)`
  The secondary display setting, which is a bitmap of `SdkConsts.SECONDARY_DISPLAY_NEVER`, `SdkConsts.SECONDARY_DISPLAY_ALLOW_UNPROTECTED_CONTENT`, `SdkConsts.SECONDARY_DISPLAY_ALLOW_SECURE_DISPLAY`, and `SdkConsts.SECONDARY_DISPLAY_ALLOW_ALWAYS`.
  `void`
  `setSourceSelector(SourceSelector sourceSelector)`
  Deprecated.
  Use `setExternalSourceSelector(ExternalSourceSelector)` } Set the `SourceSelector` that will be used during CDN fallback
  `void`
  `setSpeed(float speed)`
  Enable fast-forward or slow motion playback by specifying the playback speed.
  `void`
  `setSSLSocketFactory(SSLSocketFactory sslSocketFactory)`
  Set custom `SSLSocketFactory` to be used in DRM and content requests.
  `void`
  `setSubtitlesStyle(com.castlabs.subtitles.presentation.SubtitlesStyle subtitlesStyle)`
  Allows you to set the desired captioning style that will be used during subtitle rendering.
  `void`
  `setSubtitleTrack(SubtitleTrack track)`
  Enables the given subtitle track.
  `void`
  `setSurface(Surface surface)`
  Set the `Surface` that will be used to render video.
  `boolean`
  `setTrickplayConfiguration(TrickplayConfiguration trickplayConfiguration)`
  Sets which `TrickplayConfiguration` to use.
  `void`
  `setVideoFilterConfiguration(VideoFilterConfiguration videoFilter, VideoFilterConfiguration adsFilter)`
  Sets the video filter configuration for both content and ads.
  `void`
  `setVideoQuality(VideoTrackQuality videoQuality)`
  Set the desired video quality or pass null to enable adaptive bitrate switching (default).
  `void`
  `setVideoTrack(VideoTrack track)`
  Sets the current video track.
  `void`
  `setVideoTrack(VideoTrack track, VideoTrackQuality quality)`
  Sets the current video track and a manually selected quality.
  `void`
  `setVolume(float volume)`
  Sets the output volume (gain) of the audio track.
  `void`
  `unsetComponentView(int viewId)`
  Remove the View linked to the provided view id
  `void`
  `unsetComponentViews()`
  Removes all the Component Views
  `boolean`
  `waitForMessages()`
  Queues a message to an arbitrary target and blocks until its delivered.

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

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

- ## Field Details

  - ### UNKNOWN_RENDERER

    public static final int UNKNOWN_RENDERER
    Identifies an unknown track
    See Also:
      - Constant Field Values

  - ### VIDEO_RENDERER

    public static final int VIDEO_RENDERER
    Identifies the video track
    See Also:
      - Constant Field Values

  - ### AUDIO_RENDERER

    public static final int AUDIO_RENDERER
    Identifies the audio track
    See Also:
      - Constant Field Values

  - ### TEXT_RENDERER

    public static final int TEXT_RENDERER
    Identifies the subtitle track
    See Also:
      - Constant Field Values

  - ### METADATA_RENDERER

    public static final int METADATA_RENDERER
    Identifies the metadata renderers for HLS ID3 metadata
    See Also:
      - Constant Field Values

  - ### DTS_RENDERER

    public static final int DTS_RENDERER
    Identifies the dts audio renderers
    See Also:
      - Constant Field Values

  - ### EXPERIMENTAL

    public final PlayerController.ExperimentalApi EXPERIMENTAL
    Contains experimental features that are not yet stable.

- ## Constructor Details

  - ### PlayerController

    public PlayerController(@NonNull Context context)
    Create a new player controller using the given context
    Parameters:
      `context` - the context

- ## Method Details

  - ### getComponent

    @Nullable public <T> T getComponent(Class<T> type)
    Returns the player component of the given type if it exists.

    This method can be called from any thread.

    Type Parameters:
      `T` - The component
    Parameters:
      `type` - The target type
    Returns:
      The component or null

  - ### getCmcdConfigurationFactory

    public CmcdConfigurationFactory getCmcdConfigurationFactory()
    Gets the `CmcdConfigurationFactory` that will be used to create `CmcdConfiguration` instances.

    This method can be called from any thread.

    Returns:
      The `CmcdConfigurationFactory`.

  - ### setCmcdConfigurationFactory

    public void setCmcdConfigurationFactory(CmcdConfigurationFactory cmcdConfigurationFactory)
    Sets the `CmcdConfigurationFactory` that will be used to create `CmcdConfiguration` instances.

    This method can be called from any thread.

    Parameters:
      `cmcdConfigurationFactory` - The `CmcdConfigurationFactory`.

  - ### setChangeFramerateStrategy

    public void setChangeFramerateStrategy(@VideoChangeFrameRateStrategy @com.google.android.exoplayer2.C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy)
    Sets a `C.VideoChangeFrameRateStrategy` that will be used by the player when provided with a video output `Surface`.

    The strategy only applies if a `MediaCodec`-based video `Renderer` is enabled. Applications wishing to use `Surface.CHANGE_FRAME_RATE_ALWAYS` should set the mode to `C.VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF` to disable calls to `Surface.setFrameRate(float, int, int)` from the player, and should then call `Surface.setFrameRate(float, int, int)` directly from application code.

    This method can be called from any thread.

    Parameters:
      `videoChangeFrameRateStrategy` - `C.VideoChangeFrameRateStrategy`.

  - ### addPlayerListener

    public void addPlayerListener(@NonNull PlayerListener listener)
    Add a `PlayerListener`.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removePlayerListener

    public void removePlayerListener(@NonNull PlayerListener listener)
    Remove a registered `PlayerListener`

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addLoadControlListener

    public void addLoadControlListener(@NonNull LoadControlListener listener)
    Add a `LoadControlListener`.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removeLoadControlListener

    public void removeLoadControlListener(@NonNull LoadControlListener listener)
    Remove a registered `LoadControlListener`

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addDrmEventListener

    public void addDrmEventListener(@NonNull DrmEventListener listener)
    Add a `DrmEventListener`.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removeDrmEventListener

    public void removeDrmEventListener(@NonNull DrmEventListener listener)
    Remove a registered `DrmEventListener`

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addStreamingEventListener

    public void addStreamingEventListener(@NonNull StreamingEventListener listener)
    Add a new event listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listeners

  - ### removeStreamingEventListener

    public void removeStreamingEventListener(@NonNull StreamingEventListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addFormatChangeListener

    public void addFormatChangeListener(@NonNull FormatChangeListener listener)
    Add a new Format change listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removeFormatChangeListener

    public void removeFormatChangeListener(@NonNull FormatChangeListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addMetadataListener

    public void addMetadataListener(@NonNull MetadataListener listener)
    Add a new event listener to receive updates on ID3 Meta-Data tags from HLS streams.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addCustomDashEventListener

    public void addCustomDashEventListener(@NonNull CustomDashEventListener listener)
    Add a new event listener to receive custom DASH events

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removeCustomDashEventListener

    public void removeCustomDashEventListener(@NonNull CustomDashEventListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addEventStreamListener

    public void addEventStreamListener(@NonNull EventStreamListener listener)
    Add a new listener to receive cue-start and cue-end for stream events, corresponding to the event duration.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removeEventStreamListener

    public void removeEventStreamListener(@NonNull EventStreamListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addEventStreamListListener

    public void addEventStreamListListener(@NonNull EventStreamListListener listener)
    Add a new listener to receive all the events corresponding to the event-streams as a list.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removeEventStreamListListener

    public void removeEventStreamListListener(@NonNull EventStreamListListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addTimelineListener

    public void addTimelineListener(@NonNull TimelineListener listener)
    Deprecated.
    Use `addTimelineChangedListener(TimelineChangedListener)` or `addPeriodChangedListener(PeriodChangedListener)` instead.
    Add a new event listener to receive updates on timeline and period changes

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addTimelineChangedListener

    public void addTimelineChangedListener(TimelineChangedListener listener)
    Adds a listener to receive updates on `Timeline` updates

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addPeriodChangedListener

    public void addPeriodChangedListener(PeriodChangedListener listener)
    Adds a listener to receive updates on `Timeline.Period` changes

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addTrackSelectionListener

    public void addTrackSelectionListener(@NonNull TrackSelectionListener listener)
    Add a new event listener to receive updates related to track selection.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removeMetadataListener

    public void removeMetadataListener(@NonNull MetadataListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removeTimelineListener

    public void removeTimelineListener(@NonNull TimelineListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removeTimelineChangedListener

    public void removeTimelineChangedListener(TimelineChangedListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### removePeriodChangedListener

    public void removePeriodChangedListener(@NonNull PeriodChangedListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addPlayerControllerListener

    public void addPlayerControllerListener(@NonNull PlayerControllerListener listener)
    Add a new player controller listener

    This method can be called from any thread.

    Parameters:
      `listener` - the listeners

  - ### removePlayerControllerListener

    public void removePlayerControllerListener(@NonNull PlayerControllerListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addEventMessagesListener

    public void addEventMessagesListener(@NonNull EventMessagesListener eventMessagesListener)
    Add a new event message listener

    This method can be called from any thread.

    Parameters:
      `eventMessagesListener` - the listener

  - ### removeEventMessagesListener

    public void removeEventMessagesListener(@NonNull EventMessagesListener eventMessagesListener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `eventMessagesListener` - the listener

  - ### removeTrackSelectionListener

    public void removeTrackSelectionListener(@NonNull TrackSelectionListener listener)
    Remove the given listener.

    This method can be called from any thread.

    Parameters:
      `listener` - the listener

  - ### addVideoRendererListener

    public void addVideoRendererListener(@NonNull VideoRendererListener listener)
    Add a video renderer listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener
    Since:
      4.2.4

  - ### removeVideoRendererListener

    public void removeVideoRendererListener(@NonNull VideoRendererListener listener)
    Remove a video renderer listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener
    Since:
      4.2.4

  - ### addVideoMetadataListener

    public void addVideoMetadataListener(@NonNull VideoMetadataListener listener)
    Add a video metadata listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener

  - ### removeVideoMetadataListener

    public void removeVideoMetadataListener(@NonNull VideoMetadataListener listener)
    Remove video metadata listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener

  - ### addAudioRendererListener

    public void addAudioRendererListener(@NonNull AudioRendererListener listener)
    Add an audio renderer listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener
    Since:
      4.2.25

  - ### removeAudioRendererListener

    public void removeAudioRendererListener(@NonNull AudioRendererListener listener)
    Remove an audio renderer listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener
    Since:
      4.2.25

  - ### addCatchupListener

    public void addCatchupListener(@NonNull CatchupListener listener)
    Add a Catchup listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener
    Since:
      4.2.45

  - ### removeCatchupListener

    public void removeCatchupListener(@NonNull CatchupListener listener)
    Remove a Catchup listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener
    Since:
      4.2.45

  - ### addHttpListener

    public void addHttpListener(@NonNull HttpListener listener)
    Add a HTTP listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener
    Since:
      4.2.45

  - ### removeHttpListener

    public void removeHttpListener(@NonNull HttpListener listener)
    Remove a HTTP listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener
    Since:
      4.2.45

  - ### addRequestModifierListener

    public void addRequestModifierListener(@NonNull RequestModifier.Listener listener)
    Add a `Request` Modifier listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener
    Since:
      4.2.90

  - ### removeRequestModifierListener

    public void removeRequestModifierListener(@NonNull RequestModifier.Listener listener)
    Remove a Modifier listener

    This method can be called from any thread.

    Parameters:
      `listener` - The listener
    Since:
      4.2.90

  - ### addRequestModifier

    public void addRequestModifier(@NonNull RequestModifier modifier)
    Add a request modifier. Please not that you need to call this before calling `open(Bundle)` if you want to modify Manifest requests.

    This method can be called from any thread.

    Parameters:
      `modifier` - The modifier

  - ### removeRequestModifier

    public void removeRequestModifier(@NonNull RequestModifier modifier)
    Remove a request modifier.

    This method can be called from any thread.

    Parameters:
      `modifier` - The modifier

  - ### getRequestModifiers

    public List<RequestModifier> getRequestModifiers()
    Access the list of currently registered request modifier plugins

    This method can be called from any thread.

    Returns:
      The list of currently registered request modifier plugins

  - ### addResponseModifier

    public void addResponseModifier(@NonNull ResponseModifier modifier)
    Add a response modifier.

    This method can be called from any thread.

    Parameters:
      `modifier` - The modifier
    Since:
      4.2.0

  - ### removeResponseModifier

    public void removeResponseModifier(@NonNull ResponseModifier modifier)
    Remove a response modifier.

    This method can be called from any thread.

    Parameters:
      `modifier` - The modifier
    Since:
      4.2.0

  - ### getResponseModifiers

    public List<ResponseModifier> getResponseModifiers()
    Access the list of currently registered response modifier plugins

    This method can be called from any thread.

    Returns:
      The list of currently registered response modifier plugins
    Since:
      4.2.0

  - ### getSecondaryDisplay

    public int getSecondaryDisplay()
    The secondary display setting, which is a bitmap of `SdkConsts.SECONDARY_DISPLAY_NEVER`, `SdkConsts.SECONDARY_DISPLAY_ALLOW_UNPROTECTED_CONTENT`, `SdkConsts.SECONDARY_DISPLAY_ALLOW_SECURE_DISPLAY`, and `SdkConsts.SECONDARY_DISPLAY_ALLOW_ALWAYS`. The setting is initialised to `PlayerSDK.SECONDARY_DISPLAY` at construction time.

    This method can be called from any thread.

    Returns:
      The secondary display setting

  - ### setSecondaryDisplay

    public void setSecondaryDisplay(int secondaryDisplay)
    The secondary display setting, which is a bitmap of `SdkConsts.SECONDARY_DISPLAY_NEVER`, `SdkConsts.SECONDARY_DISPLAY_ALLOW_UNPROTECTED_CONTENT`, `SdkConsts.SECONDARY_DISPLAY_ALLOW_SECURE_DISPLAY`, and `SdkConsts.SECONDARY_DISPLAY_ALLOW_ALWAYS`. The setting is initialised to `PlayerSDK.SECONDARY_DISPLAY` at construction time. This setting is checked when playback is initialized or a display is connected and an error of type `CastlabsPlayerException.TYPE_SECONDARY_DISPLAY` will raised if the setting is not compatible with the current display configuration. The player controller will also register a listener and raise an error when the display configuration changes during playback. As DRM licenses can prevent playback on secondary, insecure, or remote screens. The player will, by default, add a listener to the `MediaRouter` system service in order to process changes in display configurations. It's been observed that, in some specific devices, the `MediaRouter` service can't be acquired. In such cases, it's recommended to set this flag to `SdkConsts.SECONDARY_DISPLAY_ALLOW_ALWAYS`. Note that disabling these screen configuration enforcements might allow playback in circumstances what would otherwise be prevented by the license. If set to `SdkConsts.SECONDARY_DISPLAY_ALLOW_ALWAYS` and playback is opened, no display configuration checks will take place even if this field is updated afterwards.

    This method can be called from any thread.

    Parameters:
      `secondaryDisplay` - The secondary display setting

  - ### getDataSourceFactory

    @NonNull public DataSourceFactory getDataSourceFactory()
    Provides access to the `DataSourceFactory`. You can use this factory to provide additional header and query parameters that will be send with each request.

    This method can be called from any thread.

    Returns:
      Returns the instance of the `DataSourceFactory`

  - ### setDataSourceFactory

    public void setDataSourceFactory(@Nullable DataSourceFactory dataSourceFactory)
    Set the `DataSourceFactory` that will be used to create connections. This factory is responsible to manager request and query parameters, so please make sure that you only set additional parameters after you set any custom data source.

    This method can be called from any thread.

    Parameters:
      `dataSourceFactory` - the factory instance

  - ### getSSLSocketFactory

    @Nullable public SSLSocketFactory getSSLSocketFactory()
    Provides access to previously set `SSLSocketFactory`

    This method can be called from any thread.

    Returns:
      `SSLSocketFactory` or `null` when unknown

  - ### setSSLSocketFactory

    public void setSSLSocketFactory(@Nullable SSLSocketFactory sslSocketFactory)
    Set custom `SSLSocketFactory` to be used in DRM and content requests. Takes precedence over `PlayerSDK.SSL_KEY_STORE`

    This method can be called from any thread.

    Parameters:
      `sslSocketFactory` - `SSLSocketFactory`

  - ### getBandwidthMeterWrapper

    @NonNull public BandwidthMeterWrapper getBandwidthMeterWrapper()
    The bandwidth meter wrapper

    This method can be called from any thread.

    Returns:
      bandwidthMeter

  - ### setSourceSelector

    @Deprecated public void setSourceSelector(@Nullable SourceSelector sourceSelector)
    Deprecated.
    Use `setExternalSourceSelector(ExternalSourceSelector)` } Set the `SourceSelector` that will be used during CDN fallback

    This method can be called from any thread.

    Parameters:
      `sourceSelector` - The CDN selector

  - ### setExternalSourceSelector

    public void setExternalSourceSelector(@Nullable ExternalSourceSelector externalSourceSelector)
    Set the `ExternalSourceSelector` that will be used during CDN fallback Set `null` to disable the CDN fallback

    This method can be called from any thread.

    Parameters:
      `externalSourceSelector` - The CDN selector

  - ### setInternalSourceSelectorFactory

    public void setInternalSourceSelectorFactory(@Nullable com.google.android.exoplayer2.source.dash.manifest.InternalSourceSelector.Factory sourceSelectorFactory)
    Set the `InternalSourceSelector.Factory` that will be used during CDN fallback Set `null` to use the default `PlayerSDK.DEFAULT_INTERNAL_SOURCE_SELECTOR_FACTORY`

    This method can be called from any thread.

    Parameters:
      `sourceSelectorFactory` - The `InternalSourceSelector.Factory`

  - ### setConfigurationProvider

    public void setConfigurationProvider(@Nullable ConfigurationProvider configurationProvider)
    Sets the configuration provider e.g. when Widevine license renewal is enabled via `DrmTodayConfiguration.Builder.renewalThreshold(long, TimeUnit)`

    This method can be called from any thread.

    Parameters:
      `configurationProvider` - The configuration provider

  - ### setPeriodInfoProvider

    public void setPeriodInfoProvider(@Nullable PeriodInfoProvider periodInfoProvider)
    Set the `PeriodInfoProvider` that will be used to get additional information for the played period.

    Use it to enable period-based ads handling.

    This method can be called from any thread.

    Parameters:
      `periodInfoProvider` - The `PeriodInfoProvider.PeriodInfo` provider

  - ### getAdInterface

    @NonNull public AdInterface getAdInterface()
    Gets access to `AdInterface` APIs
    Returns:
      `AdInterface` instance

  - ### getAdClientInterface

    @NonNull public AdClientInterface getAdClientInterface()
    Gets access to `AdClientInterface` APIs
    Returns:
      `AdClientInterface` instance

  - ### getModifierDataSourceFactory

    @NonNull public DataSourceFactory getModifierDataSourceFactory(int requestType)
    Provides access to the `DataSourceFactory` that will be for the specific request type.

    This factory wraps around and delegates to the data source factory provided by `getDataSourceFactory()`.

    This method can be called from any thread.

    Parameters:
      `requestType` - The request type
    Returns:
      Returns the new instance of the `DataSourceFactory`

  - ### setDisableAnalytics

    public void setDisableAnalytics(boolean disableAnalytics)
    Sets whether analytics should be disabled for the user's session.

    This method can be called from any thread.

    Parameters:
      `disableAnalytics` - `true` to disable analytics, `false` to enable analytics.

  - ### isBackgrounded

    public boolean isBackgrounded()
    Returns whether the player is currently backgrounded.

    This method can be called from any thread.

    Returns:
      True if player is currently playing audio only in the background

  - ### setBackgrounded

    public void setBackgrounded(boolean backgrounded)
    This sends or restores the player from background playback. If backgrounded, video playback is disabled and the current surface is removed from the player. The visual components can be disposed after this call and audio will continue in the background. If recovering from background, the last video track is re-enabled and the surface is reattached to the player.

    If you intend to use background playback, please consider using the `PlayerService` which will handle the background playback session for you. In that case, you will not need to call this method explicitly.
    Parameters:
      `backgrounded` - background or restore playback

  - ### getMainHandler

    @NonNull public Handler getMainHandler()
    Get the main handler of this controller.

    This method can be called from any thread.

    Returns:
      the main handler of this controller

  - ### getLiveStartTime

    public long getLiveStartTime()
    Get the live start time in microseconds since the epoch or -1 if unknown or not applicable. The live start time is defined as start time of the region of media currently available for playback. The value is updated each time the available region of media is updated. Shall be used for informational purposes only.
    Returns:
      liveStartTimeUs the live start time in microseconds if known or -1 otherwise

  - ### getAudioFocusCallback

    public com.google.android.exoplayer2.AudioFocusCallback getAudioFocusCallback()
    Gets the audio focus callback for this player.

    This method can be called from any thread.

    Returns:
      the audio focus callback

  - ### getPlayerLooper

    @NonNull public Looper getPlayerLooper()
    Gets player's Looper

    This method can be called from any thread.

    Returns:
      Looper

  - ### getCurrentPeriodIndexInCurrentWindow

    public static int getCurrentPeriodIndexInCurrentWindow(@NonNull com.google.android.exoplayer2.ExoPlayer player)
    Get the index of the current `Period` in the current `Window`.
    Parameters:
      `player` - The player to get the Period index from.
    Returns:
      The current Period index in the current Window, or `C.INDEX_UNSET` if the timeline is empty

  - ### getWindowPositionInFirstPeriod

    public long getWindowPositionInFirstPeriod()
    The position of the start of the current window relative to the start of the first period belonging to it, in microseconds. Shall be used for informational purposes only.
    Returns:
      The position of the start of the current window or -1 if unknown or not applicable

  - ### getPosition

    public long getPosition()
    Get the position in microseconds which is the playback position within the region of media currently available for playback. For live streams `isLive()` the current position since epoch can be obtained as `getLiveStartTime()` + `getPosition()`
    Returns:
      positionUs the position in microseconds

  - ### getPositionInPeriod

    public long getPositionInPeriod()
    Get the position in microseconds which is the playback position within the period of media currently available for playback. This value for live streams may be different to what `getPosition()` returns since it is possible (and likely) to have live window smaller than the Period, which usually starts when stream started.
    Returns:
      positionUs the position inside the current Period in microseconds

  - ### setPositionInPeriod

    public void setPositionInPeriod(long newPositionUs)
    Seek the player to the new position in microseconds. The indicated position is interpreted as position in the current Period.

    The corresponding event will be sent to analytics session (if any)

    Parameters:
      `newPositionUs` - the new position in microseconds for the current Period

  - ### setPosition

    public void setPosition(long newPositionUs)
    Seek the player to the new position in microseconds. The corresponding event will be sent to analytics session (if any)

    If the position is `C.TIME_UNSET`, will go to the default position of the content.

    Parameters:
      `newPositionUs` - the new position in microseconds

  - ### setPosition

    public void setPosition(long newPositionUs, int seekMode)
    Seek the player to the new position in microseconds using specified seek mode The corresponding event will be sent to analytics session (if any)

    If the position is `C.TIME_UNSET`, will go to the default position of the content.

    Parameters:
      `newPositionUs` - the new position in microseconds
      `seekMode` - the seek mode

  - ### seekWith

    public void seekWith(long offsetUs)
    Sets the player to the new position by applying the offset to the current position i.e. with the negative offset the playback goes backward and with the positive one goes forward. The resulting playback position is clipped with zero and the content duration.
    Parameters:
      `offsetUs` - The offset to be applied to the current position

  - ### setTrickplayConfiguration

    public boolean setTrickplayConfiguration(@NonNull TrickplayConfiguration trickplayConfiguration)
    Sets which `TrickplayConfiguration` to use. Note that in order to apply this configuration you should also `enable` it.
    Parameters:
      `trickplayConfiguration` - the TrickplayConfiguration to set
    Returns:
      true if the provided TrickplayConfiguration has actually been applied. The configuration won't be applied if it's invalid. eg. Negative `speed` and `decoder` mode.

  - ### getTrickplayConfiguration

    @NonNull public TrickplayConfiguration getTrickplayConfiguration()
    Returns the current `TrickplayConfiguration`

    This method can be called from any thread.

    Returns:
      the current TrickplayConfiguration

  - ### getHlsKeyCache

    @Nullable public HlsClearKeyCache getHlsKeyCache()
    Returns the current `HlsClearKeyCache` used for HLS Clearkey requests. If no Cache was `set` prior to playback open, a new empty `MemoryHlsClearKeyCache` cache will be created.

    This method can be called from any thread.

    Returns:
      the cache

  - ### setHlsKeyCache

    public void setHlsKeyCache(@Nullable HlsClearKeyCache hlsKeyCache)
    Sets the `HlsClearKeyCache` used for HLS Clearkey requests. Must be set before the `open(PlayerConfig)` call to take effect.

    This method can be called from any thread.

    Parameters:
      `hlsKeyCache` - the cache to set

  - ### isTrickplayMode

    public boolean isTrickplayMode()
    Returns whether the player is currently in trickplay mode or not.

    This method can be called from any thread.

    Returns:
      whether the player is currently in trickplay mode or not.

  - ### isCatchingUp

    public boolean isCatchingUp()
    Checks if the current playback is in catch-up mode.

    This method can be called from any thread.

    Returns:
      `true` if the playback is in catch-up mode (i.e., catchupTrickplayConfiguration is not null), `false` otherwise.

  - ### enableTrickplayMode

    public void enableTrickplayMode(boolean enable)
    Enables or disables trickplay playback.
    Parameters:
      `enable` - enable flag

  - ### getSpeed

    public float getSpeed()
    Returns the current playback speed.

    This method can be called from any thread.

    Returns:
      The current playback speed

  - ### setMaxVideoSizeFilter

    public void setMaxVideoSizeFilter(@Nullable Point maxVideoSize)
    Deprecated.
    use `setVideoFilterConfiguration(VideoFilterConfiguration, VideoFilterConfiguration)`
    Sets the current maximum video size filter, while respecting ABR configuration. Can also be set with `SdkConsts.INTENT_VIDEO_SIZE_FILTER`. If `null` will revert back to `PlayerSDK.VIDEO_SIZE_FILTER`.

    This method can be called from any thread.

    Parameters:
      `maxVideoSize` - The current maximum video size filter.

  - ### setVideoFilterConfiguration

    public void setVideoFilterConfiguration(@Nullable VideoFilterConfiguration videoFilter, @Nullable VideoFilterConfiguration adsFilter)
    Sets the video filter configuration for both content and ads.

    The video filter configuration determines which video tracks are selected for playback. If `videoFilter` is null, it will be set to the default video filter configuration defined by `PlayerSDK.VIDEO_FILTER`.

    This method can be called from any thread.

    Parameters:
      `videoFilter` - The video filter configuration for content. Can be null.
      `adsFilter` - The video filter configuration for ads. Can be null.

  - ### addPlayerModelFilter

    public void addPlayerModelFilter(@NonNull PlayerModelFilter filter)
    Adds a `PlayerModelFilter`. This allows arbitratry track filtering beyond the capabilities of the `videoFilterConfiguration`.

    This method can be called from any thread.

    Parameters:
      `filter` - the filter to add.

  - ### removePlayerModelFilter

    public void removePlayerModelFilter(@NonNull PlayerModelFilter filter)
    Removes a `PlayerModelFilter` previously added with `addPlayerModelFilter(PlayerModelFilter)`.

    This method can be called from any thread.

    Parameters:
      `filter` - the filter to remove.

  - ### setSpeed

    public void setSpeed(float speed)
    Enable fast-forward or slow motion playback by specifying the playback speed. When the requested speed is different from 1 then the audio is disabled and otherwise is enabled automatically.

    Note that setting speed for the online playback with high video quality may result in video stuttering/lagging and it is advised to disable the ABR by setting one of the low video qualities `setVideoQuality(VideoTrackQuality)` before changing the playback speed.
    Parameters:
      `speed` - The playback speed

  - ### addSubtitleTrack

    public void addSubtitleTrack(@NonNull String url, @NonNull String mimeType, @Nullable String language, @Nullable String name)
    Add a subtitles track to be side-loaded when content is opened. Note that you will need to call this method before calling `open(PlayerConfig)` to successfully add a subtitles track.

    This method can be called from any thread.

    Parameters:
      `url` - the encoded URL to the subtitles file
      `mimeType` - the mime type, i.e text/vtt. This shoudl be one of `SdkConsts.MIME_TYPE_TTML`, `SdkConsts.MIME_TYPE_VTT`, `SdkConsts.MIME_TYPE_SRT` or `SdkConsts.MIME_TYPE_CEA608`
      `language` - optional two letter language code, i.e. "en"
      `name` - optional track nam

  - ### addThumbnailTrack

    public void addThumbnailTrack(ThumbnailDataTrack thumbnailDataTrack)
    Adds a thumbnail track. You should not use this method to sideload thumbnail tracks. To do so, add the thumbnails info in the `Intent` that's sent to `open(Bundle)` as described in

    This method can be called from any thread.

    Parameters:
      `thumbnailDataTrack` - the thumbnail track to add

  - ### getSubtitleTracks

    @NonNull public List<SubtitleTrack> getSubtitleTracks()
    Returns a list of the currently registered subtitles.

    This method can be called from any thread.

    Returns:
      A list of the currently registered subtitles

  - ### getSubtitleTrack

    @Nullable public SubtitleTrack getSubtitleTrack()
    Returns the currently active subtitle track. This can be null if no subtitle track is active.

    This method can be called from any thread.

    Returns:
      The currently active subtitle track or null if no subtitle track is active

  - ### setSubtitleTrack

    public void setSubtitleTrack(@Nullable SubtitleTrack track)
    Enables the given subtitle track. You can pass `null` to disable subtitles
    Parameters:
      `track` - the subtitle track or null to disable subtitles

  - ### setSubtitlesStyle

    public void setSubtitlesStyle(@Nullable com.castlabs.subtitles.presentation.SubtitlesStyle subtitlesStyle)
    Allows you to set the desired captioning style that will be used during subtitle rendering.

    This will override any styling that is specified by the subtitle content (i.e. TTML with styles) for all style properties where the default setting is explicitly overwritten (see for example `SubtitlesStyle.hasForegroundColor` and the other `hasXXX` flags on the style).

    This method can be used for example, to set the user specified accessibility settings required for FCC compliance.

    You can pass `null` to use the default styles specified in the content

    This method can be called from any thread.

    Parameters:
      `subtitlesStyle` - object containing the style settings or null to use default

  - ### getSubtitlesStyle

    @Nullable public com.castlabs.subtitles.presentation.SubtitlesStyle getSubtitlesStyle()
    Returns the current subtitles style settings.

    This method can be called from any thread.

    Returns:
      The current subtitles style settings, or `null` if no style is set.

  - ### getAudioTrack

    @Nullable public AudioTrack getAudioTrack()
    Returns the current audio track. This can be null if no audio track is available.

    This method can be called from any thread.

    Returns:
      track the currently selected audio track

  - ### setAudioTrack

    public void setAudioTrack(@Nullable AudioTrack track)
    Sets the current audio track. You can pass `null` to disable audio playback.
    Parameters:
      `track` - the audio track

  - ### getAudioTracks

    @NonNull public List<AudioTrack> getAudioTracks()
    Returns a list of audio track assets found in the opened movie meta data.

    *NOTE* that you have to call `open(PlayerConfig)` before you can call this method.

    From 3.0.0, DTS and Dolby tracks are supported via passthrough. This method will return all the audio tracks. It is recommended to test every audio track with `AudioTrack.isSupportedCodec()` to avoid possible playback issues.

    This method can be called from any thread.

    Returns:
      audioAssets list of available audio assets

  - ### getThumbnailTracks

    @NonNull public List<ThumbnailDataTrack> getThumbnailTracks()
    Returns a list of thumbnail track assets found in the opened DASH manifest.

    *NOTE* that you have to call `open(PlayerConfig)` before you can call this method.

    This method can be called from any thread.

    Returns:
      list of available thumbnails

  - ### getVideoTrack

    @Nullable public VideoTrack getVideoTrack()
    Returns the current video track. This can be null if no video track is available.

    This method can be called from any thread.

    Returns:
      track the currently selected video track

  - ### setVideoTrack

    public void setVideoTrack(@Nullable VideoTrack track)
    Sets the current video track. You can pass `null` to disable video playback. Note that this is not the same as `setVideoQuality(VideoTrackQuality)` and in most cases you will only have one video track with multiple qualities.
    Parameters:
      `track` - the video track

  - ### setVideoTrack

    public void setVideoTrack(@Nullable VideoTrack track, @Nullable VideoTrackQuality quality)
    Sets the current video track and a manually selected quality. You can pass `null` to disable video playback. Note that this is not the same as `setVideoQuality(VideoTrackQuality)` and in most cases you will only have one video track with multiple qualities.
    Parameters:
      `track` - the video track
      `quality` - the quality

  - ### getTimeline

    @NonNull public Timeline getTimeline()
    Returns the current `Timeline`. Can be empty if there's no loaded content.

    This method can be called from any thread.

    Returns:
      the current `Timeline`

  - ### getVideoTracks

    @NonNull public List<VideoTrack> getVideoTracks()
    Returns a list of video tracks.

    This method can be called from any thread.

    Returns:
      videoTracks list of available video tracks or an empty list

  - ### getVideoQualities

    @NonNull public List<VideoTrackQuality> getVideoQualities()
    Returns a list of video qualities for the currently active video track.

    This method can be called from any thread.

    Returns:
      List of `VideoTrackQuality`s for the currently active video track in decreasing bitrate order

  - ### getVideoQuality

    @Nullable public VideoTrackQuality getVideoQuality()
    Returns the current displayed video quality.

    This method can be called from any thread.

    Returns:
      The current displayed video quality or `null`

  - ### setVideoQuality

    public void setVideoQuality(@Nullable VideoTrackQuality videoQuality)
    Set the desired video quality or pass null to enable adaptive bitrate switching (default). Note that passing a quality here will disable adaptive bitrate switching and the playback will stay in the given quality. Also, any existing `initial track selection` will be lost.
    Parameters:
      `videoQuality` - the quality

  - ### getVideoQualityMode

    public int getVideoQualityMode()
    Returns the current video quality mode.

    This method can be called from any thread.

    Returns:
      The current quality mode. Either `SdkConsts.VIDEO_QUALITY_ADAPTIVE` or `SdkConsts.VIDEO_QUALITY_MANUAL`

  - ### getAbrConfiguration

    @NonNull public AbrConfiguration getAbrConfiguration()
    Returns the current ABR configuration

    This method can be called from any thread.

    Returns:
      The ABR configuration

  - ### getVideoSizeFilter

    @NonNull public Point getVideoSizeFilter()
    Deprecated.
    Use `getVideoFilterConfiguration()`.
    Returns the current video size filter

    This method can be called from any thread.

    Returns:
      The current video size filter

  - ### getVideoFilterConfiguration

    @NonNull public VideoFilterConfiguration getVideoFilterConfiguration()
    Returns the current video filter configuration.

    This method can be called from any thread.

    Returns:
      The current video filter configuration.

  - ### setAbrConfiguration

    public void setAbrConfiguration(@Nullable AbrConfiguration abrConfiguration)
    Set the ABR configuration used by the player

    This method can be called from any thread.

    Parameters:
      `abrConfiguration` - The Abr configuration or null to reset to the default

  - ### getMediaCodecSelector

    @NonNull public com.google.android.exoplayer2.mediacodec.MediaCodecSelector getMediaCodecSelector()
    Returns the `MediaCodecSelector`.

    This method can be called from any thread.

    Returns:
      the `MediaCodecSelector`.

  - ### getPlayerConfig

    @Nullable public PlayerConfig getPlayerConfig()
    Returns the current player configuration.
    Returns:
      playerConfig the current playback state or null if no content was loaded yet
    Since:
      3.0.0

  - ### getOfflinePath

    @Nullable public String getOfflinePath()
    Gets the local path to the currently played content if it is played offline, otherwise `null`

    This method can be called from any thread.

    Returns:
      The local path to the offline content or `null` otherwise

  - ### getPreBufferTime

    public long getPreBufferTime()
    Gets an estimate of the absolute position in microseconds up to which data is buffered.
    Returns:
      An estimate of the absolute position in microseconds up to which data is buffered, or 0 if no estimate is available.

  - ### getBufferSizeBytes

    public int getBufferSizeBytes()
    Return the current buffer size in bytes

    This method can be called from any thread.

    Returns:
      The buffer size in bytes
    Since:
      4.2.6

  - ### getBufferSizeTime

    public long getBufferSizeTime()
    Return the current buffer size ahead of the playhead in media time microseconds
    Returns:
      The buffer size ahead in microseconds
    Since:
      4.2.6

  - ### getBufferedPosition

    public long getBufferedPosition()
    Returns an estimate of the position in the current content window or ad up to which data is buffered, in microseconds.
    Returns:
      The buffered position in microseconds
    Since:
      4.2.47

  - ### getBufferedPercentage

    public int getBufferedPercentage()
    Returns an estimate of the percentage in the current content window or ad up to which data is buffered, or 0 if no estimate is available.

    This method can be called from any thread.

    Returns:
      The buffered percentage
    Since:
      4.2.47

  - ### getMaxBufferSizeBytes

    public int getMaxBufferSizeBytes()
    Return the maximum buffer size in bytes

    This method can be called from any thread.

    Returns:
      The max buffer size in bytes
    Since:
      4.2.5

  - ### getAudioAttributes

    @NonNull public com.google.android.exoplayer2.audio.AudioAttributes getAudioAttributes()
    Returns the audio attributes for this player.

    The audio attributes are used by the underlying audio track to determine how to configure the audio sink.

    If the player has been released, this method will return `AudioAttributes.DEFAULT`.

    Returns:
      The audio attributes.

  - ### getBackBufferTime

    public long getBackBufferTime()
    Returns the oldest position that still has buffered content, in microseconds.

    If a seek is performed to this position or further, no media should be re-downloaded as it is still present in the buffer.

    Returns:
      the oldest position that still has buffered content, in microseconds.

  - ### isPlaying

    public boolean isPlaying()
    Returns true if the player is currently playing
    Returns:
      true if player is currently playing

  - ### isSeeking

    public boolean isSeeking()
    Returns true if the player is currently seeking to a new position.

    This method can be called from any thread.

    Returns:
      true if the player is seeking to a new position after a call to `setPosition(long)`

  - ### isPlayWhenReady

    public boolean isPlayWhenReady()
    Returns true if the player will start playing as soon as it fills enough buffer.

    This method can be called from any thread.

    Returns:
      true if the player will start playing as soon as it fills enough buffer.

  - ### getDuration

    public long getDuration()
    Get the duration in microseconds of a region of media currently available for playback (including both live and static streams) or -1 if no duration is available for the current stream.

    Returns a value < 0 if no duration information at all is available, for example if no content is loaded yet.

    Use `isLive()` to check either the content is live or not.
    Returns:
      duration duration in microseconds or -1

  - ### getSeekRangeEndUs

    public long getSeekRangeEndUs()
    Get the end of the current seek range in microseconds or `C.TIME_UNSET`.
    Returns:
      The end of the current seek range in microseconds or `C.TIME_UNSET`.

  - ### getVolume

    public float getVolume()
    Returns the current output volume (gain) of the audio track.

    This method can be called from any thread.

    Returns:
      The current volume (gain) setting as a value between 0 and 1

  - ### setVolume

    public void setVolume(float volume)
    Sets the output volume (gain) of the audio track. A value of 0.0 results in zero gain (silence), and a value of 1.0 means unity gain (signal unchanged). The default value is 1.0 meaning unity gain.
    Parameters:
      `volume` - the output gain between 0.0 (silence) and 1.0 (signal unchanged)
    Throws:
      `IllegalArgumentException` - in case the volume not 0 <= volume <= 1

  - ### getPath

    @Nullable public String getPath()
    Returns the path set in this controller or null

    This method can be called from any thread.

    Returns:
      path the path or null

  - ### getPlayerState

    @NonNull public PlayerController.State getPlayerState()
    Returns the current player state.

    This method can be called from any thread.

    Returns:
      the player state
    Since:
      3.0.0

  - ### getPlayer

    @Nullable public com.google.android.exoplayer2.ExoPlayer getPlayer()
    Access the player API instance.
    Returns:
      player the player instance

  - ### isLoopingEnabled

    public boolean isLoopingEnabled()
    Returns true if looping is enables and the player will automatically restart the playback on finish.

    This method can be called from any thread.

    Returns:
      true if looping is enabled

  - ### setLoopingEnabled

    public void setLoopingEnabled(boolean loopingEnabled)
    Enable/Disable looping

    This method can be called from any thread.

    Parameters:
      `loopingEnabled` - enable or disable looping

  - ### getAnalyticsSession

    @Nullable public AnalyticsSession getAnalyticsSession()
    Get the current analytics session if there is one. Please note that the session will be initialized only when content was loaded using `open(Bundle)` or `open(PlayerConfig)`.

    This method can be called from any thread.

    Returns:
      The analytics session or null
    See Also:
      - `AnalyticsSession.detachFromController()`

  - ### setAnalyticsSession

    public void setAnalyticsSession(@Nullable AnalyticsSession analyticsSession)
    Set an already existing AnalyticsSession. This should be called before `open(Bundle)`. Setting null will `detach` the Session, if any. The caller is responsible to release the session if not reusing.

    This method can be called from any thread.

    Parameters:
      `analyticsSession` - AnalyticsSession to use in this Player Controller. Should be gotten with the `getAnalyticsSession()` before the player controller is disposed. If null, it will unset any Analytics sessions.

  - ### getAnalyticsMetaData

    @Nullable public AnalyticsMetaData getAnalyticsMetaData()
    Returns the analytics meta-data associated with the controller.

    This method can be called from any thread.

    Returns:
      Get the analytics meta data associated with the controller or null if no data are set

  - ### setAnalyticsMetaData

    public void setAnalyticsMetaData(@NonNull AnalyticsMetaData analyticsMetaData)
    Set the analytics meta-data. If you are using `open(PlayerConfig)` and no `Bundle` to start playback, you need to call this method before you start playback to set the required meta-data parameters for the playback session.

    Without the meta-data object in place, analytics integration will not work since the different analytics integrations require certain mandatory parameters to be set. The documentation and API docs for the different analytics platforms contain information which parameters are mandatory.

    This method can be called from any thread.

    Parameters:
      `analyticsMetaData` - The meta-data

  - ### open

    public void open(@NonNull Bundle bundle)
    This method takes a `Bundle` and extracts the information to create a `PlayerConfig` from the bundle. The following bundle keys are queried to create the playback state: The following keys will be checked:
    - `SdkConsts.INTENT_URL` expects a String (mandatory)
    - `SdkConsts.INTENT_START_PLAYING` expects a Boolean (default: true)
    - `SdkConsts.INTENT_POSITION_TO_PLAY` expects a Long (default: 0)
    - `SdkConsts.INTENT_DRM_CONFIGURATION` expects a `DrmConfiguration` (default: null)
    - `SdkConsts.INTENT_AUDIO_TRACK_GROUP_IDX` expects a `Integer` (default: 0 to play the first track)
    - `SdkConsts.INTENT_SUBTITLE_TRACK_GROUP_IDX` expects a `Integer` (default: -1 to disable subtitles)
    - `SdkConsts.INTENT_CONTENT_TYPE` expects a `Integer` (default: `SdkConsts.CONTENT_TYPE_UNKNOWN` to auto-detect). Allowed values are one of `SdkConsts.CONTENT_TYPE_UNKNOWN`, `SdkConsts.CONTENT_TYPE_DASH`, `SdkConsts.CONTENT_TYPE_HLS`, `SdkConsts.CONTENT_TYPE_SMOOTHSTREAMING`, or `SdkConsts.CONTENT_TYPE_MP4`
    - `SdkConsts.INTENT_AUDIO_VOLUME` expects a `Float` with a value 0 <= value <= 1
    - `SdkConsts.INTENT_SECONDARY_DISPLAY` expects a `Integer` and defaults to the value of `getSecondaryDisplay()`
    - `SdkConsts.INTENT_HD_CONTENT_FILTER` expects a `Integer` and defaults to the value of `PlayerSDK.PLAYBACK_HD_CONTENT`
    - `SdkConsts.INTENT_VIDEO_SIZE_FILTER` expects a `Point` and defaults to the value of `PlayerSDK.VIDEO_SIZE_FILTER`
    - `SdkConsts.INTENT_VIDEO_CODEC_FILTER` expects a `Integer` and defaults to the value of `PlayerSDK.VIDEO_CODEC_FILTER`
    - `SdkConsts.INTENT_ENABLE_LOOPING` expects a `Boolean` and if true, enables looping
    - `SdkConsts.INTENT_ANALYTICS_DATA` expects a `AnalyticsMetaData` object and is required if you are using one of the analytics plugins
    - `SdkConsts.INTENT_BUFFER_CONFIGURATION` expects a `BufferConfiguration` object and can be used to teak the player buffer
    - `SdkConsts.INTENT_ABR_CONFIGURATION` expects a `AbrConfiguration` object and can be used to teak the players ABR behaviour
    - `SdkConsts.INTENT_USER_ID` expects a `String`
    - `SdkConsts.INTENT_LIVE_CONFIGURATION` expects a `LiveConfiguration` object and is used to tweak live-related params
    In addition, you can use `SdkConsts.INTENT_QUERY_PARAMS_BUNDLE` and `SdkConsts.INTENT_HEADER_PARAMS_BUNDLE` to configure and add query and header parameters that will be send with each request. This can for example be used to add tokens when remote resources are requested. In both cases, the bundle needs to reference another `Bundle` instance that is then used as a key/value store for the query or header parameters.

    You can also use `SdkConsts.INTENT_SUBTITLE_BUNDLE_ARRAYLIST` to side-load additional subtitle tracks through the bundle. Use the key to store an `ArrayList` of `Bundle` instances that specify side loaded tracks. Use `intent.putParcelableArrayListExtra(SdkConsts.INTENT_SUBTITLE_BUNDLE_ARRAYLIST, ...);` to add the list of bundles with the subtitle track information. A full example of this looks like:

         ArrayList<Bunde> subtitles = new ArrayList<>();
         Bundle bundle = new Bundle();
         bundle.putString(SdkConsts.INTENT_SUBTITLE_URL, "https://my.com/subtitle.ttml");
         bundle.putString(SdkConsts.INTENT_SUBTITLE_MIME_TYPE, SdkConsts.MIME_TYPE_TTML);
         bundle.putString(SdkConsts.INTENT_SUBTITLE_LANGUAGE, "en");
         bundle.putString(SdkConsts.INTENT_SUBTITLE_NAME, "Side-loaded");
         subtitles.add(bundle);
         intent.putExtra(SdkConsts.INTENT_SUBTITLE_BUNDLE_ARRAYLIST, subtitles);

    Parameters:
      `bundle` - the bundle
    Throws:
      `IllegalArgumentException` - when bundle is `null` or does not contain neither a non-empty `SdkConsts.INTENT_URL` nor non-null `SdkConsts.INTENT_ADVERTS_DATA`
    Since:
      3.0.0
    See Also:
      - `PlayerConfig.Builder.fromBundle(Bundle)`

  - ### open

    public void open(@NonNull PlayerConfig playerConfig)
    Opens the given URL to the video. You can specify a path to a local file here, but in this case, please note that the path *needs* to be absolute. The path is treated as a URL and a protocol is expected. If no protocol is specified, the `file://` protocol is assumed and prepended to the given path.

    If you are using an Analytics Plugin, make sure you use `setAnalyticsMetaData(AnalyticsMetaData)` to set the required meta-data before calling this method.
    Parameters:
      `playerConfig` - the desired Player configuration

  - ### getIdHashCode

    @NonNull public String getIdHashCode()
    Returns a stable identifier for log messages based on this controller instance.
    Returns:
      the identity hash code of this controller as a hexadecimal string

  - ### prepareAnalyticsSession

    public void prepareAnalyticsSession(PlayerConfig playerConfig)
    Use this method to prepare the analytics session according to the player configuration before `open(android.os.Bundle)` the player controller.

    This method can be called from any thread.

    Parameters:
      `playerConfig` - the player configuration

  - ### play

    public void play()
    Start player

  - ### pause

    public void pause()
    Stop player

  - ### destroy

    public void destroy()
    Call this method when the activity that displays the video player is destroyed. This releases the player the resources allocated by this controller. This call will also remove all callbacks, and in case there's a `playerView`, the PlayerController will be removed from it.
    Since:
      1.2.0

  - ### release

    public void release()
    Release the player instance and reset the underlying player model. You will need to call `open(Bundle)` or `open(PlayerConfig)` to restart playback.

  - ### release

    public void release(boolean preservePlayerResources, boolean preservePlayerViewSurface)
    Release the player instance and reset the underlying player model. You will need to call `open(Bundle)` or `open(PlayerConfig)` to restart playback. Overrides `PlayerConfig.preservePlayerResources` and `PlayerConfig.preservePlayerViewSurface`.
    Parameters:
      `preservePlayerResources` - Control if the underlying resources shall be preserved
      `preservePlayerViewSurface` - Control if the player view shall be preserved

  - ### releaseWithException

    public void releaseWithException(@Nullable CastlabsPlayerException exception)
    Releases the player resources and throws an exception to indicate that the player is in an error state.

    If `exception` is null, the player will be released normally.

    Parameters:
      `exception` - The exception to throw, or null to release normally.

  - ### getKeyStore

    @Nullable public static KeyStore getKeyStore()
    Returns the `KeyStore` that will be used to store offline IDs or null if no store is configured. This is the same as `PlayerSDK.DEFAULT_KEY_STORE`.

    This method can be called from any thread.

    Returns:
      The key store or null

  - ### isHdPlaybackEnabled

    public boolean isHdPlaybackEnabled()
    Returns true if this controllers filter setting allows HD content playback.

    This method can be called from any thread.

    Returns:
      True if general HD content playback is enabled

  - ### setHdPlaybackEnabled

    public void setHdPlaybackEnabled(int filter)
    Set the HD content filter criteria for this specific controller. The methods accepts a bit field that is constructed from the values of `SdkConsts.ALLOW_HD_CLEAR_CONTENT`, `SdkConsts.ALLOW_HD_DRM_SECURE_MEDIA_PATH`, `SdkConsts.ALLOW_HD_DRM_ROOT_OF_TRUST`, `SdkConsts.ALLOW_HD_NEVER`, and `SdkConsts.ALLOW_HD_DRM_SOFTWARE`. The default value is the setting for `PlayerSDK.PLAYBACK_HD_CONTENT`. *

    This method can be called from any thread.

    Parameters:
      `filter` - The HD content filter setting

  - ### getBufferConfiguration

    @NonNull public BufferConfiguration getBufferConfiguration()
    Returns the buffer configuration of this controller

    This method can be called from any thread.

    Returns:
      The buffer configuration

  - ### getLiveConfiguration

    @NonNull public LiveConfiguration getLiveConfiguration()
    Returns the live configuration of this controller

    This method can be called from any thread.

    Returns:
      The Live configuration

  - ### setBufferConfiguration

    public void setBufferConfiguration(@Nullable BufferConfiguration bufferConfiguration)
    Set the buffer configuration for this controller. The buffer configuration can also be changed at runtime.

    This method can be called from any thread.

    Parameters:
      `bufferConfiguration` - The buffer configuration

  - ### setLiveConfiguration

    public void setLiveConfiguration(@Nullable LiveConfiguration liveConfiguration)
    Set the live configuration for this controller. You need to call this before you call `open(Bundle)` to have an effect on the playback.

    This method can be called from any thread.

    Parameters:
      `liveConfiguration` - The live configuration

  - ### setInitialPositionProvider

    public void setInitialPositionProvider(@Nullable InitialPositionProvider provider)
    Sets the `InitialPositionProvider`.

    This method can be called from any thread.

    Parameters:
      `provider` - the provider to set

  - ### getNetworkConfiguration

    @NonNull public NetworkConfiguration getNetworkConfiguration()
    Returns the current network configuration of this controller.

    This method can be called from any thread.

    Returns:
      The current network configuration

  - ### isLive

    public boolean isLive()
    Returns true if the live stream is currently played otherwise false
    Returns:
      True if the live stream is currently played otherwise false

  - ### getLiveEdgeLatency

    public int getLiveEdgeLatency()
    For live streams, the number of milliseconds that the playback should lag behind the "live edge" (i.e. the end of the most recently defined media in the manifest).
    Returns:
      liveEdgeLatencyMs The time in milliseconds the player lags behind the live edge

  - ### openState

    public void openState(@NonNull Bundle bundle)
    Opens the {link PlayerController} with the given `Bundle` which is the saved state obtained with `saveState(Bundle)`
    Parameters:
      `bundle` - The `Bundle` to open the `PlayerController` with

  - ### saveState

    public boolean saveState(@NonNull Bundle targetBundle)
    Saves the state of this controller to the given target bundle.

    This will store the playback state and all intent parameters that are required to restore the state of this controller using `open(Bundle)` with the target bundle.

    The only exception is the current video quality selection. The video quality will be stored as the initial quality in the bundle if adaptive bitrate switching is turned off and the quality was selected manually. In that case, adaptive bitrate switching will be turned off when the bundle is used to re-open content.
    Parameters:
      `targetBundle` - the target bundle
    Returns:
      True if the state was saved successfully

  - ### getContext

    @NonNull public Context getContext()
    Returns the context associated with this controller.

    This method can be called from any thread.

    Returns:
      the context associated with this controller

  - ### getPlayerListeners

    @NonNull public PlayerListeners getPlayerListeners()
    Returns the `PlayerListeners` that are used to notify about player events.

    This method can be called from any thread.

    Returns:
      the player listeners

  - ### setSurface

    public void setSurface(@Nullable Surface surface)
    Set the `Surface` that will be used to render video. Note that you usually do not need to call this method explicitly unless you are implementing your own `IPlayerView`.

    You need to call this method when the actual surface is created or destroyed (pass `null` in that case). Usually you will need to add a listener to the surface provider, i.e. `SurfaceView`, to be informed about state changes of the underlying surface.
    Parameters:
      `surface` - The surface instance or null if the surface was destroyed

  - ### isSupportedAudioCodec

    public static boolean isSupportedAudioCodec(String codec)
    Checks if the given audio codec is supported.

    A codec is considered supported if it is not null and not present in the `Codecs.UNSUPPORTED_AUDIO_CODECS` list.

    This method can be called from any thread.

    Parameters:
      `codec` - The audio codec string to check.
    Returns:
      `true` if the codec is supported or if the input codec is `null`, `false` otherwise.

  - ### getLiveEdgeUs

    public long getLiveEdgeUs()
    Returns the live edge time in microseconds, or `C.TIME_UNSET` if unknown or not applicable. Same as `getLiveEdgeUs()` (boolean)} with true param.
    Returns:
      the live edge in microseconds.

  - ### getLiveEdgeUs

    public long getLiveEdgeUs(boolean applyOffset)
    Returns the live edge time in microseconds, or `C.TIME_UNSET` if unknown or not applicable.
    Parameters:
      `applyOffset` - whether the currently set live edge latency (`getLiveEdgeLatency()` should be taken into account or not.
    Returns:
      the live edge in microseconds.

  - ### setComponentView

    public void setComponentView(@IdRes int viewId, View view)
    Set a specific component View.

    This method allows to inject Views for some PlayerControllerPlugins to use.

    The PlayerControllerPlugins require a specific View to be set. If you are already using a `PlayerView`, then the corresponding `PlayerViewPlugins` will take care of creating and adding these Views.

    If you opt not to use a PlayerView, you should add through this method the Views you want to provide the `PlayerControllerPlugins` with.

    In case a PlayerControllerPlugin cannot find the expected View it won't create on its own, and won't be able to function properly.

    This method can be called from any thread.

    Parameters:
      `viewId` - the viewId which links to the View. This can be usually be found as a constant in the `PlayerPlugin` class which provides the specific View.
      `view` - the instance of the specific View to add.
    Since:
      4.2.2
    See Also:
      - `getComponentView(int)`

  - ### unsetComponentView

    public void unsetComponentView(@IdRes int viewId)
    Remove the View linked to the provided view id

    This method can be called from any thread.

    Parameters:
      `viewId` - the view id for the View to remove.
    Since:
      4.2.2

  - ### unsetComponentViews

    public void unsetComponentViews()
    Removes all the Component Views

    This method can be called from any thread.

    Since:
      4.2.2

  - ### scanComponentViews

    public void scanComponentViews(@NonNull ViewGroup container)
    Scans the given ViewGroup for specific PlayerControllerPlugin Views.

    Each `PlayerControllerPlugin` will be given the chance to search for its Views in the provided container.

    The Views can be at any hierarchy level, since they're looked for through the `View.findViewById(int)` method.

    The Views *have* to have as `id`the expected id, usually found as a constant in the `PlayerPlugin` class which provides the specific View.

    This method can be called from any thread.

    Parameters:
      `container` - the ViewGroup in which to look for specific Plugin Views
    Since:
      4.2.2

  - ### getComponentView

    @Nullable public View getComponentView(@IdRes int viewId)
    Returns a View previously set through `setComponentView(int, View)` and indexed with a view id.

    The component Views returned by this method are the ones that will be used by their respective plugins.

    This method can be called from any thread.

    Parameters:
      `viewId` - the view id which identifies this View
    Returns:
      the View linked to the provided viewId
    Since:
      4.2.2

  - ### queryKeyStatus

    @Nullable public Map<String,String> queryKeyStatus(@NonNull TrackRendererPlugin.Type trackType)
    Queries the Key Status for the currently active session. Internally, this queries the platform's `MediaDrm`. The status is in the form of {name, value} pairs. Since DRM license policies vary by vendor, the specific status field names are determined by each DRM vendor.

    This method can be called from any thread.

    Parameters:
      `trackType` - the track type for which to query the Key status. One of `TrackRendererPlugin.Type.Audio`, `TrackRendererPlugin.Type.Video` or `TrackRendererPlugin.Type.Other`. Other represents both audio and video; it applies when using the same DrmSessionManager to handle both licenses.
    Returns:
      a Map of {name, value} pairs with the status of the currently loaded session, or null if no session is loaded, or the provided trackType does not match with the available DrmSessionManagers.

  - ### queryKeyStatus

    public Map<String,String> queryKeyStatus()
    Queries the Key Status for the currently loaded session. Internally, this queries the platform's `MediaDrm`. The status is in the form of {name, value} pairs. Since DRM license policies vary by vendor, the specific status field names are determined by each DRM vendor. This method will return the key status for a track with the following priority:
    1. `TrackRendererPlugin.Type.Other` (both Audio and Video)
    2. `TrackRendererPlugin.Type.Video`
    3. `TrackRendererPlugin.Type.Audio`

    This method can be called from any thread.

    Returns:
      a Map of {name, value} pairs with the status of the currently loaded session, or null if no session is loaded.

  - ### getLicenseRemainingDurationSec

    public long getLicenseRemainingDurationSec(@NonNull TrackRendererPlugin.Type trackType)
    Returns the remaining license duration for the current DRM session. In seconds. Returns `C.TIME_UNSET` if unknown or no DRM session is currently open. If the license has no play duration and no expiration, `Long.MAX_VALUE` will be returned.

    This method can be called from any thread.

    Parameters:
      `trackType` - the track type for which to query the Key status. One of `TrackRendererPlugin.Type.Audio`, `TrackRendererPlugin.Type.Video` or `TrackRendererPlugin.Type.Other`. Other represents both audio and video; it applies when using the same DrmSessionManager to handle both licenses.
    Returns:
      the remaining license duration in seconds, or C.TIME_UNSET.

  - ### getLicenseRemainingDurationSec

    public long getLicenseRemainingDurationSec()
    Returns the remaining license duration for the current DRM session. In seconds. Returns `C.TIME_UNSET` if unknown or no DRM session is currently open. If the license has no play duration and no expiration, `Long.MAX_VALUE` will be returned. This method will return the remaining license duration for a track with the following priority:
    1. `TrackRendererPlugin.Type.Other` (both Audio and Video)
    2. `TrackRendererPlugin.Type.Video`
    3. `TrackRendererPlugin.Type.Audio`

    This method can be called from any thread.

    Returns:
      the remaining license duration in seconds, or C.TIME_UNSET.

  - ### disableAudioFocus

    public void disableAudioFocus()
    Disables the audio focus for the stream regardless of the `PlayerConfig.audioAttributes`

  - ### resetAudioFocus

    public void resetAudioFocus()
    Resets the audio focus for the stream according to the `PlayerConfig.audioAttributes`

  - ### setPlayerView

    public void setPlayerView(@Nullable IPlayerView playerView)
    Sets the `IPlayerView` instance that is used to provide the surface and render the video. Note that you usually do not need to call this method explicitly unless you are implementing your own `IPlayerView`. There is not need to call this method if you are using the default `PlayerView` implementation.
    Parameters:
      `playerView` - the player view

  - ### getPlayerView

    @Nullable public IPlayerView getPlayerView()
    Returns the current `IPlayerView` that is associated with this controller.

    This method can be called from any thread.

    Returns:
      Returns the current view that is associated with this controller or null.

  - ### setAudioFocusCallback

    public void setAudioFocusCallback(@Nullable com.google.android.exoplayer2.AudioFocusCallback audioFocusCallback)
    Sets the `AudioFocusCallback`. It will be called when audio focus is lost. It overrides the default behaviour, which is pausing the player.

    This method can be called from any thread.

    Parameters:
      `audioFocusCallback` - the callback

  - ### movePlayerListeners

    public void movePlayerListeners(@Nullable PlayerController playerController)
    Migrates all the listeners from this PlayerController to the given one. Typical usage of this method is in an implementation of `MultiControllerPlaylist.PlaylistListener.onItemChange(PlayerConfig, PlayerController, PlayerController)`.

    This method can be called from any thread.

    Parameters:
      `playerController` - The controller to which the listeners will be moved

  - ### createContentMediaSource

    @NonNull public com.google.android.exoplayer2.source.MediaSource createContentMediaSource(@NonNull PlayerConfig playerConfig, boolean attachInitialPositionProvider, @NonNull PlayerPlugin playerPlugin)
    Creates a MediaSource for just one PlayerConfig. The resultin MediaSource will be wrapped by a `ClippingMediaSource` if needed.

    This method can be called from any thread.

    Parameters:
      `playerConfig` - the config from which to create the MediaSource
      `attachInitialPositionProvider` - whether to attach the `InitialPositionProvider` to the MediaSource
      `playerPlugin` - the `PlayerPlugin` that will create the MediaSource
    Returns:
      the MediaSource

  - ### getBitrateEstimate

    public long getBitrateEstimate()
    Returns the estimated bandwidth in bits/sec.

    This method can be called from any thread.

    Returns:
      The estimated bandwidth

  - ### waitForMessages

    public boolean waitForMessages()
    Queues a message to an arbitrary target and blocks until its delivered.
    Returns:
      True if the message was delivered