Package com.castlabs.android.player

# Interface TrackSelectionListener

public interface TrackSelectionListener
This is a high level listener interface that provides callbacks for track selection events.

*NOTE* that all listener methods are invoked on the UI/main thread of your applications. You can directly interact with UI components from within the implementation of you listener.

Since:
  4.2.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onAudioTrackChanged(AudioTrack audioTrack)`
  Called when the selected audio track changes.
  `void`
  `onSubtitleTrackChanged(SubtitleTrack subtitleTrack)`
  Called when the selected subtitle track changes.
  `void`
  `onVideoQualitySelectionChanged(VideoTrackQuality videoTrackQuality, int reason, String switchDescription, long bufferedDurationUs, long bitrateEstimate)`
  Called each time when starting to load a new media chunk.
  `void`
  `onVideoTrackChanged(VideoTrack videoTrack)`
  Called when the selected video track changes.

- ## Method Details

  - ### onVideoQualitySelectionChanged

    void onVideoQualitySelectionChanged(@NonNull VideoTrackQuality videoTrackQuality, int reason, @Nullable String switchDescription, long bufferedDurationUs, long bitrateEstimate)
    Called each time when starting to load a new media chunk.

    *NOTE* This is not when the actual quality starts playing, but rather when the ABR algorithm selects it. If you want to know when the player changes the (rendering) video quality use `FormatChangeListener.onVideoFormatChange(Format, int, long, VideoTrackQuality)` instead.
    Parameters:
      `videoTrackQuality` - The selected quality
      `reason` - The selection reason. One of the `C.SELECTION_REASON_*` and `SdkConsts.SELECTION_REASON_*` constants
      `switchDescription` - Optional switch description
      `bufferedDurationUs` - The buffer ahead in microseconds at the time of the selection
      `bitrateEstimate` - The bandwidth estimation in bps at the time of the selection

  - ### onVideoTrackChanged

    void onVideoTrackChanged(@Nullable VideoTrack videoTrack)
    Called when the selected video track changes.
    Parameters:
      `videoTrack` - `VideoTrack` or `null` if video is disabled

  - ### onAudioTrackChanged

    void onAudioTrackChanged(@Nullable AudioTrack audioTrack)
    Called when the selected audio track changes.
    Parameters:
      `audioTrack` - `AudioTrack` or `null` if audio is disabled

  - ### onSubtitleTrackChanged

    void onSubtitleTrackChanged(@Nullable SubtitleTrack subtitleTrack)
    Called when the selected subtitle track changes.
    Parameters:
      `subtitleTrack` - `SubtitleTrack` or `null` if subtitle is disabled