public class AgoraRtcService
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
AgoraRtcService.AreaCode |
static class |
AgoraRtcService.AudioCodecOption
Configure sdk built-in audio codec
If AUDIO_CODEC_TYPE_OPUS is selected, your PCM data is encoded as OPUS and
then streamed to Agora channel
If AUDIO_CODEC_TYPE_G722 is selected, your PCM data is encoded as G722 and
then streamed to Agora channel
If you provide encoded audio data, such as AAC, instead of raw PCM, please
disable audio codec by selecting AUDIO_CODEC_DISABLED
|
static class |
AgoraRtcService.AudioCodecType
Audio codec type list.
|
static class |
AgoraRtcService.AudioDataType
Audio data type list.
|
static class |
AgoraRtcService.AudioFrameInfo |
static class |
AgoraRtcService.ChannelOptions |
static class |
AgoraRtcService.CloudProxyType |
static class |
AgoraRtcService.ConnectionIdSpecial
special connection id
|
static class |
AgoraRtcService.ConnectionInfo
connection info
|
static class |
AgoraRtcService.CryptoMode
Encryption mode.
|
static class |
AgoraRtcService.CryptoOption
Encryption option
|
static class |
AgoraRtcService.ErrorCode |
static class |
AgoraRtcService.LicenseValidationErrorReason |
static class |
AgoraRtcService.LogConfig |
static class |
AgoraRtcService.LogLevel |
static class |
AgoraRtcService.NetworkEventType |
static class |
AgoraRtcService.RdtState |
static class |
AgoraRtcService.RdtStatusInfo |
static class |
AgoraRtcService.RdtStreamType |
static class |
AgoraRtcService.RtcAudioProcessOption
The definition of the rtc_audio_process_options_t struct.
|
static class |
AgoraRtcService.RtcServiceOptions |
static class |
AgoraRtcService.RtmErrCode |
static class |
AgoraRtcService.UserOfflineReason |
static class |
AgoraRtcService.VideoDataType
Video data type list.
|
static class |
AgoraRtcService.VideoFrameInfo |
static class |
AgoraRtcService.VideoFrameType |
static class |
AgoraRtcService.VideoStreamType |
Constructor and Description |
---|
AgoraRtcService() |
Modifier and Type | Method and Description |
---|---|
int |
configLog(int sizePerFile,
int maxFileCount)
Set the log file configuration.
|
int |
createConnection() |
int |
destroyConnection(int connId) |
java.lang.String |
errToStr(int err)
Converts an error code to a static string.
|
int |
fini()
Release all resource allocated by Agora RTC SDK
init
method. |
int |
getConnectionInfo(int connId,
AgoraRtcService.ConnectionInfo connInfo) |
int |
getRdtStatusInfo(int connId,
int remoteUid,
AgoraRtcService.RdtStatusInfo info)
Get rdt tunnel status info
|
java.lang.String |
getVersion()
Gets version of the SDK.
|
int |
init(java.lang.String appId,
AgoraRtcEvents events,
AgoraRtcService.RtcServiceOptions options)
Initializes the Agora RTSA service.
|
int |
joinChannel(int connId,
java.lang.String channelName,
int uid,
java.lang.String token,
AgoraRtcService.ChannelOptions options) |
int |
leaveChannel(int connId) |
java.lang.String |
licenseGenCredential()
Generate a credential which is a unique device identifier.
|
int |
licenseVerify(java.lang.String certificate,
java.lang.String credential)
Authenticate the SDK licence.
|
int |
loginRtm(java.lang.String rtmUid,
java.lang.String rtmToken,
AgoraRtmEvents events)
Login agora RTM service
|
int |
logoutRtm()
Logout agora RTM service
|
int |
muteLocalAudio(int connId,
boolean mute) |
int |
muteLocalVideo(int connId,
boolean mute) |
int |
muteRemoteAudio(int connId,
int uid,
boolean mute) |
int |
muteRemoteVideo(int connId,
int uid,
boolean mute) |
int |
notifyNetworkEvent(int event)
Set network state
|
int |
renewToken(int connId,
java.lang.String token) |
int |
requestVideoKeyFrame(int connId,
int remoteUid,
int streamType) |
int |
sendAudioData(int connId,
byte[] data,
AgoraRtcService.AudioFrameInfo info) |
int |
sendMediaCtrlMsg(int connId,
int remoteUid,
byte[] payload)
Send an message to all channels OR specific channel.
|
int |
sendRdtMsg(int connId,
int remoteUid,
int type,
byte[] msg)
Send Reliable message to remote uid in channel
|
int |
sendRtm(java.lang.String rtmUid,
byte[] message,
int messageId)
Send data through reliable data channel (RTM)
|
int |
sendVideoData(int connId,
byte[] data,
AgoraRtcService.VideoFrameInfo info) |
int |
setBweParam(int connId,
int miniBps,
int maxBps,
int startBps) |
int |
setCloudProxy(int type)
Set cloud proxy type
|
int |
setFecConfig(int connId,
boolean enable,
int ratio) |
int |
setLogLevel(int level)
Set the log level.
|
int |
setParams(java.lang.String params)
Set config params
|
public java.lang.String getVersion()
public java.lang.String errToStr(int err)
err
- Error code.public java.lang.String licenseGenCredential()
public int licenseVerify(java.lang.String certificate, java.lang.String credential)
certificate
- Certificate stringcredential
- Credential stringpublic int init(java.lang.String appId, AgoraRtcEvents events, AgoraRtcService.RtcServiceOptions options)
appId
- Application IDevents
- A set of callback that handles Agora SDK eventsoptions
- Rtc Service Options, AgoraRtcService#RtcServiceOptions
public int fini()
init
method.public int setLogLevel(int level)
level
- Log level. AgoraRtcService#LogLevel
public int configLog(int sizePerFile, int maxFileCount)
sizePerFile
- Each log file size (bytes). Range is [10000, 1000000]maxFileCount
- Maxium log file count. Range is [1, 100]public int notifyNetworkEvent(int event)
event
- : network event, AgoraRtcService#NetworkEventType
public int createConnection()
public int destroyConnection(int connId)
[in]
- connId : Connection identificationpublic int getConnectionInfo(int connId, AgoraRtcService.ConnectionInfo connInfo)
connId
- : Connection identificationconnInfo
- : Connection infopublic int joinChannel(int connId, java.lang.String channelName, int uid, java.lang.String token, AgoraRtcService.ChannelOptions options)
connId
- : Connection identificationchannel_name
- : Channel name
Length=strlen(channel_name) should be less than 64 bytes
Supported character scopes are:
- The 26 lowercase English letters: a to z
- The 26 uppercase English letters: A to Z
- The 10 numbers: 0 to 9
- The space
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<",
"=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~",
","uid
- : User ID.
A 32-bit unsigned integer with a value ranging from 1 to 2^32-1.
The uid must be unique.
If a uid is set to 0, the SDK assigns and returns a uid in the
on_join_channel_success callback.
Your application must record and maintain the returned uid,
because the SDK does not do so.token
- : Token string generated by the server, length=strlen(token)
Range is [32, 512]
- if token authorization is enabled on developer website, it
should be set correctly
- else token can be set as `NULL`options
- channel options when create channel.
If do not set channel options, set NULLpublic int leaveChannel(int connId)
connId
- : Connection identificationpublic int renewToken(int connId, java.lang.String token)
connId
- Connection identificationtoken
- Token string, strlen(token) Range is [32, 512]public int muteLocalAudio(int connId, boolean mute)
connId
- Connection identification, if set CONNECTION_ID_ALL(0) is
for all connectionsmute
- Toggle sending local audio
- false(0): unmuted
- true (1): mutedpublic int muteLocalVideo(int connId, boolean mute)
connId
- Connection identification, if set CONNECTION_ID_ALL(0) is
for all connectionsmute
- Toggle sending local video
- false(0): unmuted
- true (1): mutedpublic int muteRemoteAudio(int connId, int uid, boolean mute)
connId
- Connection identification, if set CONNECTION_ID_ALL(0) is
for all connectionsuid
- Remote user ID
- if `remote_uid` is set 0, it's for all users
- else it's for specific usermute
- Toggle receiving remote audio
- false(0): unmuted
- true (1): mutedpublic int muteRemoteVideo(int connId, int uid, boolean mute)
connId
- Connection identification, if set CONNECTION_ID_ALL(0) is
for all connectionsuid
- Remote user ID
- if `remote_uid` is set 0, it's for all users
- else it's for specific usermute
- Toggle receiving remote video
- false(0): unmuted
- true (1): mutedpublic int requestVideoKeyFrame(int connId, int remoteUid, int streamType)
connId
- Connection identificationremoteUid
- Remote user ID
- if `remote_uid` is set 0, it's for all users
- else it's for specific userstreamType
- Stream type, ref
#AgoraRtcService.VideoStreamType
public int sendAudioData(int connId, byte[] data, AgoraRtcService.AudioFrameInfo info)
connId
- Connection identificationdata
- Audio frame bufferinfo
- Audio frame info, ref #AgoraRtcService.AudioFrameInfo
public int sendVideoData(int connId, byte[] data, AgoraRtcService.VideoFrameInfo info)
connId
- Connection identificationdata
- Video frame bufferinfo
- Video frame infopublic int setBweParam(int connId, int miniBps, int maxBps, int startBps)
connId
- : Connection identification, if set CONNECTION_ID_ALL(0) is
for all connectionsminiBps
- : bwe min bpsmaxBps
- : bwe max bpsstartBps
- : bwe start bpspublic int setFecConfig(int connId, boolean enable, int ratio)
conn_id
- : Connection identification, if set CONNECTION_ID_ALL(0) is for all connectionsenable
- : enable or disable fec moduleratio
- : fec ratio indicates the ratio of media data to fec data, range 1-10, or -1,0
- ratio = 1-10 : fec_ratio = media_data / fec_data
- ratio = 0 : Equivalent to no fec
- ratio = -1 : Auto set by sdk according to packet loss ratiopublic int sendMediaCtrlMsg(int connId, int remoteUid, byte[] payload)
connId
- Connection identificationremoteUid
- Remote user ID
- if `remote_uid` is set 0, it's for all users
- else it's for specific usepayload
- Message's payload bufferpublic int sendRdtMsg(int connId, int remoteUid, int type, byte[] msg)
public int getRdtStatusInfo(int connId, int remoteUid, AgoraRtcService.RdtStatusInfo info)
public int setParams(java.lang.String params)
params
- : config params described by jsonpublic int setCloudProxy(int type)
type
- : the type of cloud proxy, AgoraRtcService#CloudProxyType
public int loginRtm(java.lang.String rtmUid, java.lang.String rtmToken, AgoraRtmEvents events)
rtmUid
- The rtm user id(different with uid)
Length should be less than 64 bytes
Supported character scopes are:
- The 26 lowercase English letters: a to z
- The 26 uppercase English letters: A to Z
- The 10 numbers: 0 to 9
- The space
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":",
";", "<", "=", ".", ">", "?", "@", "[", "]", "^",
"_", " {", "}", "|", "~", ","rtmToken
- : tokenevents
- A set of callback that handles Agora RTM eventspublic int logoutRtm()
public int sendRtm(java.lang.String rtmUid, byte[] message, int messageId)
rtmUid
- RTM UIDmessage
- Message to send(max size: 32KB)messageId
- Identify the message sent