public class AgoraRtcConn
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
AgoraRtcConn.InternalCapabilitesObserver
Internal capabilities observer implementation.
|
| Modifier and Type | Field and Description |
|---|---|
private AgoraParameter |
agoraParameter
Agora parameter instance
|
private AgoraService |
agoraService
Agora service instance
|
private AgoraAudioEncodedFrameSender |
audioEncodedFrameSender
Audio encoded frame sender
|
private AudioFrame |
audioFrame
Audio frame buffer
|
private AgoraAudioPcmDataSender |
audioFrameSender
Audio PCM data sender
|
private ICapabilitesObserver |
capabilitiesObserver
Capabilities observer
|
private long |
cptr
Native pointer to the RTC connection instance.
|
private AgoraLocalAudioTrack |
customAudioTrack
Custom audio track
|
private AgoraVideoEncodedImageSender |
customEncodedImageSender
Custom encoded image sender
|
private AgoraLocalVideoTrack |
customVideoTrack
Custom video track
|
private int |
dataStreamId
Data stream ID
|
private boolean |
isSupportExternalAudio
Whether support external audio
|
private AgoraLocalUser |
localUser
Local user instance
|
private AgoraMediaNodeFactory |
mediaNodeFactory
Media node factory for creating media nodes
|
private INetworkObserver |
networkObserver
Network observer
|
private PcmConsumeStateUtils |
pcmConsumeStateUtils
PCM consume state utilities
|
private IRtcConnObserver |
rtcConnObserver
RTC connection observer
|
private RtcConnPublishConfig |
rtcConnPublishConfig
RTC connection publish configuration
|
private SendExternalAudioParameters |
sendExternalAudioParameters
For AI scenario send external audio parameters, default to null
|
private AgoraVideoFrameSender |
videoFrameSender
Video frame sender
|
| Constructor and Description |
|---|
AgoraRtcConn(long cptr)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
int |
adjustLocalAudioTrackPublishVolume(int volume)
Adjusts the publish volume of the local audio track.
|
int |
connect(java.lang.String token,
java.lang.String channelId,
java.lang.String userId)
Connects to a channel
|
(package private) int |
createDataStream(Out<java.lang.Integer> streamId,
int reliable,
int ordered)
Creates data stream
|
void |
destroy()
Destroys the RtcConnection instance
|
(package private) void |
destroyConnInfo(RtcConnInfo info)
Destroys connection information object
|
(package private) void |
destroyLocalAudioTrackStats(LocalAudioTrackStats stats)
Destroys the provided LocalAudioTrackStats object.
|
(package private) void |
destroyLocalVideoTrackStatistics(LocalVideoTrackStats stats)
Destroys the provided LocalVideoTrackStats object.
|
(package private) void |
destroyTransportStats(RtcStats stats)
Destroys transport statistics object
|
(package private) void |
destroyUserInfo(UserInfo info)
Destroys user information object
|
int |
disconnect()
Disconnects from current channel
|
int |
enableEncryption(int enabled,
EncryptionConfig config)
Enables/disables encryption
|
int |
enableLocalAudioTrackEarMonitor(int enable,
int includeAudiFilter)
Enables or disables ear monitoring.
|
int |
enableLocalAudioTrackPlayback(int enable)
Enables or disables local playback of the audio track.
|
int |
enableSimulcastStream(int enabled,
SimulcastStreamConfig config)
Enables or disables the simulcast stream.
|
AgoraParameter |
getAgoraParameter()
Gets Agora parameter object
|
int |
getConnId()
Gets connection ID
|
RtcConnInfo |
getConnInfo()
Gets connection information
|
int |
getCurrentAudioScenario()
Gets the current audio scenario.
|
int |
getLocalAudioTrackPublishVolume(Out<java.lang.Integer> volume)
Gets the current publish volume of the local audio track.
|
int |
getLocalAudioTrackState()
Gets the current state of the local audio track.
|
LocalAudioTrackStats |
getLocalAudioTrackStats()
Retrieves the statistics of the local audio track.
|
AgoraLocalUser |
getLocalUser()
Gets local user object
|
int |
getLocalVideoTrackState()
Gets the current state of the local audio track.
|
LocalVideoTrackStats |
getLocalVideoTrackStatistics()
Retrieves the statistics of the local video track.
|
RtcStats |
getTransportStats()
Gets transport statistics
|
UserInfo |
getUserInfo(java.lang.String userId)
Gets user information by user ID
|
AccountInfo |
getUserInfoByUid(java.lang.String userId)
Gets user information by UID
|
AccountInfo |
getUserInfoByUserAccount(java.lang.String userAccount)
Gets user information by user account
|
private void |
initDataStream()
Initializes the data stream for sending custom messages.
|
(package private) int |
initRtcConn(AgoraService agoraService,
AgoraMediaNodeFactory mediaNodeFactory,
RtcConnPublishConfig rtcConnPublishConfig,
AgoraServiceConfig agoraServiceConfig)
Initializes the RTC connection.
|
int |
interruptAudio()
Interrupts the audio track.
|
boolean |
isPushToRtcCompleted()
Checks if push to RTC is completed.
|
private boolean |
isSupportExternalAudio(RtcConnPublishConfig publishConfig)
Checks if external audio is supported based on the publish configuration.
|
private int |
nativeConnect(long cptr,
java.lang.String token,
java.lang.String channelId,
java.lang.String userId)
Connects to a channel natively.
|
private int |
nativeCreateDataStream(long cptr,
Out<java.lang.Integer> streamId,
int reliable,
int ordered)
Creates a data stream natively.
|
private void |
nativeDestroy(long cptr)
Releases the native RTC connection handle.
|
private void |
nativeDestroyConnInfo(long cptr,
RtcConnInfo info)
Destroys connection info object natively.
|
private void |
nativeDestroyTransportStats(long cptr,
RtcStats stats)
Destroys transport stats object natively.
|
private void |
nativeDestroyUserInfo(long cptr,
UserInfo info)
Destroys user info object natively.
|
private int |
nativeDisconnect(long cptr)
Disconnects from the channel natively.
|
private int |
nativeEnableEncryption(long cptr,
int enabled,
EncryptionConfig config)
Enables or disables encryption natively.
|
private AgoraParameter |
nativeGetAgoraParameter(long cptr)
Gets Agora parameter instance natively.
|
private int |
nativeGetConnId(long cptr)
Gets the connection ID natively.
|
private RtcConnInfo |
nativeGetConnInfo(long cptr)
Gets connection information natively.
|
private AgoraLocalUser |
nativeGetLocalUser(long cptr)
Gets the local user instance natively.
|
private RtcStats |
nativeGetTransportStats(long cptr)
Gets transport statistics natively.
|
private UserInfo |
nativeGetUserInfo(long cptr,
java.lang.String userId)
Gets user information by user ID natively.
|
private AccountInfo |
nativeGetUserInfoByUid(long cptr,
java.lang.String userId)
Gets user information by UID natively.
|
private AccountInfo |
nativeGetUserInfoByUserAccount(long cptr,
java.lang.String userAccount)
Gets user information by user account natively.
|
private int |
nativeRegisterNetworkObserver(long cptr,
INetworkObserver observer)
Registers a network observer natively.
|
private int |
nativeRegisterObserver(long cptr,
IRtcConnObserver observer)
Registers an RTC connection observer natively.
|
private int |
nativeRenewToken(long cptr,
java.lang.String token)
Renews the authentication token natively.
|
private int |
nativeSendCustomReportMessage(long cptr,
java.lang.String id,
java.lang.String category,
java.lang.String event,
java.lang.String label,
int value)
Sends a custom report message natively.
|
private int |
nativeSendStreamMessage(long cptr,
int streamId,
byte[] messageData)
Sends a stream message natively.
|
private int |
nativeStartLastmileProbeTest(long cptr,
LastmileProbeConfig config)
Starts last mile probe test natively.
|
private int |
nativeStopLastmileProbeTest(long cptr)
Stops last mile probe test natively.
|
private int |
nativeUnregisterNetworkObserver(long cptr)
Unregisters the network observer natively.
|
private int |
nativeUnregisterObserver(long cptr)
Unregisters the RTC connection observer natively.
|
int |
publishAudio()
Publishes the audio track.
|
int |
publishVideo()
Publishes the video track.
|
int |
pushAudioEncodedData(byte[] data,
EncodedAudioFrameInfo info)
Pushes audio encoded data.
|
int |
pushAudioPcmData(byte[] data,
int sampleRate,
int channels)
Pushes audio PCM data.
|
int |
pushAudioPcmData(byte[] data,
int sampleRate,
int channels,
long presentationMs)
Pushes audio PCM data.
|
int |
pushVideoEncodedData(byte[] data,
EncodedVideoFrameInfo info)
Pushes video encoded data.
|
int |
pushVideoFrame(ExternalVideoFrame frame)
Pushes video frame.
|
int |
registerAudioEncodedFrameObserver(IAudioEncodedFrameObserver observer)
Registers an audio encoded frame observer.
|
int |
registerAudioFrameObserver(IAudioFrameObserver observer,
boolean enableVad,
AgoraAudioVadConfigV2 vadConfig)
Registers an audio frame observer with VAD (Voice Activity Detection)
enabled.
|
int |
registerLocalUserObserver(ILocalUserObserver observer)
Registers a local user observer.
|
int |
registerNetworkObserver(INetworkObserver observer)
Registers a network observer
|
int |
registerObserver(IRtcConnObserver observer)
Registers an RTC connection observer
|
int |
registerVideoEncodedFrameObserver(AgoraVideoEncodedFrameObserver agoraVideoEncodedFrameObserver)
Registers a video encoded frame observer.
|
int |
registerVideoFrameObserver(AgoraVideoFrameObserver2 agoraVideoFrameObserver2)
Registers a video frame observer.
|
int |
renewToken(java.lang.String token)
Renews the token
|
int |
sendAudioMetaData(byte[] metaData)
Sends audio metadata.
|
int |
sendCustomReportMessage(java.lang.String id,
java.lang.String category,
java.lang.String event,
java.lang.String label,
int value)
Sends custom report message
|
int |
sendIntraRequest(java.lang.String userId)
Sends an intra request to a specified remote user to request a new key frame.
|
int |
sendStreamMessage(byte[] messageData)
Sends data stream message
|
private int |
setExtraSendFrameSpeed(SendExternalAudioParameters sendExternalAudioParameters)
Sets the extra send frame speed for external audio.
|
private int |
setTotalExtraSendMs()
Sets the total extra send time in milliseconds.
|
int |
setVideoEncoderConfig(VideoEncoderConfig config)
Sets the video encoder configuration.
|
int |
startLastmileProbeTest(LastmileProbeConfig config)
Starts last-mile network probe test
|
int |
stopLastmileProbeTest()
Stops last-mile network probe test
|
int |
unpublishAudio()
Unpublishes the audio track.
|
int |
unpublishVideo()
Unpublishes the video track.
|
(package private) int |
unregisterNetworkObserver()
Unregisters the network observer
|
(package private) int |
unregisterObserver()
Unregisters the RTC connection observer
|
int |
updateAudioSenario(int scenario)
Updates the audio scenario.
|
private long cptr
private AgoraService agoraService
private AgoraMediaNodeFactory mediaNodeFactory
private RtcConnPublishConfig rtcConnPublishConfig
private AgoraLocalUser localUser
private AgoraParameter agoraParameter
private volatile AgoraAudioPcmDataSender audioFrameSender
private volatile AgoraAudioEncodedFrameSender audioEncodedFrameSender
private volatile AgoraLocalAudioTrack customAudioTrack
private volatile AgoraVideoFrameSender videoFrameSender
private volatile AgoraVideoEncodedImageSender customEncodedImageSender
private volatile AgoraLocalVideoTrack customVideoTrack
private IRtcConnObserver rtcConnObserver
private INetworkObserver networkObserver
private ICapabilitesObserver capabilitiesObserver
private AudioFrame audioFrame
private int dataStreamId
private PcmConsumeStateUtils pcmConsumeStateUtils
private boolean isSupportExternalAudio
private SendExternalAudioParameters sendExternalAudioParameters
AgoraRtcConn(long cptr)
cptr - Native pointerint initRtcConn(AgoraService agoraService, AgoraMediaNodeFactory mediaNodeFactory, RtcConnPublishConfig rtcConnPublishConfig, AgoraServiceConfig agoraServiceConfig)
agoraService - The Agora service.mediaNodeFactory - The media node factory.rtcConnPublishConfig - The RTC connection publish configuration.agoraServiceConfig - The Agora service configuration.private void initDataStream()
public int getCurrentAudioScenario()
public void destroy()
public int registerObserver(IRtcConnObserver observer)
observer - The observer to registerint unregisterObserver()
public int registerNetworkObserver(INetworkObserver observer)
observer - The observer to registerint unregisterNetworkObserver()
public int registerAudioFrameObserver(IAudioFrameObserver observer, boolean enableVad, AgoraAudioVadConfigV2 vadConfig)
observer - The audio frame observer to register.enableVad - Whether to enable VAD.vadConfig - The VAD configuration.public int registerAudioEncodedFrameObserver(IAudioEncodedFrameObserver observer)
observer - The audio encoded frame observer to register.public int registerLocalUserObserver(ILocalUserObserver observer)
observer - The local user observer to register.public int registerVideoFrameObserver(AgoraVideoFrameObserver2 agoraVideoFrameObserver2)
agoraVideoFrameObserver2 - The video frame observer to register.public int registerVideoEncodedFrameObserver(AgoraVideoEncodedFrameObserver agoraVideoEncodedFrameObserver)
agoraVideoEncodedFrameObserver - The video encoded frame observer to
register.public int publishAudio()
public int unpublishAudio()
public int publishVideo()
public int unpublishVideo()
public int interruptAudio()
public int pushAudioPcmData(byte[] data,
int sampleRate,
int channels,
long presentationMs)
data - The audio data.sampleRate - The sample rate.channels - The number of channels.presentationMs - The presentation timestamp.and it can pass to
onPlaybackBeforeMixing's audioframe.presentationMspublic int pushAudioPcmData(byte[] data,
int sampleRate,
int channels)
data - The audio data.sampleRate - The sample rate.channels - The number of channels.public int pushAudioEncodedData(byte[] data,
EncodedAudioFrameInfo info)
data - The audio data.info - The audio frame info.public int pushVideoFrame(ExternalVideoFrame frame)
frame - The video frame.public int pushVideoEncodedData(byte[] data,
EncodedVideoFrameInfo info)
data - The video data.info - The video frame info.public int updateAudioSenario(int scenario)
scenario - The audio scenario.public int sendStreamMessage(byte[] messageData)
messageData - Message content in bytespublic int connect(java.lang.String token,
java.lang.String channelId,
java.lang.String userId)
token - Authentication tokenchannelId - Channel ID to joinuserId - User IDpublic int disconnect()
public int startLastmileProbeTest(LastmileProbeConfig config)
config - Configuration for the probe testpublic int stopLastmileProbeTest()
public int renewToken(java.lang.String token)
token - New token to usepublic RtcConnInfo getConnInfo()
void destroyConnInfo(RtcConnInfo info)
info - RtcConnInfo object to destroypublic AgoraLocalUser getLocalUser()
public UserInfo getUserInfo(java.lang.String userId)
userId - User ID to querypublic AccountInfo getUserInfoByUserAccount(java.lang.String userAccount)
userAccount - User account to querypublic AccountInfo getUserInfoByUid(java.lang.String userId)
userId - User ID to queryvoid destroyUserInfo(UserInfo info)
info - UserInfo object to destroypublic int getConnId()
public RtcStats getTransportStats()
void destroyTransportStats(RtcStats stats)
stats - RtcStats object to destroypublic AgoraParameter getAgoraParameter()
int createDataStream(Out<java.lang.Integer> streamId, int reliable, int ordered)
streamId - Output parameter to receive stream IDreliable - Whether the stream is reliableordered - Whether the stream is orderedpublic int enableEncryption(int enabled,
EncryptionConfig config)
enabled - Whether to enable encryption (1: Enable, 0: Disable)config - Encryption configurationpublic int sendCustomReportMessage(java.lang.String id,
java.lang.String category,
java.lang.String event,
java.lang.String label,
int value)
id - Report IDcategory - Report categoryevent - Report eventlabel - Report labelvalue - Report valuepublic int setVideoEncoderConfig(VideoEncoderConfig config)
config - The video encoder configuration to set.public int enableSimulcastStream(int enabled,
SimulcastStreamConfig config)
enabled - 1 to enable, 0 to disable.config - The simulcast stream configuration.public int getLocalVideoTrackState()
public LocalVideoTrackStats getLocalVideoTrackStatistics()
void destroyLocalVideoTrackStatistics(LocalVideoTrackStats stats)
stats - The LocalVideoTrackStats object to be destroyed.public int getLocalAudioTrackState()
public LocalAudioTrackStats getLocalAudioTrackStats()
void destroyLocalAudioTrackStats(LocalAudioTrackStats stats)
stats - The LocalAudioTrackStats object to be destroyed.public int adjustLocalAudioTrackPublishVolume(int volume)
volume - The volume level to set.public int getLocalAudioTrackPublishVolume(Out<java.lang.Integer> volume)
volume - An Out object to store the volume level.public int enableLocalAudioTrackPlayback(int enable)
enable - 1 to enable, 0 to disable.public int enableLocalAudioTrackEarMonitor(int enable,
int includeAudiFilter)
enable - 1 to enable, 0 to disable.includeAudiFilter - 1 to include audio filter, 0 to exclude.public int sendAudioMetaData(byte[] metaData)
metaData - The audio metadata to send.public boolean isPushToRtcCompleted()
public int sendIntraRequest(java.lang.String userId)
userId - The user ID of the remote user to send the intra request to.0 if the request is sent successfully;
< 0 if the request fails. See Constants.ErrorCodeType
for details.private void nativeDestroy(long cptr)
cptr - Native pointer to the RTC connectionprivate int nativeRegisterObserver(long cptr,
IRtcConnObserver observer)
cptr - Native pointer to the RTC connectionobserver - RTC connection observer instanceprivate int nativeUnregisterObserver(long cptr)
cptr - Native pointer to the RTC connectionprivate int nativeRegisterNetworkObserver(long cptr,
INetworkObserver observer)
cptr - Native pointer to the RTC connectionobserver - Network observer instanceprivate int nativeUnregisterNetworkObserver(long cptr)
cptr - Native pointer to the RTC connectionprivate int nativeSendStreamMessage(long cptr,
int streamId,
byte[] messageData)
cptr - Native pointer to the RTC connectionstreamId - Stream IDmessageData - Message data to sendprivate int nativeConnect(long cptr,
java.lang.String token,
java.lang.String channelId,
java.lang.String userId)
cptr - Native pointer to the RTC connectiontoken - Authentication tokenchannelId - Channel IDuserId - User IDprivate int nativeDisconnect(long cptr)
cptr - Native pointer to the RTC connectionprivate int nativeStartLastmileProbeTest(long cptr,
LastmileProbeConfig config)
cptr - Native pointer to the RTC connectionconfig - Last mile probe configurationprivate int nativeStopLastmileProbeTest(long cptr)
cptr - Native pointer to the RTC connectionprivate int nativeRenewToken(long cptr,
java.lang.String token)
cptr - Native pointer to the RTC connectiontoken - New authentication tokenprivate RtcConnInfo nativeGetConnInfo(long cptr)
cptr - Native pointer to the RTC connectionprivate void nativeDestroyConnInfo(long cptr,
RtcConnInfo info)
cptr - Native pointer to the RTC connectioninfo - Connection info object to destroyprivate AgoraLocalUser nativeGetLocalUser(long cptr)
cptr - Native pointer to the RTC connectionprivate UserInfo nativeGetUserInfo(long cptr, java.lang.String userId)
cptr - Native pointer to the RTC connectionuserId - User IDprivate AccountInfo nativeGetUserInfoByUserAccount(long cptr, java.lang.String userAccount)
cptr - Native pointer to the RTC connectionuserAccount - User accountprivate AccountInfo nativeGetUserInfoByUid(long cptr, java.lang.String userId)
cptr - Native pointer to the RTC connectionuserId - User IDprivate void nativeDestroyUserInfo(long cptr,
UserInfo info)
cptr - Native pointer to the RTC connectioninfo - User info object to destroyprivate int nativeGetConnId(long cptr)
cptr - Native pointer to the RTC connectionprivate RtcStats nativeGetTransportStats(long cptr)
cptr - Native pointer to the RTC connectionprivate void nativeDestroyTransportStats(long cptr,
RtcStats stats)
cptr - Native pointer to the RTC connectionstats - Transport stats object to destroyprivate AgoraParameter nativeGetAgoraParameter(long cptr)
cptr - Native pointer to the RTC connectionprivate int nativeCreateDataStream(long cptr,
Out<java.lang.Integer> streamId,
int reliable,
int ordered)
cptr - Native pointer to the RTC connectionstreamId - Output stream IDreliable - Whether the stream is reliableordered - Whether the stream is orderedprivate int nativeEnableEncryption(long cptr,
int enabled,
EncryptionConfig config)
cptr - Native pointer to the RTC connectionenabled - 1 to enable, 0 to disableconfig - Encryption configurationprivate int nativeSendCustomReportMessage(long cptr,
java.lang.String id,
java.lang.String category,
java.lang.String event,
java.lang.String label,
int value)
cptr - Native pointer to the RTC connectionid - Message IDcategory - Message categoryevent - Event namelabel - Labelvalue - Valueprivate boolean isSupportExternalAudio(RtcConnPublishConfig publishConfig)
publishConfig - The publish configurationprivate int setExtraSendFrameSpeed(SendExternalAudioParameters sendExternalAudioParameters)
sendExternalAudioParameters - The send external audio parametersprivate int setTotalExtraSendMs()