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()
setDefaultRequestProperties()

Live

setLiveTargetOffsetMs()
setLiveMinOffsetMs()
setLiveMaxOffsetMs()
setLiveMinPlaybackSpeed()
setLiveMaxPlaybackSpeed()
setMinUpdateIntervalMs()
setProportionalControlFactor()
setMaxLiveOffsetErrorMsForUnitSpeed()
setTargetLiveOffsetIncrementOnRebufferMs()
setMinPossibleLiveOffsetSmoothingFactor()

DASH live start

setLivePresentationDelayMs()
setLivePresentationDelayOverridesManifest()

HLS live start

setStartSegmentIndex()

Track selection

setMinVideoWidth()
setMaxVideoWidth()
setMinVideoHeight()
setMaxVideoHeight()
setMinVideoFrameRate()
setMaxVideoFrameRate()
setMinVideoBitrate()
setMaxVideoBitrate()
setMaxAudioChannelCount()
setMaxAudioBitrate()
setExceedAudioConstraintsIfNecessary() setConstrainAudioChannelCountToDeviceCapabilities()
setAllowAudioMixedMimeTypeAdaptiveness()
setAllowAudioMixedSampleRateAdaptiveness()
setAllowAudioMixedChannelCountAdaptiveness()
setTunnelingEnabled()
setAutoVideoTrackSwitch()
setVideoTrackLabel()
setPreferredVideoTrack()
setPreferredAudioLanguage()
setPreferredTextLanguage()
setAllowAudioMixedDecoderSupportAdaptiveness()
setAllowAudioNonSeamlessAdaptiveness()
setExceedRendererCapabilitiesIfNecessary()
setAllowMultipleAdaptiveSelections()
setAllowVideoMixedMimeTypeAdaptiveness()
setAllowVideoNonSeamlessAdaptiveness()
setPreferredAudioMimeType()
setPreferredVideoMimeType()
setTrackTypeDisabled()
setForceLowestBitrate()
setForceHighestSupportedBitrate()

Buffering control

setMinBufferMs()
setMaxBufferMs()
setBufferForPlaybackMs()
setBufferForPlaybackAfterRebufferMs()
setTargetBufferBytes()
setPrioritizeTimeOverSizeThresholds()
setBackBuffer()
setRetainBackBufferFromKeyframe()

Miscellaneous configuration

setOverrideKeepScreenOn()
setThumbnailsPerMinute()
setKeepThumbnailsSpaced()
setThumbnailsMaximumMemory()
setDisableLoadingIFrameOnlyTracks()
setViewportWidth()
setViewportHeight()
setViewportOrientationChange()
setHandleAudioBecomingNoisy()
setHandleAudioFocus()
setUsePlatformDiagnostics()
setUseLazyPreparation()
setOverrideKeepScreenOn()
setNetworkTransportTypes()
setVideoChangeFrameRateStrategy()
setSeekParameters()
setReleaseTimeoutMs()
setAudioAttributes()

Rendering Configuration

setAsynchronousMode()
setEnableDecoderFallback()
setEnableAudioFloatOutput()
setAllowedVideoJoiningTimeMs()
setEnableAudioTrackPlaybackParams()
setPlaybackParameters()
setExperimentalSynchronizeCodecInteractionsWithQueueingEnabled()

Bandwidth Meter

setInitialBitrateEstimate()
setResetOnNetworkTypeChange()

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);
// set Seek parameters
configBuilder.setSeekParameters(SEEK_EXACT);
// set initial bandwidth estimation
configBuilder.setInitialBitrateEstimate(1500000);

// 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.