Viewport size
To test this feature and view the example code, please see the (5.33.x) Android SDK 5 Example Code Quick Start guide.
When playing high-quality streams, the CONNECT player checks the viewport dimensions (provided by the application) to determine the available resolution tracks in its adaptive streaming algorithm. If the stream offers both HD and 4K resolution tracks, and the player detects that the display cannot provide 4K, the 4K track will be excluded from the available tracks to consider.
On Android 11 or earlier versions, the system does not support UI rendering in 4K resolution, and the player's adaptive streaming algorithm might not select the highest resolutions offered. The application can override this behaviour by overriding the viewport dimensions in the player configuration before playback starts. To force this change on older devices, follow the steps below and look through the viewport example provided.
Example code
The Java source code in the Viewport example code demonstrates how to use the OTVPlayerConfiguration
builder to enable 4K on older devices.
OTVPlayerConfiguration.Builder configurationBuilder = new OTVPlayerConfiguration.Builder();
Pair<Integer, Integer> viewportSize = new Pair<>(3840, 2160);
// The viewport size should be decided automatically in normal case by SDK.
// Setting viewport size is not recommended.
// Value Integer.MAX_VALUE for viewport height and width means
// without any limits for the viewport size.
if (viewportSize != null) {
configurationBuilder.setViewportWidth(viewportSize.first)
.setViewportHeight(viewportSize.second)
.setViewportOrientationChange(true);
}
// The player configuration has to be set before set video path
mOTVVideoView.setPlayerConfiguration(configurationBuilder.build());
mOTVVideoView.setVideoPath(STREAM_URI);
mOTVVideoView.start();