ByteRTCGameRoom class

Inheritance
  • Object
  • NativeClass
  • ByteRTCGameRoom

Constructors

ByteRTCGameRoom([NativeClassOptions? options])

Properties

$resource → NativeResource
no setterinherited
delegate FutureOr<ByteRTCGameRoomDelegate?>
@detail callback
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
ready Future<void>
Whether the instance is initialized
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

destroy() FutureOr<void>
@detail api @author luomingkang @brief Leave and destroy the room instance created by calling createGameRoom:roomConfig:{@link #ByteRTCEngine#createGameRoom:roomConfig}.
override
enableAudioReceive(NSString userId, BOOL enable) FutureOr<int>
@detail api @author luomingkang @brief Whether to subscribe to the audio stream of a specified user. @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 Whether to subscribe to the audio stream:
- true:Subscribe to the audio stream of the specified user. - false:Default setting, unsubscribe to the audio stream of the specified user. @return 0: Success. -2: Failure. The provided userId is an empty string.
enableAudioSend(BOOL enable) FutureOr<int>
@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: Success. - -3: Failure. Not joined a room. @note Cannot be called simultaneously with enableMicrophone:{@link #ByteRTCGameRoom#enableMicrophone}.
enableMicrophone(BOOL enable) FutureOr<int>
@detail api @author luomingkang @brief Turns on/off the microphone after joining a game room. Other users in the same room will receive callback rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error}. @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 #ByteRTCGameRoom#enableAudioSend}.
enableSpeakerphone(BOOL enable) FutureOr<int>
@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.
getRangeAudio() FutureOr<ByteRTCRangeAudio>
@detail api @author luomingkang @brief Gets range audio instance in the game room. @return API call result:
- ByteRTCRangeAudio: Success. You will get a ByteRTCRangeAudio{@link #ByteRTCRangeAudio} 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 creating a room and actually entering the room. Refer to Range Voice for more information.
joinRoom(NSString token, ByteRTCUserInfo userInfo) FutureOr<int>
@detail api @author luomingkang @brief Join the game room.
After creating a room by calling createGameRoom:roomConfig:{@link #ByteRTCEngine#createGameRoom:roomConfig}, call this API to join the room and make audio calls with other users in the room. @param token Dynamic key for authenticating the logged-in user.
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 Authentication with Token for token validity and generation method.
- Apps with different App IDs cannot communicate with each other. - Make sure that the App ID used to generate the Token is the same as the App ID used to create the engine, otherwise it will cause the join room to fail. @param userInfo User information. See ByteRTCUserInfo{@link #ByteRTCUserInfo}. @return - 0: Success. - Local users receive notifications of the room state via rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo}. - If the local user is also a visible user, the other participants receive rtcRoom:onUserJoined:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserJoined} callback. - -1: Room_id/user_info.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 #ByteRTCGameRoom#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 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo} 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 rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo} callback notification. For the error type. See ByteRTCErrorCodeDuplicateLogin in ByteRTCErrorCode{@link #ByteRTCErrorCode} . - 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, rtcEngine:onConnectionStateChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onConnectionStateChanged} callback will be triggered and the SDK will automatically retry until it successfully reconnects to the server. After a successful reconnection, you will receive a local rtcRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChanged:withUid:state:extraInfo} callback notification.
leaveRoom() FutureOr<int>
@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 rtcRoom:onUserLeave:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onUserLeave:reason} callback. - The publishing streams stop and the other participants receive notifications of the stream states via rtcRoom:onVideoPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onVideoPublishStateChanged:info:state:reason}, rtcRoom:onAudioPublishStateChanged:info:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onAudioPublishStateChanged:info:state:reason}, rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenVideoPublishStateChanged:userId:state:reason} and/or rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onScreenAudioPublishStateChanged:userId:state:reason} callback. - < 0 : Fail. See ByteRTCReturnStatus{@link #ByteRTCReturnStatus} for more details @note - After joining a room, you must call this method to end the call if you need to start another call. - 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 rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChangedWithReason:withUid:state:reason} .
nativeCall<T>(String method, [List? args, NativeMethodMeta? meta]) Future<T>
Call instance method
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendInstanceGet<T>(String property) Future<T>
Get instance property
inherited
sendInstancePropertiesGet(dynamic nativeClass) Future<Map<String, dynamic>>
Get instance properties
inherited
sendInstanceSet(String property, dynamic value) Future<void>
Set instance property
inherited
setRemoteRoomAudioPlaybackVolume(NSInteger volume) FutureOr<int>
@detail api @author zhangcaining @brief Adjusts the audio playback volume from all the remote users in a game 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 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 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:volume:{@link #ByteRTCEngine#setRemoteAudioPlaybackVolume:volume}, 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 #ByteRTCEngine#setPlaybackVolume}, the volume that the local user hears from user A is the overlay of both settings.
setRTCGameRoomDelegate(id<ByteRTCGameRoomDelegate> roomDelegate) FutureOr<int>
@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
toString() String
A string representation of this object.
inherited
updateResource(NativeResource resource) → void
inherited
updateToken(NSString token) FutureOr<int>
@detail api @author luomingkang @brief Update the game room token.
You must call this API to update token to ensure the RTC call to continue when you receive onTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onTokenWillExpire}, onPublishPrivilegeTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onPublishPrivilegeTokenWillExpire}, or onSubscribePrivilegeTokenWillExpire:{@link #ByteRTCGameRoomDelegate#onSubscribePrivilegeTokenWillExpire}. @param token Valid token.
If the Token is invalid, you will receive rtcRoom:onRoomStateChangedWithReason:withUid:state:reason:{@link #ByteRTCGameRoomDelegate#rtcRoom:onRoomStateChangedWithReason:withUid:state:reason} with the error code of -1010. @return - 0: Success - !0: Failure @note Do not call both updateToken:{@link #ByteRTCGameRoom#updateToken} and joinRoom:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo} 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:userInfo:{@link #ByteRTCGameRoom#joinRoom:userInfo} with a valid token to rejoin the room.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

codegen_$namespace → dynamic
no setter