Builder


class Builder
kotlin.Any
   ↳ android.view.Surface.FrameRateParams.Builder

Summary

Public constructors

Public methods
Surface.FrameRateParams

Builds the FrameRateParams object.

Surface.FrameRateParams.Builder
setChangeFrameRateStrategy(changeFrameRateStrategy: Int)

Whether display refresh rate transitions caused by this surface should be seamless.

Surface.FrameRateParams.Builder
setDesiredRateRange(desiredMinRate: Float, desiredMaxRate: Float)

Sets the desired frame rate range (inclusive) values for the surface, specifying that the surface prefers the device render rate to be in the range [desiredMinRate, desiredMaxRate].

Surface.FrameRateParams.Builder
setFixedSourceRate(fixedSourceRate: Float)

Sets the fixed frame rate of the surface when its content has a fixed frame rate, e.

Public constructors

Builder

Builder()

Public methods

build

fun build(): Surface.FrameRateParams

Builds the FrameRateParams object.

Return
Surface.FrameRateParams This value cannot be null.

setChangeFrameRateStrategy

fun setChangeFrameRateStrategy(changeFrameRateStrategy: Int): Surface.FrameRateParams.Builder

Whether display refresh rate transitions caused by this surface should be seamless. A seamless transition is one that doesn't have any visual interruptions, such as a black screen for a second or two. Value is Surface.CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS, or Surface.CHANGE_FRAME_RATE_ALWAYS

Parameters
changeFrameRateStrategy Int: Value is android.view.Surface#CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS, or android.view.Surface#CHANGE_FRAME_RATE_ALWAYS
Return
Surface.FrameRateParams.Builder This value cannot be null.

setDesiredRateRange

fun setDesiredRateRange(
    desiredMinRate: Float,
    desiredMaxRate: Float
): Surface.FrameRateParams.Builder

Sets the desired frame rate range (inclusive) values for the surface, specifying that the surface prefers the device render rate to be in the range [desiredMinRate, desiredMaxRate]. Set desiredMaxRate to FLOAT.MAX_VALUE to indicate the surface prefers any value greater than or equal to desiredMinRate. Set desiredMinRate = desiredMaxRate to indicate the surface prefers an exact frame rate. Note that this is different than specifying the fixed source frame rate with FrameRateParams.Builder#setFixedSourceRate. To reiterate, this call is used to specify the surface's frame rate preference to be within the desired range. desiredMaxRate must be greater than or equal to desiredMinRate. The values should be greater than or equal to 0. If the surface has no preference and any frame rate is acceptable, use the constant FrameRateParams.IGNORE in setFrameRate(android.view.Surface.FrameRateParams) instead of building FrameRateParams.Builder.

Parameters
desiredMinRate Float: Value is 0.0 or greater
desiredMaxRate Float: Value is 0.0 or greater
Return
Surface.FrameRateParams.Builder This value cannot be null.

setFixedSourceRate

fun setFixedSourceRate(fixedSourceRate: Float): Surface.FrameRateParams.Builder

Sets the fixed frame rate of the surface when its content has a fixed frame rate, e.g. a video with a fixed frame rate. When the frame rate chosen for the surface is the fixedSourceRate or a multiple, the surface can render without frame pulldown, for optimal smoothness. For example, a 30 fps video (fixedSourceRate=30) renders just as well on 30 fps, 60 fps, 90 fps, 120 fps, and so on. This method to set the fixed source rate can also be used together with a desired frame rate range via FrameRateParams.Builder#setDesiredRateRange. This still means the surface's content has a fixed frame rate of the provided fixedSourceRate, as well as it preferring to be within the desired frame rate range. For example, a 30 fps video fixedSourceRate=30 and desired frame rate range [60,90] means the surface ideally prefers 60 fps (which is 30 fps * 2) or 90 fps (30 fps * 3).

Parameters
fixedSourceRate Float: Value is 0.0 or greater
Return
Surface.FrameRateParams.Builder This value cannot be null.