feat: 增加分辨率修改
This commit is contained in:
@@ -47,6 +47,16 @@ class _ControllerHomeState extends State<ControllerHome> {
|
||||
String _stats = '';
|
||||
double _videoAspect = 16 / 9;
|
||||
|
||||
/// 分辨率预设:width 为长边像素;0 表示被控端原生分辨率;
|
||||
/// height 传 0(由被控端按屏幕宽高比计算),fps 传 0(沿用当前帧率)。
|
||||
int _selectedResolution = 0;
|
||||
final List<Map<String, Object>> _resolutionOptions = const [
|
||||
{'label': '原始', 'width': 0, 'height': 0, 'fps': 0},
|
||||
{'label': '1080P', 'width': 1920, 'height': 0, 'fps': 0},
|
||||
{'label': '720P', 'width': 1280, 'height': 0, 'fps': 0},
|
||||
{'label': '480P', 'width': 854, 'height': 0, 'fps': 0},
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -320,6 +330,29 @@ class _ControllerHomeState extends State<ControllerHome> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 16,
|
||||
left: 16,
|
||||
child: CupertinoSegmentedControl<int>(
|
||||
groupValue: _selectedResolution,
|
||||
children: <int, Widget>{
|
||||
for (int i = 0; i < _resolutionOptions.length; i++)
|
||||
i: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
child: Text(_resolutionOptions[i]['label'] as String),
|
||||
),
|
||||
},
|
||||
onValueChanged: (int idx) {
|
||||
setState(() => _selectedResolution = idx);
|
||||
final o = _resolutionOptions[idx];
|
||||
_controller?.sendResolutionChange(
|
||||
o['width'] as int,
|
||||
o['height'] as int,
|
||||
o['fps'] as int,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user