Skip to main content
Skip table of contents

Advanced player configuration

The CONNECT Player SDK 5 can be configured with several settings before playback using the OTVPlayerConfiguration class. These settings range from the basic - for example, setting minimum and maximum video resolution -  to advanced settings that have a more subtle effect on user experience, such as setting the minimum duration of buffered data required before the player can switch to a higher quality video track.

Each setting in OTVPlayerConfiguration is optional, with player defaults used for unchanged ones. For example, if no maximum bitrate is set, its default is Integer.MAX_VALUE which is effectively unlimited.

The OTVPlayerConfiguration is created using the OTVPlayerConfiguration.Builder() object whose values are set before it is used to construct the OTVPlayerConfiguration object. The configuration object is then passed to the OTVVideoView using the OTVVideoView#setPlayerConfiguration() method.

The builder's configuration setting methods can be broken down into the following categories:

Adaptive bitrate selection

setInitialAbrStrategy()
setMinDurationForQualityIncreaseMs()
setMaxDurationForQualityDecreaseMs()
setMinDurationToRetainAfterDiscardMs()
setBandwidthFraction()
setBufferedFractionToLiveEdgeForQualityIncrease()

HTTP data source

setConnectTimeoutMillis()
setReadTimeoutMillis()
setAllowCrossProtocolRedirects()
setMinimumLoadableRetryCount()

DASH live start

setLivePresentationDelayMs()
setLivePresentationDelayOverridesManifest()

HLS live start

setStartSegmentIndex()

Track selection

setMinVideoWidth()
setMaxVideoWidth()
setMinVideoHeight()
setMaxVideoHeight()
setMinVideoFrameRate()
setMaxVideoFrameRate()
setMinVideoBitrate()
setMaxVideoBitrate()
setMaxAudioChannelCount()
setMaxAudioBitrate()
setExceedAudioConstraintsIfNecessary()
setAllowAudioMixedMimeTypeAdaptiveness()
setAllowAudioMixedSampleRateAdaptiveness()
setAllowAudioMixedChannelCountAdaptiveness()
setTunnelingEnabled()

Buffering

setMinBufferMs()
setMaxBufferMs()
setBufferForPlaybackMs()
setBufferForPlaybackAfterRebufferMs()

Miscellaneous configuration

setOverrideKeepScreenOn()
setThumbnailsPerMinute()
setKeepThumbnailsSpaced()
setDisableLoadingIFrameOnlyTracks()

Example code

Click here to see a selection of configuration settings covering different aspects of player behaviour.
JAVA
OTVPlayerConfiguration.Builder configBuilder = new OTVPlayerConfiguration.Builder();

// Adaptive bitrate selection
configBuilder.setInitialAbrStrategy(INITIAL_ABR_STRATEGY_PERFORMANCE);
configBuilder.setMinDurationForQualityIncreaseMs(5000);
configBuilder.setBandwidthFraction(0.75f);
// HTTP data source
configBuilder.setConnectTimeoutMillis(2000);
// Audio
configBuilder.setMaxAudioChannelCount(6);
// Video
configBuilder.setMaxVideoWidth(1920);
configBuilder.setMaxVideoHeight(1080);
// Buffer
configBuilder.setMinBufferMs(30000);
// Override KeepScreenOn
configBuilder.setOverrideKeepScreenOn(true);

// Player configuration is built and passed to an OTVVideoView instance prior to playback
OTVPlayerConfiguration config = configBuilder.build();
videoView.setPlayerConfiguration(config);
videoView.setVideoPath(streamUrl);
videoView.start();

The OTVPlayerConfiguration object is then built and passed to the OTVVideoView, where it will take effect when playback starts.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.