setVideoDecoderConfig method
Future<int?>
setVideoDecoderConfig({
- required string streamId,
- required VideoDecoderConfig config,
@detail api
@brief 在订阅远端视频流之前,设置远端视频数据解码方式
@param streamId 远端流 ID,指定对哪一路视频流进行解码方式设置
@param config 视频解码方式,参看 VideoDecoderConfig{@link #VideoDecoderConfig}。
@return
- 0: 调用成功。
- < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明
@note
- 当你想要对远端流进行自定义解码时,你需要先调用 registerRemoteEncodedVideoFrameObserver{@link #RTCEngine#registerRemoteEncodedVideoFrameObserver} 注册远端视频流监测器,然后再调用该接口将解码方式设置为自定义解码。监测到的视频数据会通过 onRemoteEncodedVideoFrame{@link #IRemoteEncodedVideoFrameObserver#onRemoteEncodedVideoFrame} 回调出来。
- 自 3.56 起,要用于自动订阅场景下,你可以设置 key 中的 RoomId 和 UserId 为 nullptr,此时,通过此接口设置的解码方式根据 key 中的 StreamIndex 值,适用于所有的远端主流或屏幕流的解码方式。
Implementation
Future<int?> setVideoDecoderConfig(
{required string streamId, required VideoDecoderConfig config}) async {
$a() => ($instance as $p_a.RTCEngine).setVideoDecoderConfig(
streamId, t_VideoDecoderConfig.code_to_android(config));
$i() => ($instance as $p_i.ByteRTCEngine).setVideoDecoderConfig(
streamId, t_VideoDecoderConfig.code_to_ios(config));
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}