This topic describes the key parameters of the audio and video call API for Android.
Parameter | Description |
|---|---|
CreateRoomParams | Creates a room. |
JoinRoomParams | Joins a room. |
PublishConfig | Publishes a media stream. |
UnpublishConfig | Unsubscribe. |
SubscribeConfig | Subscribes to a media stream. |
UnsubscribeConfig | Unsubscribes from a media stream. |
LocalVideoInfo | Information about the local video stream. Use this to pause or resume pushing the local video stream. |
RemoteVideoInfo | Information about a remote video stream. Use this to pause or resume rendering the remote video stream. |
LocalAudioInfo | Information about the local audio stream. Use this to pause or resume pushing the local audio stream. |
RemoteAudioInfo | Information about a remote audio stream. Use this to pause or resume playback of the remote audio. |
ParticipantInfo | User information for a video call participant. Use this for user operations such as subscribing and publishing. |
RoomInfo | Information about the room returned after creation. |
PublishEventCode | Event code information returned for publish-related operations. |
FeedInfo | Information about a subscribable stream. |
SubscribeEventCode | Event code information returned for subscribe-related operations. |
Logger | Lets you provide a custom log to output software development kit (SDK) logs to your application's log location. |
ErrorCode | Error code. |
CreateRoomParams
Specifies the parameters for creating an audio and video room. You must configure these parameters correctly to create the room.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
uid | String | The user ID. Note The uid can contain only letters, digits, and underscores (_). The length cannot exceed 128 characters. | None | Yes |
bizName | String | The business name. You must request this from the service provider (SP). | None | Yes |
signature | String | The business signature. | None | Yes |
extraInfo | String | Extra business-related information. | null | No |
JoinRoomParams
Specifies the parameters for joining a room. To join the audio and video room specified by `roomId`, you must configure these parameters correctly.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
uid | String | The user ID. | None | Yes |
bizName | String | The business name. You must request this from the SP. | None | Yes |
roomId | String | The room ID. | None | Yes |
rtoken | String | The token required to join the room. | None | Yes |
signature | String | The business signature. | None | Yes |
envType | int | The service provider type. Supported values are `alipay` and `aliyun`. Set the value to `0` for alipay (default) or `1` for aliyun. | 0 | No |
PublishConfig
Specifies the parameters for the media stream to publish, including audio and video.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
videoSource | PublishVideoSource | The video source of the media stream to be published. Default: `VIDEO_SOURCE_CAMERA`. | None | No |
videoProfile | VideoProfile | The video property configuration. Default: `PROFILE_360_640P_15`. | PROFILE_540_960P_15 | No |
audioSource | PublishAudioSource | The audio source of the media stream to be published. Default: `AUDIO_SOURCE_MIC`. | None | No |
videoCustomWidth | int | The custom width of the video output. This parameter takes effect only when `videoProfile` is set to `PROFILE_CUSTOM`. | None | No |
VideoCustomHeight | int | The custom height of the video output. This parameter takes effect only when `videoProfile` is set to `PROFILE_CUSTOM`. | None | No |
videoCustomFps | int | The custom frames per second (fps) of the video output. This parameter takes effect only when `videoProfile` is set to `PROFILE_CUSTOM`. | None | No |
videoCustomMaxBitrate | int | The maximum bitrate of the custom video output. This is the maximum bitrate for custom video encoding. If the input value is greater than this value, MRTC drops frames or reduces the definition based on the local push mode (Low Definition Priority, Resolution Priority, or Balanced). This parameter takes effect only when `videoProfile` is set to `PROFILE_CUSTOM`. | None | No |
videoCustomMinBitrate | int | Reserved parameter. This parameter is not in use. The minimum bitrate of the custom video output. This parameter takes effect only when `videoProfile` is set to `PROFILE_CUSTOM`. | None | No |
enum PublishVideoSource {
VIDEO_SOURCE_CAMERA, // The video source is the camera.
VIDEO_SOURCE_SCREEN, // The video source is screen sharing.
VIDEO_SOURCE_CUSTOM, // The video source is custom data.
VIDEO_SOURCE_NULL // Disables video output.
}
enum VideoProfile {
PROFILE_360_640P_15, // Resolution: 360 * 640, frame rate: 15.
PROFILE_360_640P_30, // Resolution: 360 * 640, frame rate: 30.
PROFILE_540_960P_15, // Resolution: 540 * 960, frame rate: 15.
PROFILE_540_960P_30, // Resolution: 540 * 960, frame rate: 30.
PROFILE_720_1280P_15, // Resolution: 720 * 1280, frame rate: 15.
PROFILE_720_1280P_30, // Resolution: 720 * 1280, frame rate: 30.
PROFILE_1080_1920P_15, // Resolution: 1080 * 1920, frame rate: 15.
PROFILE_1080_1920P_30, // Resolution: 1080 * 1920, frame rate: 30.
PROFILED_EFAULT, // Default. Resolution: 360 * 640, frame rate: 15.
PROFILE_CUSTOM // Custom mode. Set custom video properties.
}
enum PublishAudioSource {
AUDIO_SOURCE_MIC, // The audio source is the microphone.
AUDIO_SOURCE_NULL // Disables audio output.
}UnpublishConfig
Unsubscribe: Unpublish the media streams.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
videoSource | PublishVideoSource | The video source of the media stream to unpublish. Default: `VIDEO_SOURCE_CAMERA`. | None | No |
audioSource | PublishAudioSource | The audio source of the media stream to unpublish. Default: `AUDIO_SOURCE_MIC`. | None | No |
SubscribeConfig
Specifies the parameters for the media stream to subscribe to.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
info | FeedInfo | The information about the stream to subscribe to. This includes the `uid`, `feedId`, and `tag`. | None | Yes |
UnsubscribeConfig
Specifies the parameters for the media stream to unsubscribe from.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
info | FeedInfo | The stream to subscribe to, including its uid, feedId, and tag. | None | Yes |
LocalVideoInfo
Contains information about the local video stream, including the video source. Use this to pause or resume pushing the local video stream.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
videoSource | PublishVideoSource | Information about the local media stream's video source. Default: `VIDEO_SOURCE_CAMERA`. | None | No |
RemoteVideoInfo
Contains information about a remote video stream. Use this to pause or resume rendering the remote video stream.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
feedId | String | The ID of the remote media stream. | None | Yes |
LocalAudioInfo
Contains information about the local audio stream, including the audio source. Use this to pause or resume pushing the local audio stream.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
audioSource | PublishAudioSource | Information about the local audio source. Default: `AUDIO_SOURCE_MIC`. | None | No |
RemoteAudioInfo
Contains information about a remote audio stream. Use this to pause or resume playback of the remote audio stream.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
feedId | String | The ID of the remote media stream. | None | Yes |
FeedInfo
Contains information about a subscribable stream. This includes the `uid` of the user who owns the stream, the `feedId` of the stream, and the `tag`, which is an additional property of the stream.
Property | Type | Description | Recommended value | Required |
|---|---|---|---|---|
uid | String | The ID of the user who owns the subscribable stream. | None | Yes |
feedId | String | The ID of the subscribable stream. | None | Yes |
tag | String | An extra property of the subscribable stream. It is currently the string representation of `PublishVideoSource`. | None | No |
ParticipantInfo
Contains information about a participant in a video call. This information is used for user operations, such as subscribing to and publishing streams. It includes the user ID and information about the streams that the user has published and subscribed to.
Property | Type | Description |
|---|---|---|
uid | String | The user's uid. |
feedList | List | Information about the streams pushed by the user. A user can push multiple streams for other users to subscribe to. |
subscribeIdList | List | Information about the streams subscribed to by the user. A user can subscribe to multiple streams. |
RoomInfo
Contains information about a room, which is returned after the room is created. Use this information to join the room for an audio and video call.
Property | Type | Description |
|---|---|---|
roomId | String | The room ID. |
rtoken | String | The token for the room. |
PublishEventCode
Contains the event code that is returned for publish-related operations, such as publishing or unpublishing a stream.
Property | Description |
|---|---|
PUBLISH_START | The publish operation is valid. The server accepts the publish request, and the local client prepares resources for publishing. |
PUBLISH_SUCCESS | The publish operation is successful. The media stream is successfully pushed to the server. |
PUBLISH_FAIL | The publish operation failed. This may be because the media stream failed to be obtained or pushed. |
PUBLISH_DISCONNECT | Publishing is disconnected. An error occurred while pushing the media stream, and the connection to the server was lost. |
UNPUBLISH_SUCCESS | Unpublishing is successful. |
UNPUBLISH_FAIL | Unpublishing failed. This may be due to incorrect parameters or a server error. |
SubscribeEventCode
Contains the event code that is returned for subscribe-related operations, such as subscribing to or unsubscribing from a stream.
Property | Description |
|---|---|
SUBSCRIBE_START | The subscribe operation is valid. The server accepts the subscribe request, and the local client prepares for stream pulling. |
SUBSCRIBE_SUCCESS | The subscribe operation is successful. The media stream is successfully pulled from the server to the local client. |
SUBSCRIBE_FAIL | The subscribe operation failed. This may be due to incorrect parameters or a server error. |
SUBSCRIBE_DISCONNECT | Subscribing is disconnected. An error occurred while pulling the media stream, and the connection to the server was lost. |
UNSUBSCRIBE_SUCCESS | Unsubscribing is successful. |
UNSUBSCRIBE_FAIL | Unsubscribing failed. This may be due to incorrect parameters or a server error. |
Logger
Provides a custom log to output Software Development Kit (SDK) logs to your application's log location. You can implement the `Logger` interface and then use `setLogger` to set it in the SDK.
interface Logger {
int v(String tag, String msg);
int d(String tag, String msg);
int i(String tag, String msg);
int w(String tag, String msg);
int e(String tag, String msg);
int e(String tag, String msg, Throwable tr);
}Error codes
The following table describes the error codes.
Error | Error code | Description |
|---|---|---|
ERROR_NULL | 0 | No error. |
ERROR_CREATE_ROOM | -115 | Failed to create the room. The parameters may be null or fail server-side validation. Check that the parameters are configured correctly and try again. A server-side internal error may have also occurred, but this is rare. If a server-side internal error occurs, contact the SP. |
ERROR_JOIN_ROOM | -116 | Failed to join the room. The parameters may be null or fail server-side validation. Check that the parameters are configured correctly and try again. A server-side internal error may have also occurred, but this is rare. If a server-side internal error occurs, contact the SP. |
ERROR_LEAVE_ROOM | -1002 | Failed to leave the room. You may not be in the room, or the server validation failed. All published and subscribed streams are released regardless of whether you successfully leave the room. |
ERROR_INVITE_TO_JOIN_ROOM | -1003 | Failed to invite the user to join the room. The parameters may be null or fail server-side validation. |
ERROR_NETWORK | -1004 | Network error. Cannot connect to the server. Operations such as publishing and subscribing cannot be performed. |
ERROR_CAMERA_PERMISSION | -104 | Failed to open the camera preview. The camera is not properly authorized. |
ERROR_MIC_PERMISSION | -105 | The camera preview could not be opened due to a lack of microphone permissions. |
ERROR_OPEN_CAMERA | -1007 | Failed to open the camera preview. The camera cannot be opened. |
ERROR_OPEN_MIC | -1008 | The camera preview failed to open, and the microphone failed to work correctly. |