OTVVideoView resolution and bitrate overrides
The three OTVPlayerConfiguration
methods setMaxVideoWidth()
, setMaxVideoHeight()
, and setMaxVideoBitrate()
only take effect when they are invoked before player set source, e.g., setVideoPath/setVideoUri
.
If OTVVideoView
equivalent methods (setMaxResolution()
, setMaxBandwidth()
) are called after player set source, player will use the values from the OTVVideoView
methods.
If both OTVPlayerConfiguration
and OTVVideoView
methods are called before player set source, OTVPlayerConfiguration
methods may be overridden by OTVVideoView
setMaxResolution()
and setMaxBandwidth()
methods.
Generally, you should only use one “sets” API to control the video resolution or bandwidth.
The following examples provide a clear demonstration when both APIs are called before player set source.
Case 1: when the OTVVideoView
method is called with valid values for width and height, that will override the OTVPlayerConfiguration
methods setMaxVideoWidth
, setMaxVideoHeight
.
setMaxResolution()
values are both valid. The player's maximum video resolution will be 1920 x 1080.
otvVideoView.setMaxResolution(1920, 1080);
OTVPlayerConfiguration.Builder configBuilder = new OTVPlayerConfiguration.Builder();
configBuilder.setMaxVideoWidth(1280); // overridden by 1920
configBuilder.setMaxVideoHeight(720); // overridden by 1080
Case 2: when the OTVVideoView
method is called with invalid values for both width and height, such as a zero or negative value, player will use the values from OTVPlayerConfiguration
.
setMaxResolution()
values are not valid (0 or negative). The player's maximum video resolution will be 1280 x 720.
otvVideoView.setMaxResolution(0, -1080);
OTVPlayerConfiguration.Builder configBuilder = new OTVPlayerConfiguration.Builder();
configBuilder.setMaxVideoWidth(1280); // Used - because 0 width is invalid
configBuilder.setMaxVideoHeight(720); // Used - because a negative height is not valid
Case 3: when the OTVVideoView
method is called with one invalid value for width or height, such as a zero or negative value for width or height, player will use the valid value from setMaxResolution
and OTVPlayerConfiguration
value to override the invalid value from setMaxResolution.
setMaxResolution()
width is valid, but the height is not. The player's maximum video resolution will be 1920 x 720.
otvVideoView.setMaxResolution(1920, 0); // 1920 is a valid width, but 0 is not a valid height
OTVPlayerConfiguration.Builder configBuilder = new OTVPlayerConfiguration.Builder();
configBuilder.setMaxVideoWidth(1280); // Not used - overridden by 1920
configBuilder.setMaxVideoHeight(720); // Used - 0 is not a valid height to override this