|
| AgoraLocalUser (long cptr) |
|
native void | setUserRole (int role) |
|
native int | getUserRole () |
|
native int | setAudioEncoderConfig (AudioEncoderConfig config) |
|
native int | publishAudio (AgoraLocalAudioTrack agora_local_audio_track) |
|
native int | unpublishAudio (AgoraLocalAudioTrack agora_local_audio_track) |
|
native int | publishVideo (AgoraLocalVideoTrack agora_local_video_track) |
|
native int | unpublishVideo (AgoraLocalVideoTrack agora_local_video_track) |
|
native int | subscribeAudio (String user_id) |
|
native int | subscribeAllAudio () |
|
native int | unsubscribeAudio (String user_id) |
|
native int | unsubscribeAllAudio () |
|
native int | setPlaybackAudioFrameParameters (int channels, int sample_rate_hz, int mode, int samples_per_call) |
|
native int | setRecordingAudioFrameParameters (int channels, int sample_rate_hz, int mode, int samples_per_call) |
|
native int | setMixedAudioFrameParameters (int channels, int sample_rate_hz, int mode, int samples_per_call) |
|
native int | setPlaybackAudioFrameBeforeMixingParameters (int channels, int sample_rate_hz) |
|
native int | registerAudioFrameObserver (IAudioFrameObserver observer) |
|
native int | unregisterAudioFrameObserver () |
|
native int | subscribeVideo (String user_id, VideoSubscriptionOptions options) |
|
native int | subscribeAllVideo (VideoSubscriptionOptions options) |
|
native int | unsubscribeVideo (String user_id) |
|
native int | unsubscribeAllVideo () |
|
native int | setAudioVolumeIndicationParameters (int interval_in_ms, int smooth, boolean report_vad) |
|
native int | registerObserver (ILocalUserObserver observer) |
|
native int | unregisterObserver () |
|
native int | setAudioScenario (int scenarioType) |
|
native int | sendIntraRequest (String uid) |
|
◆ AgoraLocalUser()
io.agora.rtc.AgoraLocalUser.AgoraLocalUser |
( |
long |
cptr | ) |
|
◆ getUserRole()
native int io.agora.rtc.AgoraLocalUser.getUserRole |
( |
| ) |
|
Gets the role of the user.
- Returns
- The role of the user.
◆ publishAudio()
Publishes a local audio track to the channel.
By default, all published audio tracks are mixed.
- Parameters
-
agora_local_audio_track | The local audio track to be published. |
- Returns
- 0: Success.
- < 0: Failure.
◆ publishVideo()
Publishes a local video track to the channel.
- Parameters
-
agora_local_video_track | The local video track to be published. |
- Returns
- 0: Success.
- < 0: Failure.
◆ registerAudioFrameObserver()
native int io.agora.rtc.AgoraLocalUser.registerAudioFrameObserver |
( |
IAudioFrameObserver |
observer | ) |
|
Registers an audio frame observer.
You need to implement the IAudioFrameObserver
class in this method, and register the following callbacks according to your scenario:
- Parameters
-
- Returns
- 0: Success.
- < 0: Failure.
◆ registerObserver()
Registers a local user observer object.
You need to implement the ILocalUserObserver class in this method. Once registered, the ILocalUserObserver receives events of the AgoraLocalUser object.
- Parameters
-
observer | The ILocalUserObserver object. |
- Returns
- 0: Success.
- < 0: Failure.
◆ sendIntraRequest()
native int io.agora.rtc.AgoraLocalUser.sendIntraRequest |
( |
String |
uid | ) |
|
Sends intra-frame request to the broadcaster with a specified uid.
After you successfully send the request, the host receives the onIntraRequestReceived
callback.
- Parameters
-
uid | The user ID of the target broadcaster . |
- Returns
- 0: Success.
- < 0: Failure.
◆ setAudioEncoderConfig()
Configures the audio encoder.
The SDK applies the configurations to all the sending audio tracks.
- Parameters
-
config | The reference to the audio encoder configurations. |
- Returns
- 0: Success.
- < 0: Failure.
◆ setAudioScenario()
native int io.agora.rtc.AgoraLocalUser.setAudioScenario |
( |
int |
scenarioType | ) |
|
Sets audio scenarios.
This method is suitable for various audio scenarios. You can choose as needed. For example, in scenarios such as music teaching that require high sound quality, it is recommended to set scenarioType
to AUDIO_SCENARIO_GAME_STREAMING
(3).
- Parameters
-
scenarioType | The audio scenarios. Under different audio scenarios, the device uses different volume types.
AUDIO_SCENARIO_DEFAULT (0): (Default) Automatic scenario, where the SDK chooses the appropriate audio quality according to the user role and audio route.
AUDIO_SCENARIO_GAME_STREAMING (3): High-quality audio scenario, where users mainly play music.
AUDIO_SCENARIO_CHATROOM (5): Chatroom scenario, where users need to frequently switch the user role or mute and unmute the microphone.
AUDIO_SCENARIO_CHORUS (7): Real-time chorus scenario, where users have good network conditions and require ultra-low latency.
AUDIO_SCENARIO_MEETING (8): Meeting scenario that mainly involves the human voice.
|
- Returns
- 0: Success.
- < 0: Failure.
◆ setAudioVolumeIndicationParameters()
native int io.agora.rtc.AgoraLocalUser.setAudioVolumeIndicationParameters |
( |
int |
interval_in_ms, |
|
|
int |
smooth, |
|
|
boolean |
report_vad |
|
) |
| |
◆ setMixedAudioFrameParameters()
native int io.agora.rtc.AgoraLocalUser.setMixedAudioFrameParameters |
( |
int |
channels, |
|
|
int |
sample_rate_hz, |
|
|
int |
mode, |
|
|
int |
samples_per_call |
|
) |
| |
Sets the audio frame parameters for the onMixedAudioFrame callback.
- Parameters
-
channels | The number of channels of the audio frame in the onMixedAudioFrame callback.
|
sample_rate_hz | The sample rate (Hz) of the audio frame in the onMixedAudioFrame callback. You can set it as 8000, 16000, 32000, 44100, or 48000. |
mode | The use mode of the onMixedAudioFrame callback:
- 0: Read-only mode: Users only read the AudioFrame data without modifying anything. For example, when users acquire the data with the Agora SDK then push the RTMP or RTMPS streams.
- 1: Write-only mode: Users replace the
AudioFrame data with their own data. For example, users can use this mode when they acquire data by themselves.
- 2: Read and write mode: Users read the data from
AudioFrame , modify it, and then play it. For example, users can use this mode when they have their own sound-effect processing module, and want to do some voice post-processing, such as a voice change.
|
samples_per_call | The number of samples the onMixedAudioFrame callback returns. In RTMP or RTMPS streaming scenarios, set it as 1024. |
- Returns
- 0: Success.
- < 0: Failure.
◆ setPlaybackAudioFrameBeforeMixingParameters()
native int io.agora.rtc.AgoraLocalUser.setPlaybackAudioFrameBeforeMixingParameters |
( |
int |
channels, |
|
|
int |
sample_rate_hz |
|
) |
| |
Sets the audio frame parameters for the onPlaybackAudioFrameBeforeMixing callback.
- Parameters
-
channels | The number of channels of the audio frame in the onPlaybackAudioFrameBeforeMixing callback.
|
sample_rate_hz | The sample rate (Hz) of the audio frame in the onPlaybackAudioFrameBeforeMixing callback. You can set it as 8000, 16000, 32000, 44100, or 48000. |
- Returns
- 0: Success.
- < 0: Failure.
◆ setPlaybackAudioFrameParameters()
native int io.agora.rtc.AgoraLocalUser.setPlaybackAudioFrameParameters |
( |
int |
channels, |
|
|
int |
sample_rate_hz, |
|
|
int |
mode, |
|
|
int |
samples_per_call |
|
) |
| |
Sets the audio frame parameters for the onPlaybackAudioFrame callback.
- Parameters
-
channels | The number of audio channels of the audio frame in the onPlaybackAudioFrame callback.
|
sample_rate_hz | The sample rate (Hz) of the audio frame in the onPlaybackAudioFrame callback. You can set it as 8000, 16000, 32000, 44100, or 48000. |
mode | The use mode of the onPlaybackAudioFrame callback:
- 0: Read-only mode: Users only read the AudioFrame data without modifying anything. For example, when users acquire the data with the Agora SDK then push the RTMP or RTMPS streams.
- 1: Write-only mode: Users replace the
AudioFrame data with their own data. For example, users can use this mode when they acquire data by themselves.
- 2: Read and write mode: Users read the data from
AudioFrame , modify it, and then play it. For example, users can use this mode when they have their own sound-effect processing module, and want to do some voice post-processing, such as a voice change.
|
samples_per_call | The number of samples the onPlaybackAudioFrame callback returns. In RTMP or RTMPS streaming scenarios, set it as 1024. |
- Returns
- 0: Success.
- < 0: Failure.
◆ setRecordingAudioFrameParameters()
native int io.agora.rtc.AgoraLocalUser.setRecordingAudioFrameParameters |
( |
int |
channels, |
|
|
int |
sample_rate_hz, |
|
|
int |
mode, |
|
|
int |
samples_per_call |
|
) |
| |
Sets the audio frame parameters for the onRecordAudioFrame callback.
- Parameters
-
channels | The number of channels of the audio frame in the onRecordAudioFrame callback.
|
sample_rate_hz | The sample rate (Hz) of the audio frame in the onRecordAudioFrame callback. You can set it as 8000, 16000, 32000, 44100, or 48000. |
mode | The use mode of the onRecordAudioFrame callback:
- 0: Read-only mode: Users only read the AudioFrame data without modifying anything. For example, when users acquire the data with the Agora SDK then push the RTMP or RTMPS streams.
- 1: Write-only mode: Users replace the
AudioFrame data with their own data. For example, users can use this mode when they acquire data by themselves.
- 2: Read and write mode: Users read the data from
AudioFrame , modify it, and then play it. For example, users can use this mode when they have their own sound-effect processing module, and want to do some voice post-processing, such as a voice change.
|
samples_per_call | The number of samples the onRecordFrame callback returns. In RTMP or RTMPS streaming scenarios, set it as 1024. |
- Returns
- 0: Success.
- < 0: Failure.
◆ setUserRole()
native void io.agora.rtc.AgoraLocalUser.setUserRole |
( |
int |
role | ) |
|
Sets the role of the user.
You can call this method either before or after connecting to an Agora channel:
- Before connecting: This method sets the user role as publisher or subscriber (default).
- After connecting: This method allows you to switch the user role between publisher and subscriber. The onChangeRoleSuccess and onChangeRoleFailure callbacks indicate the result of this method call.
- Note
- If the token in the connect method does not have the same role as
role
, the connection fails with the onConnectionFailure callback.
- Parameters
-
role | The role of the user. |
◆ subscribeAllAudio()
native int io.agora.rtc.AgoraLocalUser.subscribeAllAudio |
( |
| ) |
|
Subscribes to the audio of all remote users in the channel.
This method also automatically subscribes to the audio of any subsequent user.
- Returns
- 0: Success.
- < 0: Failure.
◆ subscribeAllVideo()
Subscribes to the video of all remote users in the channel.
This method also automatically subscribes to the video of any subsequent remote user.
- Parameters
-
- Returns
- 0: Success.
- < 0: Failure.
◆ subscribeAudio()
native int io.agora.rtc.AgoraLocalUser.subscribeAudio |
( |
String |
user_id | ) |
|
Subscribes to the audio of a specified remote user in channel.
- Parameters
-
user_id | The ID of the remote user whose audio you want to subscribe to. |
- Returns
- 0: Success.
- < 0: Failure.
◆ subscribeVideo()
Subscribes to the video of a specified remote user in the channel.
- Parameters
-
user_id | The ID of the user whose video you want to subscribe to. |
options | The reference to the video subscription options. For example, subscribing to encoded video data only or subscribing to low-stream video. |
- Returns
- 0: Success.
- < 0: Failure.
◆ unpublishAudio()
native int io.agora.rtc.AgoraLocalUser.unpublishAudio |
( |
AgoraLocalAudioTrack |
agora_local_audio_track | ) |
|
Stops publishing the local audio track to the channel.
- Parameters
-
agora_local_audio_track | The local audio track that you want to stop publishing. |
- Returns
- 0: Success.
- < 0: Failure.
◆ unpublishVideo()
native int io.agora.rtc.AgoraLocalUser.unpublishVideo |
( |
AgoraLocalVideoTrack |
agora_local_video_track | ) |
|
Stops publishing the local video track to the channel.
- Parameters
-
agora_local_video_track | The local video track that you want to stop publishing. |
- Returns
- 0: Success.
- < 0: Failure.
◆ unregisterAudioFrameObserver()
native int io.agora.rtc.AgoraLocalUser.unregisterAudioFrameObserver |
( |
| ) |
|
Releases the audio frame observer.
- Parameters
-
- Returns
- 0: Success.
- < 0: Failure.
◆ unregisterObserver()
native int io.agora.rtc.AgoraLocalUser.unregisterObserver |
( |
| ) |
|
Releases the ILocalUserObserver object.
- Parameters
-
observer | The pointer to the ILocalUserObserver object that you want to release. |
- Returns
- 0: Success.
- < 0: Failure.
◆ unsubscribeAllAudio()
native int io.agora.rtc.AgoraLocalUser.unsubscribeAllAudio |
( |
| ) |
|
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.
- Returns
- 0: Success.
- < 0: Failure.
◆ unsubscribeAllVideo()
native int io.agora.rtc.AgoraLocalUser.unsubscribeAllVideo |
( |
| ) |
|
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.
- Returns
- 0: Success.
- < 0: Failure.
◆ unsubscribeAudio()
native int io.agora.rtc.AgoraLocalUser.unsubscribeAudio |
( |
String |
user_id | ) |
|
Stops subscribing to the audio of a specified remote user in the channel.
- Parameters
-
user_id | The ID of the user whose audio you want to stop subscribing to. |
- Returns
- 0: Success.
- < 0: Failure.
◆ unsubscribeVideo()
native int io.agora.rtc.AgoraLocalUser.unsubscribeVideo |
( |
String |
user_id | ) |
|
Stops subscribing to the video of a specified remote user in the channel.
- Parameters
-
user_id | The ID of the user whose video you want to stop subscribing to. |
- Returns
- 0: Success.
- < 0: Failure.
The documentation for this class was generated from the following file: