Agora Java API Reference for Android
|
#include <NGIAgoraLocalUser.h>
Classes | |
struct | ANAStats |
struct | AudioProcessingStats |
struct | LocalAudioDetailedStats |
struct | VideoSubscriptionOptions |
Public Member Functions | |
virtual void | setUserRole (rtc::CLIENT_ROLE_TYPE role)=0 |
virtual CLIENT_ROLE_TYPE | getUserRole ()=0 |
virtual void | setAudienceLatencyLevel (AUDIENCE_LATENCY_LEVEL_TYPE level)=0 |
virtual AUDIENCE_LATENCY_LEVEL_TYPE | getAudienceLatencyLevel ()=0 |
virtual int | setAudioEncoderConfiguration (const rtc::AudioEncoderConfiguration &config)=0 |
virtual int | setAudioScenario (AUDIO_SCENARIO_TYPE scenario)=0 |
virtual bool | getLocalAudioStatistics (LocalAudioDetailedStats &stats)=0 |
virtual int | publishAudio (agora_refptr< ILocalAudioTrack > audioTrack)=0 |
virtual int | unpublishAudio (agora_refptr< ILocalAudioTrack > audioTrack)=0 |
virtual int | publishVideo (agora_refptr< ILocalVideoTrack > videoTrack)=0 |
virtual int | unpublishVideo (agora_refptr< ILocalVideoTrack > videoTrack)=0 |
virtual int | subscribeAudio (user_id_t userId)=0 |
virtual int | subscribeAllAudio ()=0 |
virtual int | unsubscribeAudio (user_id_t userId)=0 |
virtual int | unsubscribeAllAudio ()=0 |
virtual int | adjustPlaybackSignalVolume (int volume)=0 |
virtual int | getPlaybackSignalVolume (int *volume)=0 |
virtual int | adjustUserPlaybackSignalVolume (user_id_t userId, int volume)=0 |
virtual int | getUserPlaybackSignalVolume (user_id_t userId, int *volume)=0 |
virtual int | enableSoundPositionIndication (bool enabled)=0 |
virtual int | setRemoteVoicePosition (user_id_t userId, double pan, double gain)=0 |
virtual int | enableSpatialAudio (bool enabled)=0 |
virtual int | setRemoteUserSpatialAudioParams (user_id_t userId, const agora::SpatialAudioParams ¶m)=0 |
virtual bool | pullMixedAudioPcmData (void *payload_data, AudioPcmDataInfo &audioFrameInfo)=0 |
virtual int | setPlaybackAudioFrameParameters (size_t numberOfChannels, uint32_t sampleRateHz, RAW_AUDIO_FRAME_OP_MODE_TYPE mode=RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, int samplesPerCall=0)=0 |
virtual int | setRecordingAudioFrameParameters (size_t numberOfChannels, uint32_t sampleRateHz, RAW_AUDIO_FRAME_OP_MODE_TYPE mode=RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, int samplesPerCall=0)=0 |
virtual int | setMixedAudioFrameParameters (size_t numberOfChannels, uint32_t sampleRateHz, int samplesPerCall=0)=0 |
virtual int | setPlaybackAudioFrameBeforeMixingParameters (size_t numberOfChannels, uint32_t sampleRateHz)=0 |
virtual int | registerAudioFrameObserver (agora::media::IAudioFrameObserverBase *observer)=0 |
virtual int | unregisterAudioFrameObserver (agora::media::IAudioFrameObserverBase *observer)=0 |
virtual int | enableAudioSpectrumMonitor (int intervalInMS=100)=0 |
virtual int | disableAudioSpectrumMonitor ()=0 |
virtual int | registerAudioSpectrumObserver (agora::media::IAudioSpectrumObserver *observer, void(*safeDeleter)(agora::media::IAudioSpectrumObserver *))=0 |
virtual int | unregisterAudioSpectrumObserver (agora::media::IAudioSpectrumObserver *observer)=0 |
virtual int | registerVideoEncodedFrameObserver (agora::media::IVideoEncodedFrameObserver *observer)=0 |
virtual int | unregisterVideoEncodedFrameObserver (agora::media::IVideoEncodedFrameObserver *observer)=0 |
virtual int | registerVideoFrameObserver (IVideoFrameObserver2 *observer)=0 |
virtual int | unregisterVideoFrameObserver (IVideoFrameObserver2 *observer)=0 |
virtual int | subscribeVideo (user_id_t userId, const VideoSubscriptionOptions &subscriptionOptions)=0 |
virtual int | subscribeAllVideo (const VideoSubscriptionOptions &subscriptionOptions)=0 |
virtual int | unsubscribeVideo (user_id_t userId)=0 |
virtual int | unsubscribeAllVideo ()=0 |
virtual int | setAudioVolumeIndicationParameters (int intervalInMS, int smooth, bool reportVad)=0 |
virtual int | registerLocalUserObserver (ILocalUserObserver *observer, void(*safeDeleter)(ILocalUserObserver *)=NULL)=0 |
virtual int | unregisterLocalUserObserver (ILocalUserObserver *observer)=0 |
virtual IMediaControlPacketSender * | getMediaControlPacketSender ()=0 |
virtual int | registerMediaControlPacketReceiver (IMediaControlPacketReceiver *ctrlPacketReceiver)=0 |
virtual int | unregisterMediaControlPacketReceiver (IMediaControlPacketReceiver *ctrlPacketReceiver)=0 |
virtual int | sendIntraRequest (user_id_t userId)=0 |
The ILocalUser class defines the behavior and state of a local user.
Each RTC connection has its own local user. Apps can get the local user object by calling IRtcConnection::getLocalUser.
Each local user has two user roles: broadcaster (publisher and subscriber) and audience (subscriber only). A publisher publishes audio and video tracks, while audience receive them.
|
pure virtual |
Sets the role of the user.
You can call this method either before or after connecting to an Agora channel:
role
, the connection fails with the onConnectionFailure callback. role | The role of the user. See CLIENT_ROLE_TYPE. |
|
pure virtual |
Gets the role of the user.
|
pure virtual |
Configures the audio encoder.
The SDK applies the configurations to all the sending audio tracks.
config | The reference to the audio encoder configurations. |
|
pure virtual |
Sets the audio parameters and application scenarios.
scenario | Sets the audio application scenarios: #AUDIO_SCENARIO_TYPE. |
|
pure virtual |
Gets the detailed statistics of the local audio.
[out] | stats | The reference to the detailed statistics of the local audio. |
true
: Success.false
: Failure.
|
pure virtual |
Publishes a local audio track to the channel.
By default, all published audio tracks are mixed.
audioTrack | The local audio track to be published. |
|
pure virtual |
Stops publishing the local audio track to the channel.
audioTrack | The local audio track that you want to stop publishing. |
|
pure virtual |
Publishes a local video track to the channel.
videoTrack | The local video track to be published. |
|
pure virtual |
Stops publishing the local video track to the channel.
videoTrack | The local video track that you want to stop publishing. |
|
pure virtual |
Subscribes to the audio of a specified remote user in channel.
userId | The ID of the remote user whose audio you want to subscribe to. |
userId
is invalid.
|
pure virtual |
Subscribes to the audio of all remote users in the channel.
This method also automatically subscribes to the audio of any subsequent user.
|
pure virtual |
Stops subscribing to the audio of a specified remote user in the channel.
userId | The ID of the user whose audio you want to stop subscribing to. |
userId
is invalid.
|
pure virtual |
Stops subscribing to the audio of all remote users in the channel.
This method automatically stops subscribing to the audio of any subsequent user, unless you explicitly call subscribeAudio or subscribeAllAudio.
|
pure virtual |
Adjusts the playback signal volume.
volume | The playback volume. The value ranges between 0 and 400, including the following: 0: Mute. 100: (Default) Original volume. 400: Four times the original volume with signal-clipping protection. |
|
pure virtual |
Gets the current playback signal volume.
volume | A pointer to the playback signal volume. |
|
pure virtual |
Gets the current playback signal volume of specified user.
userId | The ID of the Remote user. |
volume | A pointer to the playback signal volume. |
|
pure virtual |
Enables/Disables stereo panning for remote users.
Ensure that you call this method before joinChannel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling setRemoteVoicePosition.
enabled | Sets whether or not to enable stereo panning for remote users:
|
|
pure virtual |
Sets the sound position and gain of a remote user.
When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.
userId | The ID of the remote user. |
pan | The sound position of the remote user. The value ranges from -1.0 to 1.0:
|
gain | Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain. |
|
pure virtual |
enable spatial audio
enabled | enable/disable spatial audio:
|
|
pure virtual |
Sets remote user parameters for spatial audio
userId | The ID of the remote user. |
param | spatial audio parameters |
|
pure virtual |
Pulls the mixed PCM audio data from the channel.
enableAudioRecordingOrPlayout
in RtcConnectionConfiguration when creating the IRtcConnection
. Otherwise, this method returns false
and payload_data
contains no valid data.[out] | payload_data | The pointer to the mixed PCM audio data. |
[out] | audioFrameInfo | The reference to the information of the PCM audio data: AudioPcmDataInfo. |
true
: Success.false
: Failure.
|
pure virtual |
Sets the audio frame parameters for the onPlaybackAudioFrame callback.
numberOfChannels | The number of audio channels of the audio frame in the onPlaybackAudioFrame callback.
|
sampleRateHz | The sample rate (Hz) of the audio frame in the onPlaybackAudioFrame callback. You can set it as 8000, 16000, 32000, 44100, or 48000. |
mode | Use mode of the audio frame. See #RAW_AUDIO_FRAME_OP_MODE_TYPE. |
samplesPerCall | The number of samples of the audio frame. * |
|
pure virtual |
Sets the audio frame parameters for the onRecordAudioFrame callback.
numberOfChannels | The number of channels of the audio frame in the onRecordAudioFrame callback.
|
sampleRateHz | The sample rate (Hz) of the audio frame in the onRecordAudioFrame callback. You can set it as 8000, 16000, 32000, 44100, or 48000. |
mode | Use mode of the audio frame. See #RAW_AUDIO_FRAME_OP_MODE_TYPE. |
samplesPerCall | The number of samples of the audio frame. |
|
pure virtual |
Sets the audio frame parameters for the onMixedAudioFrame callback.
numberOfChannels | The number of channels of the audio frame in the onMixedAudioFrame callback.
|
sampleRateHz | The sample rate (Hz) of the audio frame in the onMixedAudioFrame callback. You can set it as 8000, 16000, 32000, 44100, or 48000. |
|
pure virtual |
Sets the audio frame parameters for the onPlaybackAudioFrameBeforeMixing callback.
numberOfChannels | The number of channels of the audio frame in the onPlaybackAudioFrameBeforeMixing callback.
|
sampleRateHz | The sample rate (Hz) of the audio frame in the onPlaybackAudioFrameBeforeMixing callback. You can set it as 8000, 16000, 32000, 44100, or 48000. |
|
pure virtual |
Registers an audio frame observer.
You need to implement the IAudioFrameObserverBase
class in this method, and register the following callbacks according to your scenario:
observer | A pointer to the audio frame observer: IAudioFrameObserverBase. |
|
pure virtual |
Releases the audio frame observer.
observer | The pointer to the audio frame observer: IAudioFrameObserverBase. |
|
pure virtual |
Enable the audio spectrum monitor.
intervalInMS | Sets the time interval(ms) between two consecutive audio spectrum callback. The default value is 100. This param should be larger than 10. |
|
pure virtual |
Disalbe the audio spectrum monitor.
|
pure virtual |
Registers an audio spectrum observer.
You need to implement the IAudioSpectrumObserver
class in this method, and register the following callbacks according to your scenario:
observer | A pointer to the audio spectrum observer: IAudioSpectrumObserver. |
|
pure virtual |
Releases the audio spectrum observer.
observer | The pointer to the audio spectrum observer: IAudioSpectrumObserver. |
|
pure virtual |
Registers an IVideoEncodedFrameObserver object.
You need to implement the IVideoEncodedFrameObserver
class in this method. Once you successfully register the encoded frame observer, the SDK triggers the OnEncodedVideoFrame callback when it receives the encoded video image.
observer | The pointer to the IVideoEncodedFrameObserver object. |
|
pure virtual |
Releases the IVideoEncodedFrameObserver object.
observer | The pointer to the IVideoEncodedFrameObserver object. |
|
pure virtual |
Registers an IVideoFrameObserver2 object.
You need to implement the IVideoFrameObserver2
class in this method. Once you successfully register the video frame observer, the SDK triggers the onFrame callback when it receives the video image.
observer | The pointer to the IVideoFrameObserver2 object. |
|
pure virtual |
Releases the IVideoFrameObserver2 object.
observer | The pointer to the IVideoFrameObserver2 object. |
|
pure virtual |
Subscribes to the video of a specified remote user in the channel.
userId | The ID of the user whose video you want to subscribe to. |
subscriptionOptions | The reference to the video subscription options: VideoSubscriptionOptions. For example, subscribing to encoded video data only or subscribing to low-stream video. |
userId
is invalid.
|
pure virtual |
Subscribes to the video of all remote users in the channel.
This method also automatically subscribes to the video of any subsequent remote user.
subscriptionOptions | The reference to the video subscription options: VideoSubscriptionOptions. |
|
pure virtual |
Stops subscribing to the video of a specified remote user in the channel.
userId | The ID of the user whose video you want to stop subscribing to. |
userId
is invalid.
|
pure virtual |
Stops subscribing to the video of all remote users in the channel.
This method automatically stops subscribing to the video of any subsequent user, unless you explicitly call subscribeVideo or subscribeAllVideo.
|
pure virtual |
Sets the time interval and the volume smoothing factor of the onAudioVolumeIndication callback.
By default, the SDK triggers the onAudioVolumeIndication
callback once every 500 ms, with a smoothing factor of 3.
intervalInMS | Sets the time interval(ms) between two consecutive volume indications. The default value is 500.
|
smooth | The smoothing factor that sets the sensitivity of the audio volume indicator. The value range is [0,10]. The greater the value, the more sensitive the indicator.The default value is 3. |
intervalInMS
or smooth
is out of range.
|
pure virtual |
Registers a local user observer object.
You need to implement the ILocalUserObserver class in this method. Once registered, the ILocalUserObserver receives events of the ILocalUser object.
observer | The pointer to the ILocalUserObserver object. |
|
pure virtual |
Releases the ILocalUserObserver object.
observer | The pointer to the ILocalUserObserver object that you want to release. |
|
pure virtual |
Gets the media control packet sender.
|
pure virtual |
Registers a media control packet receiver.
You need to implement the IMediaControlPacketReceiver
class in this method. Once you successfully register the media control packet receiver, the SDK triggers the onMediaControlPacketReceived callback when it receives the media control packet.
ctrlPacketReceiver | The pointer to the IMediaControlPacketReceiver object. |
|
pure virtual |
Releases the media control packet receiver.
ctrlPacketReceiver | The pointer to the IMediaControlPacketReceiver object. |
|
pure virtual |
Sends intra-frame request to the broadcaster with a specified uid.
The local user receives the onIntraRequestReceived
callback when the broadcaster receives the request.
userId | The user ID of the target broadcaster . |