connectOtherRoom method Null safety

Future<void> connectOtherRoom(
  1. String param
)

Request cross-room call (anchor competition)

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", the roomId must be set to 002 when anchor A calls ConnectOtherRoom().

  • userId: if anchor A in room "001" wants to co-anchor with anchor B in room "002", the userId must be set to the userId of anchor B when anchor A calls ConnectOtherRoom().

The result of requesting cross-room call will be returned through the onConnectOtherRoom() callback.

Sample call:

var object = new Map();

object'roomId' = 155;

object'userId' = '57890';

trtcCloud.connectOtherRoom(jsonEncode(object));

Parameters:

param Co-anchoring parameters in the format of JSON string. roomId indicates the target room number, and userId indicates the target user ID.

Implementation

Future<void> connectOtherRoom(String param) {
  return _channel.invokeMethod('connectOtherRoom', {
    "param": param,
  });
}