enableEncSmallVideoStream method

Future<int?> enableEncSmallVideoStream(
  1. bool enable,
  2. TRTCVideoEncParam smallVideoEncParam
)

Enable dual-channel encoding mode for large and small images, which is convenient for users in different network conditions to subscribe to different images

If the current user is a major role (such as anchor, teacher, or host) in the room and uses PC or Mac, this mode can be enabled. In this mode, the current user will output two channels of video streams, i.e., HD and Smooth, at the same time (only one channel of audio stream will be output though). This mode will consume more network bandwidth and CPU computing resources.

As for remote audience in the same room:

  • If the downstream network is good, they can select the HD big image.
  • If the downstream network is poor, they can select the Smooth small image.

Note: dual-channel encoding will consume more CPU resources and network bandwidth; therefore, this feature can be enabled on macOS, Windows, or high-spec tablets, but should not be enabled on phones.

Parameters:

enable Whether to enable small image encoding. Default value: false

smallVideoEncParam Video parameters of small image stream. For more information, please see the definition of TRTCVideoEncParam

Returned value:

0: success; -1: the big image is already of the lowest image quality

Platform not supported:

  • Windows

Implementation

Future<int?> enableEncSmallVideoStream(
    bool
        enable, // Whether to enable small image encoding. Default value: false
    TRTCVideoEncParam
        smallVideoEncParam // Video parameters of small image stream
    ) {
  return _channel.invokeMethod('enableEncSmallVideoStream', {
    "enable": enable,
    "smallVideoEncParam": jsonEncode(smallVideoEncParam),
  });
}