setVideoSettings method
set video Settings
expectedFrameRate:HaishinKit 2.2.2+,写入编码期望帧率并进入 RTMP onMetaData 的 framerate。
bitRateMode:average(默认)、constant(iOS 16+)、variable(iOS 26+,对应 VideoToolbox VBR)。
Only supports ios
Implementation
Future<void> setVideoSettings(
{int? bitrate,
int? width,
int? height,
int? frameInterval,
String? profileLevel,
double? expectedFrameRate,
String? bitRateMode}) async {
if (!value.isInitialized! || _isDisposed) {
throw CameraException(
'Uninitialized CameraController',
'setVideoSettings was called on uninitialized CameraController',
);
}
if (!Platform.isIOS) {
throw CameraException(
'Unsupported platforms.',
'setVideoSettings Only supports Ios.',
);
}
try {
await _channel.invokeMethod<void>(
'setVideoSettings',
<String, dynamic>{
"bitrate": bitrate,
"width": width,
"height": height,
"frameInterval": frameInterval,
"profileLevel": profileLevel,
if (expectedFrameRate != null) "expectedFrameRate": expectedFrameRate,
if (bitRateMode != null) "bitRateMode": bitRateMode,
},
);
} on PlatformException catch (e) {
throw CameraException(e.code, e.message);
}
}