setMixTranscodingConfig method
Set the parameters for MixTranscoding in the cloud
If you enable Enable Bypass Streaming on the Feature Configuration page in the real-time audio and video Console, Each screen in the room will have a default live stream CDN address
There may be more than one streamer in a live stream, and each streamer has their own picture and sound, but for CDN viewers, they only need to live stream all the way Therefore, you need to mix multiple audio and video streams into a standard live stream, which requires transcoding
When you call this API, the SDK sends a command to Tencent Cloud's transcoding server to mix multiple audio and video streams in the room into one. You can use the mixStreams parameter to adjust the position of each image and whether to mix only sound, and you can also use parameters such as videoWidth, videoHeight, and videoBitrate to control the encoding parameters of the mixed audio and video streams
【Video1】=> Decode ====> \ \ 【Video2】=> Decode => video mixing => Encode => 【Mixed Video】 / 【Video3】=> Decode ====> / 【Audio1】=> Decode ====> \ \ 【Audio2】=> Decode => audio mixing => Encode => 【Mixed Audio】 / 【Audio3】=> Decode ====> /
Reference: Cloud Mixtranscoding
Note:
- Only RTC mode is supported
- Cloud transcoding will introduce a certain CDN viewing delay, which will increase by about 1-2 seconds
- The user who calls this function will mix the multi-channel image in the microphone connection to the current screen or the streamId specified in the config
- Please note that if you are still in the room and no longer need to mix streams, be sure to pass null to cancel, because after you initiate stream mixing, the cloud stream mixing module will start working, and failure to cancel the mix in time may cause unnecessary billing losses
- Rest assured, the mix-in status will be automatically canceled when you check out
Parameter:
config
Please refer to V2TXLiveTranscodingConfig. If null is passed, the cloud blending transcoding is canceled
Return:
- V2TXLIVE_OK: Succeed
- V2TXLIVE_ERROR_REFUSED: If stream ingest is not enabled, you are not allowed to set the MixTranscoding parameter
Implementation
Future<V2TXLiveCode> setMixTranscodingConfig(V2TXLiveTranscodingConfig? config) async {
var result = await _channel.invokeMethod('setMixTranscodingConfig',
{"config": config?.toJson() ?? {}});
return _liveCodeWithResult(result);
}