setMixTranscodingConfig method

Future<void> setMixTranscodingConfig(
  1. TRTCTranscodingConfig? config
)

Set the layout and transcoding parameters of On-Cloud MixTranscoding

If you have enabled the "Enable Relayed Push" option on the "Function Configuration" page in the TRTC console, then every channel in the room will have a default CSS CDN address.

There may be multiple anchors in a room, each sending their own video and audio, but CDN audience needs only one live stream. Therefore, you need to mix multiple audio/video streams into one standard live stream, which requires mixtranscoding.

When you call the setMixTranscodingConfig() API, the SDK will send a command to the Tencent Cloud transcoding server to combine multiple audio/video streams in the room into one stream. You can use the "mixUsers" parameter to set the position of each channel of image and specify whether to mix only audio. You can also set the encoding parameters of the mixed stream, including "videoWidth", "videoHeight", and "videoBitrate".

For more information, please see On-Cloud MixTranscoding.

Parameters:

config For more information, please see the description of TRTCTranscodingConfig in trtc_cloud_def.dart. If null is passed in, On-Cloud MixTranscoding will be canceled.

Not supported on:

  • web

Implementation

Future<void> setMixTranscodingConfig(TRTCTranscodingConfig? config) {
  if (kIsWeb) {
    return _cloudChannel!.invokeMethod(
        'setMixTranscodingConfig', jsonEncode(config));
  }
  return _cloudChannel!.invokeMethod('setMixTranscodingConfig', {
    "config": jsonEncode(config),
  });
}