updateChannelMediaRelay method Null safety

Future<int> updateChannelMediaRelay(
  1. NERtcChannelMediaRelayConfiguration config
)

Updates the information about the destination room for media stream relay.

You can call this method to relay the media stream to multiple rooms or exit the current room.

  • You can call this method to change the destination room, for example, adding or removing the destination room.
  • After you call this method, the SDK triggers onMediaRelayStatesChange and onMediaRelayReceiveEvent. The callback returns the status and events about the current relayed media streams across rooms.

Before you call the method, you must join the room and relay the media stream across rooms by calling startChannelMediaRelay. Before you call the method, you must configure the destination room by specifying NERtcChannelMediaRelayConfiguration.destMediaInfo in NERtcChannelMediaRelayConfiguration. Up to 4 destination room are supported in cross-room media streaming relay. Before you call this method, you can remove unwanted rooms and add new destination rooms by specifying NERtcChannelMediaRelayConfiguration.destMediaInfo in NERtcChannelMediaRelayConfiguration.

config specifies the configuration for media stream relay across rooms. For more information, see NERtcChannelMediaRelayConfiguration.

Implementation

Future<int> updateChannelMediaRelay(
    NERtcChannelMediaRelayConfiguration config) async {
  StartOrUpdateChannelMediaReplayRequest request =
      StartOrUpdateChannelMediaReplayRequest();
  request.sourceMediaInfo = config.sourceMediaInfo?._toMap();
  request.destMediaInfo = {};
  config.destMediaInfo.forEach((key, value) {
    request.destMediaInfo![key] = value._toMap();
  });
  IntValue reply = await _api.updateChannelMediaRelay(request);
  return reply.value ?? -1;
}