@platform android
@detail api
@author luomingkang
@brief Listens for event callbacks related to the IGameRoom{@link #IGameRoom} instance by setting the event handler of this instance.
@param rtcRoomEventHandler Refer to IRTCRoomEventHandler{@link #IRTCRoomEventHandler}.
@return
- 0: Success.
- <0: Fail. See ReturnStatus{@link #ReturnStatus} for more details
@detail api
@author luomingkang
@brief Whether to receive the audio stream of a specific user. Call this insterface will not affect the state of the speaker or other audio output devices.
@param userId User ID, a non-empty string with a maximum length of 128 bytes. The supported character set range is:
1. 26 capital letters A ~ Z
2. 26 lowercase letters a ~ z
3. 10 numbers 0 ~ 9
4. Underscore "_", at sign "@", minus sign "-"
@param enable
- true:Receive the user's audio stream.
- false:Default setting. Do not receive the user's audio stream. The speaker will not be muted and can still be used for other audio outputs.
@return
- 0: Success.
- -2: Failure. The provided userId is an empty string.
@detail api
@author luomingkang
@brief Starts or stops sending audio streams. Calling this interface does not affect audio capture. Other users in the same room will receive the corresponding callback.
@param enable Whether to send the saudio data:
- true: Starts sending audio data.
- false: Default setting. Stops sending audio data.
@return
- 0: It means that the parameter check has passed, but it does not mean that opening the microphone will succeed. For example, the room does not exist.
- -3: Failure. Not joined a room.
@note Cannot be called at the same time as EnableMicrophone{@link #IGameRoom#EnableMicrophone}.
@detail api
@author luomingkang
@brief Turns on/off the microphone after joining a game room. Other users in the same room will receive callback OnAudioDeviceStateChanged{@link #IRTCEngineEventHandler#OnAudioDeviceStateChanged}.
@param enable Whether to turn on the microphone:
- true: Turns on the microphone, captures and publishes audio stream.
- false: Default setting. Turns off the microphone and stops capturing and publishing audio streams.
@return
- 0: Success.
- -3: Failure. Not joined the room.
@note Cannot be called simultaneously with enableAudioSend{@link #IGameRoom#enableAudioSend}.
@detail api
@author luomingkang
@brief Turns on/off the speaker after joining a game room.
@param enable Whether to turn on the speaker:
- true: Turns on the speaker and subscribes to audio streams of all remote users.
- false: Default setting. Turns off the speaker and unsubscribes audio streams from all remote users.
@return
- 0: Success.
- -3: Failure. Not joined a room.
@detail api
@author luomingkang
@brief Gets the range audio instance of the game room.
@return API call result:
- IRangeAudio: Success. You will get an IRangeAudio{@link #IRangeAudio} returned from the SDK.
- null: Failure. The current SDK does not offer range audio function.
@note The first time this API is called must be between you create a room and you actually enter the room. Refer to Range Voice for more information.
@platform ios
@detail api
@author luomingkang
@brief Listens for event callbacks related to the ByteRTCGameRoom{@link #ByteRTCGameRoom} instance by setting the event handler of this instance.
@param roomDelegate Refer to ByteRTCRoomDelegate{@link #ByteRTCRoomDelegate}.
@return
- 0: Success.
- < 0 : Fail. See ByteRTCReturnStatus{@link #ByteRTCReturnStatus} for more details
@detail api
@author luomingkang
@brief Joins a game room.
After creating a room by calling createGameRoom{@link #RTCEngine#createGameRoom}, call this API to join the room and make audio calls with other users in the room.
@param token Dynamic key. It is used for authentication and verification of users entering the room.
You need to bring Token to enter the room. When testing, you can use the console to generate temporary tokens. The official launch requires the use of the key SDK to generate and issue tokens at your server level. See Use Token to complete authentication for token validity and generation method.
Apps with different AppIDs are not interoperable.
Make sure that the AppID used to generate the Token is the same as the AppID used to create the engine, otherwise it will cause the join room to fail.
@param userInfo User information. See UserInfo{@link #UserInfo}.
@return
- 0: Success.
- Local users receive notifications of the room state via onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged}.
- Local users receive notifications of the subscribed-stream state via onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio}.
- Local users receive notifications of the published-stream state via onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio}.
- -1: RoomID/userI nfo.uid contains invalid parameters.
- -2: Already in the room. After the interface call is successful, as long as the return value of 0 is received and leaveRoom{@link #IGameRoom#leaveRoom} is not called successfully, this return value is triggered when the room entry interface is called again, regardless of whether the filled room ID and user ID are duplicated.
The reason for the failure will be communicated via the onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} callback.
@note
- In the same room with the same App ID, the user ID of each user must be unique. If two users have the same user ID, the user who entered the room later will kick the user who entered the room out of the room, and the user who entered the room will receive the onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} callback notification. For the error type. See kErrorCodeDuplicateLogin in ERROR_CODE_DUPLICATE_LOGIN{@link #ErrorCode#ERROR_CODE_DUPLICATE_LOGIN}.
- After the user successfully joins the room, the SDK may lose connection to the server in case of poor local network conditions. At this point, onConnectionStateChanged{@link #IRTCEngineEventHandler#onConnectionStateChanged} callback will be triggered and the SDK will automatically retry until it successfully reconnects to the server. After successful reconnection, onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} callback notification will be received locally.
@detail api
@author luomingkang
@brief Leaves the game room.
The user calls this method to leave the room, end the call process, and release all call-related resources.
@return
- 0: Success. If the user is a host:
- The other participants receive onUserLeave{@link #IRTCRoomEventHandler#onUserLeave} callback.
- The publishing streams stop and the other participants receive notifications of the stream states via onAudioPublishStateChanged{@link #IRTCRoomEventHandler#onAudioPublishStateChanged} callback.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details
@note This method is an asynchronous operation, and the call returns without actually exiting the room. After you actually exit the room, you will receive a callback notification from onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} locally. If the engine is destroyed immediately after this method is called, the SDK will not be able to trigger the onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} callback.
@detail api
@author luomingkang
@brief Adjusts the audio playback volume from all the remote users in a room.
@param volume Ratio(%) of playback volume to original volume, in the range 0, 400, with overflow protection.
To ensure the audio quality, we recommend setting the volume to 100.
- 0: mute
- 100: original volume. Default value.
- 400: Up to 4 times the original volume (with overflow protection)
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details
@note Suppose a remote user A is always within the range of the target user whose playback volume will be adjusted,
- If you use both this method and setRemoteAudioPlaybackVolume{@link #RTCEngine#setRemoteAudioPlaybackVolume}, the volume that the local user hears from user A is the volume set by the method called later.
- If you use both this method and setPlaybackVolume{@link #RTCEngine#setPlaybackVolume}, the volume that the local user hears from user A is the overlay of both settings.
@detail api
@author luomingkang
@brief Updates the Token of the game room.
You must call this API to update token to ensure the RTC call to continue when you receive onTokenWillExpire{@link #IRTCRoomEventHandler#onTokenWillExpire}, onPublishPrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onPublishPrivilegeTokenWillExpire}, or onSubscribePrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onSubscribePrivilegeTokenWillExpire}.
@param token Valid token.
If the Token is invalid, you will receive onRoomStateChanged{@link #IRTCRoomEventHandler#onRoomStateChanged} with the error code of -1010.
@return API call result:
- 0: Success.
- <0: Failure. See ReturnStatus{@link #ReturnStatus} for specific reasons.
@note Do not call both updateToken{@link #IGameRoom#updateToken} and joinRoom{@link #IGameRoom#joinRoom} to update the Token. If you fail to join the room or have been removed from the room due to an expired or invalid Token, call joinRoom{@link #IGameRoom#joinRoom} with a valid token to rejoin the room.