Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal
Developer Documentation moved on August 7, 2026. Future updates are available only at → https://developer.vonage.com/en/opentok/overview

Publisher Max Bitrate

This topic includes details on setting the maximum video bitrate using the Vonage Video Android client SDK:

For an overview of the publisher maximum bitrate API, see this topic.

Setting and retrieving a preset

The PublisherKit .VideoBitratePreset enum includes preset values:

See Video bitrate presets for details on these presets.

To retrieve the currently configured video bitrate preset for a given publisher, call the PublisherKit.getVideoBitratePreset() method:

PublisherKit.VideoBitratePreset retrievedBitratePreset = publisherKit.getVideoBitratePreset();
System.out.println("The video bitrate preset is: " + retrievedBitratePreset);

To set a preset, call the PublisherKit.setVideoBitratePreset() method. This method includes one parameter: preset — a value from the VideoBitratePreset enum. Do not use VideoBitratePresetCustom.

Example:

PublisherKit.VideoBitratePreset bitratePreset = PublisherKit.VideoBitratePreset.VideoBitratePresetBwSaver;
publisherKit.setVideoBitratePreset(bitratePreset);

Setting and retrieving a raw bitrate value

If the predefined presets are not suitable, you can manually set a custom raw bitrate value.

To get the maximum video bitrate currently set for a publisher, call the PublisherKit.getMaxVideoBitrate() method. This returns the currently set maximum bitrate (in bits per second). If no custom value is set, the method returns 0.

Example:

int retrievedMaxVideoBitrate = publisherKit.getMaxVideoBitrate();
System.out.println("The maximum video bitrate is: " + retrievedMaxVideoBitrate + " kbps");

To set a custom maximum bitrate value (instead of a preset), use the PublisherKit.setMaxVideoBitrate() method. This method has one parameter: maxVideoBitrate, the desired maximum bitrate (in bits per second). The maxVideoBitrate value must be between 5,000 and 10,000,000.

Example:

int maxVideoBitrate = 300000; // 300 kbps
publisherKit.setMaxVideoBitrate(maxVideoBitrate);

See Setting raw bitrate values for more details.

Special cases

Setting the raw bitrate value to 0 removes any previously set bitrate limitation, reverting to the default behavior.

int zeroBitrate = 0; // No limitations
int newBitrate = 300000; // 300 kbps

// Set the maximum video bitrate
publisherKit.setMaxVideoBitrate(newBitrate);

// Validate that the bitrate was set correctly
if (publisherKit.getMaxVideoBitrate() == newBitrate) {
    System.out.println("Max video bitrate set successfully to: " + newBitrate);
}

// Reset the maximum video bitrate to the default behavior
publisherKit.setMaxVideoBitrate(zeroBitrate);

// Validate that the bitrate was reset to default
if (publisherKit.getMaxVideoBitrate() == zeroBitrate) {
    System.out.println("Max video bitrate reset to default.");
}

Calling the getVideoBitratePreset() method after setting a custom bitrate returns VideoBitratePresetCustom.

int newBitrate = 1000000; // 1 Mbps

// Set a custom bitrate
publisherKit.setMaxVideoBitrate(newBitrate);

// Validate that the preset is set to CUSTOM
if (publisherKit.getVideoBitratePreset() == PublisherKit.VideoBitratePreset.VideoBitratePresetCustom) {
    System.out.println("Video bitrate preset set to CUSTOM.");
}

// Reset bitrate to default
publisherKit.setMaxVideoBitrate(zeroBitrate);

// Validate that the preset is reset to DEFAULT
if (publisherKit.getVideoBitratePreset() == PublisherKit.VideoBitratePreset.VideoBitratePresetDefault) {
    System.out.println("Video bitrate preset reset to DEFAULT.");
}

The PublisherKit.getMaxVideoBitrate() method returns 0 when the publisher is using a preset.

// Get the current raw bitrate (default should be 0)
int bitrateBps = publisherKit.getMaxVideoBitrate();
assert bitrateBps == 0;

// Set the preset to BW_SAVER
publisherKit.setVideoBitratePreset(PublisherKit.VideoBitratePreset.VideoBitratePresetBwSaver);
bitrateBps = publisherKit.getMaxVideoBitrate();
assert bitrateBps == 0;

// Set the preset to EXTRA_BW_SAVER
publisherKit.setVideoBitratePreset(PublisherKit.VideoBitratePreset.VideoBitratePresetExtraBwSaver);
bitrateBps = publisherKit.getMaxVideoBitrate();
assert bitrateBps == 0;

// Set a custom bitrate
publisherKit.setMaxVideoBitrate(200000);
bitrateBps = publisherKit.getMaxVideoBitrate();
assert bitrateBps == 200000;

// Reset the preset to DEFAULT
publisherKit.setVideoBitratePreset(PublisherKit.VideoBitratePreset.VideoBitratePresetDefault);
bitrateBps = publisherKit.getMaxVideoBitrate();
assert bitrateBps == 0;