connectOtherRoom abstract method
Request cross-room call
In TRTC, two anchors in different rooms can use the "cross-room call" feature to co-anchor across the rooms. They can engage in "co-anchoring competition" without the need to exit their own rooms.
For example, when anchor A in room "001" uses connectOtherRoom to successfully call anchor B in room "002",
all users in room "001" will receive the onRemoteUserEnterRoom(B)
and onUserVideoAvailable(B,true)
callbacks of anchor B,
and all users in room "002" will receive the onRemoteUserEnterRoom(A)
and onUserVideoAvailable(A,true)
callbacks of anchor A.
In short, cross-room call is to share between two anchors in different rooms, so that users in either room can see both of them.
For the sake of compatibility of subsequent extended fields for cross-room call, parameters in JSON format are used currently and must contain at least two fields:
-
roomId
: if anchor A in room "001" wants to co-anchor with anchor B in room "002", theroomId
must be set to002
when anchor A calls connectOtherRoom . -
userId
: if anchor A in room "001" wants to co-anchor with anchor B in room "002", theuserId
must be set to theuserId
of anchor B when anchor A calls connectOtherRoom .
The result of requesting cross-room call will be returned through the TRTCCloudListener.onConnectOtherRoom callback.
Sample call:
var object = new Map();
object['roomId'] = 155;
object['userId'] = '57890';
Parameters:
- param (String): You need to pass in a string parameter in JSON format:
- roomId (int): Represents the room ID in numeric format.
- strRoomId (String): Represents the room ID in string format.
- userId (String): Represents the user ID of the target anchor.
Implementation
void connectOtherRoom(String param);