Class DefaultTrackSelector.ParametersBuilder

    • Constructor Detail

      • ParametersBuilder

        public ParametersBuilder​(Context context)
        Creates a builder with default initial values.
        Parameters:
        context - Any context.
    • Method Detail

      • setMaxVideoSize

        public DefaultTrackSelector.ParametersBuilder setMaxVideoSize​(int maxVideoWidth,
                                                                      int maxVideoHeight)
        Sets the maximum allowed video width and height.
        Parameters:
        maxVideoWidth - Maximum allowed video width in pixels.
        maxVideoHeight - Maximum allowed video height in pixels.
        Returns:
        This builder.
      • setMaxVideoFrameRate

        public DefaultTrackSelector.ParametersBuilder setMaxVideoFrameRate​(int maxVideoFrameRate)
        Sets the maximum allowed video frame rate.
        Parameters:
        maxVideoFrameRate - Maximum allowed video frame rate in hertz.
        Returns:
        This builder.
      • setMaxVideoBitrate

        public DefaultTrackSelector.ParametersBuilder setMaxVideoBitrate​(int maxVideoBitrate)
        Sets the maximum allowed video bitrate.
        Parameters:
        maxVideoBitrate - Maximum allowed video bitrate in bits per second.
        Returns:
        This builder.
      • setMinVideoSize

        public DefaultTrackSelector.ParametersBuilder setMinVideoSize​(int minVideoWidth,
                                                                      int minVideoHeight)
        Sets the minimum allowed video width and height.
        Parameters:
        minVideoWidth - Minimum allowed video width in pixels.
        minVideoHeight - Minimum allowed video height in pixels.
        Returns:
        This builder.
      • setMinVideoFrameRate

        public DefaultTrackSelector.ParametersBuilder setMinVideoFrameRate​(int minVideoFrameRate)
        Sets the minimum allowed video frame rate.
        Parameters:
        minVideoFrameRate - Minimum allowed video frame rate in hertz.
        Returns:
        This builder.
      • setMinVideoBitrate

        public DefaultTrackSelector.ParametersBuilder setMinVideoBitrate​(int minVideoBitrate)
        Sets the minimum allowed video bitrate.
        Parameters:
        minVideoBitrate - Minimum allowed video bitrate in bits per second.
        Returns:
        This builder.
      • setAllowVideoMixedMimeTypeAdaptiveness

        public DefaultTrackSelector.ParametersBuilder setAllowVideoMixedMimeTypeAdaptiveness​(boolean allowVideoMixedMimeTypeAdaptiveness)
        Sets whether to allow adaptive video selections containing mixed MIME types.

        Adaptations between different MIME types may not be completely seamless, in which case setAllowVideoNonSeamlessAdaptiveness(boolean) also needs to be true for mixed MIME type selections to be made.

        Parameters:
        allowVideoMixedMimeTypeAdaptiveness - Whether to allow adaptive video selections containing mixed MIME types.
        Returns:
        This builder.
      • setAllowVideoNonSeamlessAdaptiveness

        public DefaultTrackSelector.ParametersBuilder setAllowVideoNonSeamlessAdaptiveness​(boolean allowVideoNonSeamlessAdaptiveness)
        Sets whether to allow adaptive video selections where adaptation may not be completely seamless.
        Parameters:
        allowVideoNonSeamlessAdaptiveness - Whether to allow adaptive video selections where adaptation may not be completely seamless.
        Returns:
        This builder.
      • setViewportSize

        public DefaultTrackSelector.ParametersBuilder setViewportSize​(int viewportWidth,
                                                                      int viewportHeight,
                                                                      boolean viewportOrientationMayChange)
        Sets the viewport size to constrain adaptive video selections so that only tracks suitable for the viewport are selected.
        Parameters:
        viewportWidth - Viewport width in pixels.
        viewportHeight - Viewport height in pixels.
        viewportOrientationMayChange - Whether the viewport orientation may change during playback.
        Returns:
        This builder.
      • setPreferredVideoMimeType

        public DefaultTrackSelector.ParametersBuilder setPreferredVideoMimeType​(@Nullable
                                                                                String mimeType)
        Sets the preferred sample MIME type for video tracks.
        Parameters:
        mimeType - The preferred MIME type for video tracks, or null to clear a previously set preference.
        Returns:
        This builder.
      • setPreferredVideoMimeTypes

        public DefaultTrackSelector.ParametersBuilder setPreferredVideoMimeTypes​(String... mimeTypes)
        Sets the preferred sample MIME types for video tracks.
        Parameters:
        mimeTypes - The preferred MIME types for video tracks in order of preference, or an empty list for no preference.
        Returns:
        This builder.
      • setMaxAudioChannelCount

        public DefaultTrackSelector.ParametersBuilder setMaxAudioChannelCount​(int maxAudioChannelCount)
        Sets the maximum allowed audio channel count.
        Parameters:
        maxAudioChannelCount - Maximum allowed audio channel count.
        Returns:
        This builder.
      • setMaxAudioBitrate

        public DefaultTrackSelector.ParametersBuilder setMaxAudioBitrate​(int maxAudioBitrate)
        Sets the maximum allowed audio bitrate.
        Parameters:
        maxAudioBitrate - Maximum allowed audio bitrate in bits per second.
        Returns:
        This builder.
      • setExceedAudioConstraintsIfNecessary

        public DefaultTrackSelector.ParametersBuilder setExceedAudioConstraintsIfNecessary​(boolean exceedAudioConstraintsIfNecessary)
        Sets whether to exceed the setMaxAudioChannelCount(int) and setMaxAudioBitrate(int) constraints when no selection can be made otherwise.
        Parameters:
        exceedAudioConstraintsIfNecessary - Whether to exceed audio constraints when no selection can be made otherwise.
        Returns:
        This builder.
      • setAllowAudioMixedMimeTypeAdaptiveness

        public DefaultTrackSelector.ParametersBuilder setAllowAudioMixedMimeTypeAdaptiveness​(boolean allowAudioMixedMimeTypeAdaptiveness)
        Sets whether to allow adaptive audio selections containing mixed MIME types.

        Adaptations between different MIME types may not be completely seamless.

        Parameters:
        allowAudioMixedMimeTypeAdaptiveness - Whether to allow adaptive audio selections containing mixed MIME types.
        Returns:
        This builder.
      • setAllowAudioMixedSampleRateAdaptiveness

        public DefaultTrackSelector.ParametersBuilder setAllowAudioMixedSampleRateAdaptiveness​(boolean allowAudioMixedSampleRateAdaptiveness)
        Sets whether to allow adaptive audio selections containing mixed sample rates.

        Adaptations between different sample rates may not be completely seamless.

        Parameters:
        allowAudioMixedSampleRateAdaptiveness - Whether to allow adaptive audio selections containing mixed sample rates.
        Returns:
        This builder.
      • setAllowAudioMixedChannelCountAdaptiveness

        public DefaultTrackSelector.ParametersBuilder setAllowAudioMixedChannelCountAdaptiveness​(boolean allowAudioMixedChannelCountAdaptiveness)
        Sets whether to allow adaptive audio selections containing mixed channel counts.

        Adaptations between different channel counts may not be completely seamless.

        Parameters:
        allowAudioMixedChannelCountAdaptiveness - Whether to allow adaptive audio selections containing mixed channel counts.
        Returns:
        This builder.
      • setPreferredAudioMimeType

        public DefaultTrackSelector.ParametersBuilder setPreferredAudioMimeType​(@Nullable
                                                                                String mimeType)
        Sets the preferred sample MIME type for audio tracks.
        Parameters:
        mimeType - The preferred MIME type for audio tracks, or null to clear a previously set preference.
        Returns:
        This builder.
      • setPreferredAudioMimeTypes

        public DefaultTrackSelector.ParametersBuilder setPreferredAudioMimeTypes​(String... mimeTypes)
        Sets the preferred sample MIME types for audio tracks.
        Parameters:
        mimeTypes - The preferred MIME types for audio tracks in order of preference, or an empty list for no preference.
        Returns:
        This builder.
      • setForceLowestBitrate

        public DefaultTrackSelector.ParametersBuilder setForceLowestBitrate​(boolean forceLowestBitrate)
        Sets whether to force selection of the single lowest bitrate audio and video tracks that comply with all other constraints.
        Parameters:
        forceLowestBitrate - Whether to force selection of the single lowest bitrate audio and video tracks.
        Returns:
        This builder.
      • setForceHighestSupportedBitrate

        public DefaultTrackSelector.ParametersBuilder setForceHighestSupportedBitrate​(boolean forceHighestSupportedBitrate)
        Sets whether to force selection of the highest bitrate audio and video tracks that comply with all other constraints.
        Parameters:
        forceHighestSupportedBitrate - Whether to force selection of the highest bitrate audio and video tracks.
        Returns:
        This builder.
      • setExceedRendererCapabilitiesIfNecessary

        public DefaultTrackSelector.ParametersBuilder setExceedRendererCapabilitiesIfNecessary​(boolean exceedRendererCapabilitiesIfNecessary)
        Sets whether to exceed renderer capabilities when no selection can be made otherwise.

        This parameter applies when all of the tracks available for a renderer exceed the renderer's reported capabilities. If the parameter is true then the lowest quality track will still be selected. Playback may succeed if the renderer has under-reported its true capabilities. If false then no track will be selected.

        Parameters:
        exceedRendererCapabilitiesIfNecessary - Whether to exceed renderer capabilities when no selection can be made otherwise.
        Returns:
        This builder.
      • setTunnelingEnabled

        public DefaultTrackSelector.ParametersBuilder setTunnelingEnabled​(boolean tunnelingEnabled)
        Sets whether to enable tunneling if possible. Tunneling will only be enabled if it's supported by the audio and video renderers for the selected tracks.
        Parameters:
        tunnelingEnabled - Whether to enable tunneling if possible.
        Returns:
        This builder.
      • setAllowMultipleAdaptiveSelections

        public DefaultTrackSelector.ParametersBuilder setAllowMultipleAdaptiveSelections​(boolean allowMultipleAdaptiveSelections)
        Sets whether multiple adaptive selections with more than one track are allowed.
        Parameters:
        allowMultipleAdaptiveSelections - Whether multiple adaptive selections are allowed.
        Returns:
        This builder.
      • setRendererDisabled

        public final DefaultTrackSelector.ParametersBuilder setRendererDisabled​(int rendererIndex,
                                                                                boolean disabled)
        Sets whether the renderer at the specified index is disabled. Disabling a renderer prevents the selector from selecting any tracks for it.
        Parameters:
        rendererIndex - The renderer index.
        disabled - Whether the renderer is disabled.
        Returns:
        This builder.
      • clearSelectionOverrides

        public final DefaultTrackSelector.ParametersBuilder clearSelectionOverrides​(int rendererIndex)
        Clears all track selection overrides for the specified renderer.
        Parameters:
        rendererIndex - The renderer index.
        Returns:
        This builder.