Pico Unity Platform SDK
|
Static Public Member Functions | |
static RtcEngineInitResult | InitRtcEngine () |
Initializes the RTC engine. Note: You should call this method before using the RTC service. More... | |
static Task< string > | GetToken (string roomId, string userId, int ttl, Dictionary< RtcPrivilege, int > privileges) |
Gets the token required by JoinRoom . More... | |
static int | JoinRoom (string roomId, string userId, string token, RtcRoomProfileType rtcRoomProfileType, bool isAutoSubscribeAudio) |
Joins a user to a specified room. More... | |
static int | LeaveRoom (string roomId) |
Leaves a specified room. More... | |
static void | SetAudioPlaybackDevice (RtcAudioPlaybackDevice device) |
Sets the audio playback device. More... | |
static void | RoomPauseAllSubscribedStream (string roomId) |
Pauses all subscribed streams of a room. Once paused, the voice of users in the room is blocked so nothing can be heard from this room. More... | |
static void | RoomResumeAllSubscribedStream (string roomId) |
Resumes all subscribed streams of a room. Once resumed, the voice of users in the room can be heard again. More... | |
static void | EnableAudioPropertiesReport (int interval) |
Enables audio properties report. Once enabled, you will receive audio report data regularly. More... | |
static void | PublishRoom (string roomId) |
Publishes the local audio stream to a room, thereby making the voice heard be others in the same room. More... | |
static void | UnPublishRoom (string roomId) |
Stops publishing the local audio stream to a room, so others in the same room cannot hear the voice. More... | |
static void | DestroyRoom (string roomId) |
Destroys a specified room. The resources occupied by the room will be released after destruction. More... | |
static void | StartAudioCapture () |
Starts audio capture via the microphone. More... | |
static void | StopAudioCapture () |
Stops audio capture. More... | |
static void | SetCaptureVolume (int volume) |
Sets the volume of the captured audio. More... | |
static void | SetPlaybackVolume (int volume) |
Sets the playback volume. More... | |
static void | SetEarMonitorMode (RtcEarMonitorMode mode) |
Switches the in-ear monitoring mode on/off. Once the in-ear monitoring mode is enabled, one can hear their own voice. More... | |
static void | SetEarMonitorVolume (int volume) |
Sets the volume for in-ear monitoring. More... | |
static void | MuteLocalAudio (RtcMuteState rtcMuteState) |
Mutes local audio to make one's voice unable to be heard be others in the same room. More... | |
static void | UpdateToken (string roomId, string token) |
Updates the token. Note: Once a token's ttl is about to expire, you should update the token if you still want to stay in the room. More... | |
static void | SetAudioScenario (RtcAudioScenarioType scenarioType) |
Sets the audio scenario. Note: Different audio scenarios can impact the voice quality and how the earphones work. More... | |
static void | SetOnJoinRoomResultCallback (Message< RtcJoinRoomResult >.Handler handler) |
Sets the callback of JoinRoom to get RtcJoinRoomResult . More... | |
static void | SetOnLeaveRoomResultCallback (Message< RtcLeaveRoomResult >.Handler handler) |
Sets the callback of LeaveRoom to get RtcLeaveRoomResult . More... | |
static void | SetOnUserJoinRoomResultCallback (Message< RtcUserJoinInfo >.Handler handler) |
Sets the callback to get notified when someone has joined the room. More... | |
static void | SetOnUserLeaveRoomResultCallback (Message< RtcUserLeaveInfo >.Handler handler) |
Sets the callback to get notified when someone has left the room. More... | |
static void | SetOnRoomStatsCallback (Message< RtcRoomStats >.Handler handler) |
Sets the callback to regularly get room statistics after joining a room. More... | |
static void | SetOnWarnCallback (Message< int >.Handler handler) |
Sets the callback to get warning messages from the RTC engine. The warning codes and descriptions are given below. More... | |
static void | SetOnErrorCallback (Message< int >.Handler handler) |
Sets the callback to get error messages from the RTC engine. The error codes and descriptions are given below. More... | |
static void | SetOnRoomWarnCallback (Message< RtcRoomWarn >.Handler handler) |
Sets the callback to get warning messages from the room. More... | |
static void | SetOnRoomErrorCallback (Message< RtcRoomError >.Handler handler) |
Sets the callback to get error messages from the room. More... | |
static void | SetOnConnectionStateChangeCallback (Message< RtcConnectionState >.Handler handler) |
Sets the callback to get notified when the state of the connection to the RTC server has changed. More... | |
static void | SetOnUserMuteAudio (Message< RtcMuteInfo >.Handler handler) |
Sets the callback to get notified when the user has muted local audio. More... | |
static void | SetOnUserStartAudioCapture (Message< string >.Handler handler) |
Sets the callback to get notified when the user has started audio capture. More... | |
static void | SetOnUserStopAudioCapture (Message< string >.Handler handler) |
Sets the callback to get notified when the user has stopped audio capture. More... | |
static void | SetOnAudioPlaybackDeviceChange (Message< RtcAudioPlaybackDevice >.Handler handler) |
Sets the callback to get notified when the audio playback device has been changed. More... | |
static void | SetOnLocalAudioPropertiesReport (Message< RtcLocalAudioPropertiesReport >.Handler handler) |
Sets the callback to receive local audio report. More... | |
static void | SetOnRemoteAudioPropertiesReport (Message< RtcRemoteAudioPropertiesReport >.Handler handler) |
Sets the callback to receive remote audio report. More... | |
|
static |
Destroys a specified room. The resources occupied by the room will be released after destruction.
roomId | The ID of the room to destroy. |
|
static |
Enables audio properties report. Once enabled, you will receive audio report data regularly.
interval | The interval (in milliseconds) between one report and the next. You can set this parameter to 0 or any negative integer to stop receiving audio properties report. For any integer between (0, 100), the SDK will regard it as invalid and automatically set this parameter to 100 ; any integer equal to or greater than 100 is valid. |
|
static |
Gets the token required by JoinRoom
.
roomId | The ID of the room that the token is for. |
userId | The ID of the user that the token is for. |
ttl | The time-to-live (ttl) of the token. |
privileges | The dictionary that maps privilege to ttl. |
|
static |
Initializes the RTC engine.
Note: You should call this method before using the RTC service.
|
static |
Joins a user to a specified room.
roomId | The ID of the room to join. |
userId | The ID of user. |
token | The token required for joining the room. You can get the token by calling GetToken . |
roomProfileType | Room type:
|
isAutoSubscribeAudio | Whether to automatically subscribe to the audio in the room:
|
0
indicates success, and other values indicate failure. Error Code | Description |
---|---|
0 | Success. |
-1 | Invalid roomID or userId . |
-2 | The user is already in this room. |
-3 | The RTC engine is null. You should initialize the RTC engine before joining a room. |
-4 | Creating the room failed. |
|
static |
Leaves a specified room.
roomId | The ID of the room to leave. |
0
indicates success, and other values indicate failure.
Error Code | Description |
---|---|
0 | Success. |
-1 | The RTC engine is not initialized. |
-2 | The user is not in the room. |
|
static |
Mutes local audio to make one's voice unable to be heard be others in the same room.
rtcMuteState | The state of local audio:
|
|
static |
Publishes the local audio stream to a room, thereby making the voice heard be others in the same room.
roomId | The ID of the room that the local audio stream is published to. |
|
static |
Pauses all subscribed streams of a room. Once paused, the voice of users in the room is blocked so nothing can be heard from this room.
roomId | The ID of the room to pause subscribed streams for. |
|
static |
Resumes all subscribed streams of a room. Once resumed, the voice of users in the room can be heard again.
roomId | The ID of the room to resume subscribed streams for. |
|
static |
Sets the audio playback device.
device | The device ID. |
|
static |
Sets the audio scenario.
Note: Different audio scenarios can impact the voice quality and how the earphones work.
scenarioType | The audio scenario type:
|
|
static |
Sets the volume of the captured audio.
volume | The target volume. The valid value ranges from 0 to 400 . 100 indicates keeping the original volume. |
|
static |
Switches the in-ear monitoring mode on/off. Once the in-ear monitoring mode is enabled, one can hear their own voice.
mode | Whether to switch the in-ear monitoring mode on/off:
|
|
static |
Sets the volume for in-ear monitoring.
volume | The target volume. The valid value range from 0 to 400 . |
|
static |
Sets the callback to get notified when the audio playback device has been changed.
handler | The callback handler. |
|
static |
Sets the callback to get notified when the state of the connection to the RTC server has changed.
handler | The callback handler. |
|
static |
Sets the callback to get error messages from the RTC engine. The error codes and descriptions are given below.
Error Code | Description |
---|---|
-1000 | Invalid token. |
-1001 | Unknown error. |
-1002 | No permission to publish audio stream. |
-1004 | A user with the same user Id joined this room. You are kicked out of the room. |
-1005 | Incorrect configuration on the Developer Platform. |
-1070 | Subscribing to audio stream failed. Perhaps the number of subscribed audio streams has exceeded the limit. |
handler | The callback handler. |
|
static |
Sets the callback of JoinRoom
to get RtcJoinRoomResult
.
handler | The callback handler. |
|
static |
Sets the callback of LeaveRoom
to get RtcLeaveRoomResult
.
handler | The callback handler. |
|
static |
Sets the callback to receive local audio report.
handler | The callback handler. |
|
static |
Sets the callback to receive remote audio report.
handler | The callback handler. |
|
static |
Sets the callback to get error messages from the room.
handler | The callback handler. |
|
static |
Sets the callback to regularly get room statistics after joining a room.
handler | The callback handler. |
|
static |
Sets the callback to get warning messages from the room.
handler | The callback handler. |
|
static |
Sets the callback to get notified when someone has joined the room.
handler | The callback handler. |
|
static |
Sets the callback to get notified when someone has left the room.
handler | The callback handler. |
|
static |
Sets the callback to get notified when the user has muted local audio.
handler | The callback handler. |
|
static |
Sets the callback to get notified when the user has started audio capture.
handler | The callback handler. |
|
static |
Sets the callback to get notified when the user has stopped audio capture.
handler | The callback handler. |
|
static |
Sets the callback to get warning messages from the RTC engine. The warning codes and descriptions are given below.
Warning Code | Description |
---|---|
-2001 | Joining the room failed. |
-2002 | Publishing audio stream failed. |
-2003 | Subscribing to the audio stream failed because the stream cannot be found. |
-2004 | Subscribing to the audio stream failed due to server error. |
-2013 | When the people count in the room exceeds 500, the client will not be informed of user join and leave info anymore. |
-5001 | The camera permission is missing. |
-5002 | The microphone permission is missing. |
-5003 | Starting the audio capture device failed. |
-5004 | Starting the audio playback device failed. |
-5005 | No available audio capture device. |
-5006 | No available audio playback device. |
-5007 | The audio capture device failed to capture valid audio data. |
-5008 | Invalid media device operation. |
handler | The callback handler. |
|
static |
Sets the playback volume.
volume | The target volume. The valid value ranges from 0 to 400 . 100 indicates keeping the original volume. |
|
static |
Starts audio capture via the microphone.
|
static |
Stops audio capture.
|
static |
Stops publishing the local audio stream to a room, so others in the same room cannot hear the voice.
roomId | The ID of the room to stop publishing the local audio stream to. |
|
static |
Updates the token.
Note: Once a token's ttl is about to expire, you should update the token if you still want to stay in the room.
roomId | The ID of the room you are in. |
token | The token to update. |