Caller APIs are interfaces that are actively called by your service. These APIs are encapsulated in the ArtvcRoom class.
Currently, a UID can only contain letters, numbers, and underscores. The length of the UID cannot exceed 128 characters.
Connect
Establishes a call connection.
Parameters:
Request parameter
Value
Type
Description
config (JSON)
uid
String
User ID.
biz_name
String
Service identifier.
appId
String
Service identifier.
workspaceId
String
Service identifier.
server_url
String
The address of the channel server.
Asynchronous callbacks:
OnConnect(data)
OnError(data)
CreateRoom
Creates a call channel.
Parameters:
Request parameter
Value
Type
Description
config (JSON)
roomId
String
Channel number.
rtoken
String
Channel password.
Asynchronous callbacks:
OnCreateRoom(data)
OnError(data)
JoinRoom
Joins a call channel.
Parameters:
Request parameter
Value
Type
Description
config (JSON)
roomId
String
Channel number.
rtoken
String
Channel password.
Asynchronous callbacks:
OnJoinRoom(data)
OnError(data)
Publish
Publishes call information.
Parameters:
Request parameter
Value
Type
Description
config (JSON)
resolution
String
Resolution.
fps
int
Frame rate.
maxBitrate
int
Maximum bitrate.
tag
String
Custom ID.
Asynchronous callbacks:
OnPublish(data)
OnError(data)
Subscribe
Subscribes to call information.
Parameters: None.
Asynchronous callbacks:
OnSubscribe(data)
OnError(data)
LeaveRoom
Leaves a call channel.
Parameters: None.
Asynchronous callbacks:
OnLeaveRoom(data)
OnError(data)
Disconnect
Disconnects a call.
Parameters: None.
SendTxtMessage
Sends a text message.
Parameters:
Request parameter | Value | Type | Description |
config (JSON) | uids | list | The UIDs of all users who will receive the message. |
timestamp | number | Timestamp. | |
msg | String | The content of the text message. |
ReportClientEvents
The logic for this API is included in the demo. Because the events are UI-related, this logic resides in the service UI layer. You can copy the reporting logic to your project to facilitate troubleshooting and feature extensions.
Reports status codes related to call events. The request parameter is `code`, and its data type is `int`.
Parameters:
Request parameter | Type | Description |
code | int | Event type: 301: { desc:"ACTIVITY_PAUSE" } // The miniapp is running in the background. 302: { desc:"ACTIVITY_RESUME" } // The miniapp returns to the foreground. 321: { desc:"DISABLE_LOCAL_VIDEO" } // The local camera is turned off. 322: { desc:"ENABLE_LOCAL_VIDEO" } // The local camera is turned on. 323: { desc:"DISABLE_LOCAL_AUDIO" } // The local microphone is turned off. 324: { desc:"ENABLE_LOCAL_AUDIO" } // The local microphone is turned on. 329: { desc:"CHANGE_TO_EARPIECE" } // Switched to earpiece. 330: { desc:"CHANGE_TO_SPEAKER_PHONE" } // Switched to speakerphone. 363: { desc:"ERROR_CAMERA_PERMISSION" } // Camera permission error. 364: { desc:"ERROR_MIC_PERMISSION" } // Microphone permission error. 366: { desc:"ERROR_OPEN_CAMERA" } // Failed to open the camera (-1007). 367: { desc:"ERROR_OPEN_MIC" } // Failed to open the microphone or microphone capture is abnormal. 503: { desc:"VIDEO_FIRST_FRAME", extra:true } // Subscribed to the first video frame. |
extra | Object | Carries additional information for event types that include the `extra` field. |
SendInvite
Invite
This feature requires the invitee to be online.
Request parameter | Type | Description |
uid | string |
|
Asynchronous callbacks:
OnInviteSucc()
OnInviteFail(code,msg)
ReplyInviteToJoinRoom
Replies to an invitation.
Request parameter | Type | Description |
roomId | The ID of the channel to join. | |
inviter | The UID of the user who sent the invitation. | |
join | int | 0: Accept 2: Reject |
inviteId | The ID of the invitation. | |
inviteInfo | Whether the inviter's video and audio are enabled. |
Asynchronous callbacks:
OnReplyInviteOK()
OnReplyInviteFail(code,msg)