Agora Java API Reference for Android

Public Member Functions | List of all members
io.agora.rtc2.PublisherConfiguration.Builder Class Reference

## Public Member Functions
Builder | owner (boolean isRoomOwner)
Builder | streamLifeCycle (int lifecycle)
Builder | size (int width, int height)
Builder | frameRate (int framerate)
Builder | bitRate (int bitrate)
Builder | defaultLayout (int layoutStyle)
Builder | publishUrl (String url)
Builder | rawStreamUrl (String url)
Builder | injectStream (String url, int width, int height)
Builder | extraInfo (String optionalInfo)
PublisherConfiguration | build ()

## Detailed Description

Builder class.

Deprecated:

If you want to configure the push-stream, Agora recommends using the {setLiveTranscoding} method.

## Member Function Documentation

## ◆ owner()

Builder io.agora.rtc2.PublisherConfiguration.Builder.owner | ( | boolean | isRoomOwner | ) |

Sets the RTMP stream owner.

In the Builder Class, this method sets whether the current host is the RTMP stream owner.

Parameters

  isRoomOwner | True: Yes (default), push-stream configuration. False: No push-stream configuration.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ streamLifeCycle()

Builder io.agora.rtc2.PublisherConfiguration.Builder.streamLifeCycle | ( | int | lifecycle | ) |

CDN push stream life cycle

You can choose:

- Bind to channel (STREAM_LIFE_CYCLE_BIND2CHANNEL) or
- Bind to room owner (STREAM_LIFE_CYCLE_BIND2OWNER).

## ◆ size()

Builder io.agora.rtc2.PublisherConfiguration.Builder.size | ( | int | width,
|  | int | height
| ) |  |

Sets the stream resolution.

In the Builder Class, this method sets the resolution of the output data stream set for CDN Live.

Parameters

  width | Width of the output data stream set for CDN Live. 360 is the default value.
  height | Height of the output data stream set for CDN Live. 640 is the default value.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ frameRate()

Builder io.agora.rtc2.PublisherConfiguration.Builder.frameRate | ( | int | framerate | ) |

Sets the stream's frame rate.

In the Builder class, this method sets the frame rate of the output data stream set for CDN Live.

Parameters

  framerate | Frame rate of the output data stream set for CDN Live. 15 fps is the default value.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ bitRate()

Builder io.agora.rtc2.PublisherConfiguration.Builder.bitRate | ( | int | bitrate | ) |

Sets the stream's bitrate.

In the Builder class, this method sets the bitrate of the output data stream set for CDN Live.

Parameters

  bitrate | Bitrate of the output data stream set for CDN Live. 500 kbit/s is the default value.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ defaultLayout()

Builder io.agora.rtc2.PublisherConfiguration.Builder.defaultLayout | ( | int | layoutStyle | ) |

Sets the default layout.

    <p>In the Builder class, this method sets the default layout if you do not use flexible

adjustment.

    @param layoutStyle <ul><li>0: Tile horizontally

1: Layered windows 2: Tile vertically

Returns
  - 0: Success.
  - <0: Failure.

## ◆ publishUrl()

Builder io.agora.rtc2.PublisherConfiguration.Builder.publishUrl | ( | String | url | ) |

Sets the publishing URL.

In the Builder class, this method configures the push-stream address for the picture-in-picture layouts.

Parameters

  url | Configures the push-stream address for the picture-in-picture layouts. The default value is NULL.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ rawStreamUrl()

Builder io.agora.rtc2.PublisherConfiguration.Builder.rawStreamUrl | ( | String | url | ) |

Sets the raw stream URL.

In the Builder class, this method sets the push-stream address of the original stream which does not require picture-blending.

Parameters

  url | Push-stream address of the original stream. The default value is NULL.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ injectStream()

Builder io.agora.rtc2.PublisherConfiguration.Builder.injectStream | ( | String | url,
|  | int | width,
|  | int | height
| ) |  |

Sets the inject stream.

In the Builder class, this method injects a stream to the current channel.

Parameters

  url | URL address of the stream to be injected to the channel.
  width | Width of the stream. N/A, set as 0.
  height | Height of the stream. N/A, set as 0.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ extraInfo()

Builder io.agora.rtc2.PublisherConfiguration.Builder.extraInfo | ( | String | optionalInfo | ) |

Adds extra information.

Parameters

  optionalInfo | Reserved Field. The default value is NULL.

Returns
  - 0: Success.
  - <0: Failure.