hide recording button if using av1

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-06-29 21:26:25 +08:00
parent 5b1d2abb71
commit c2023e8ca3
4 changed files with 22 additions and 8 deletions

View File

@ -434,7 +434,7 @@ class _RemoteToolbarState extends State<RemoteToolbar> {
toolbarItems.add(_ChatMenu(id: widget.id, ffi: widget.ffi));
toolbarItems.add(_VoiceCallMenu(id: widget.id, ffi: widget.ffi));
}
toolbarItems.add(_RecordMenu());
toolbarItems.add(_RecordMenu(ffi: widget.ffi));
toolbarItems.add(_CloseMenu(id: widget.id, ffi: widget.ffi));
return Column(
mainAxisSize: MainAxisSize.min,
@ -1219,11 +1219,12 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
}
for (final r in resolutions) {
if (r.width == _localResolution!.width && r.height == _localResolution!.height) {
if (r.width == _localResolution!.width &&
r.height == _localResolution!.height) {
return r;
}
}
return null;
}
@ -1467,16 +1468,17 @@ class _VoiceCallMenu extends StatelessWidget {
}
class _RecordMenu extends StatelessWidget {
const _RecordMenu({Key? key}) : super(key: key);
final FFI ffi;
const _RecordMenu({Key? key, required this.ffi}) : super(key: key);
@override
Widget build(BuildContext context) {
var ffi = Provider.of<FfiModel>(context);
var ffiModel = Provider.of<FfiModel>(context);
var recordingModel = Provider.of<RecordingModel>(context);
final visible =
recordingModel.start || ffi.permissions['recording'] != false;
recordingModel.start || ffiModel.permissions['recording'] != false;
if (!visible) return Offstage();
return _IconMenuButton(
final menuButton = _IconMenuButton(
assetName: 'assets/rec.svg',
tooltip: recordingModel.start
? 'Stop session recording'
@ -1489,6 +1491,14 @@ class _RecordMenu extends StatelessWidget {
? _ToolbarTheme.hoverRedColor
: _ToolbarTheme.hoverBlueColor,
);
return ChangeNotifierProvider.value(
value: ffi.qualityMonitorModel,
child: Consumer<QualityMonitorModel>(
builder: (context, model, child) => Offstage(
// If already started, AV1->Hidden/Stop, Other->Start, same as actual
offstage: model.data.codecFormat == 'AV1',
child: menuButton,
)));
}
}

View File

@ -101,6 +101,9 @@ impl DerefMut for Recorder {
impl Recorder {
pub fn new(mut ctx: RecorderContext) -> ResultType<Self> {
if ctx.format == CodecFormat::AV1 {
bail!("not support av1 recording");
}
ctx.set_filename()?;
let recorder = match ctx.format {
CodecFormat::VP8 | CodecFormat::VP9 => Recorder {

View File

@ -144,7 +144,7 @@ class Header: Reactor.Component {
<span #action>{svg_action}</span>
<span #display>{svg_display}</span>
<span #keyboard>{svg_keyboard}</span>
{recording_enabled ? <span #recording>{recording ? svg_recording_on : svg_recording_off}</span> : ""}
{recording_enabled && qualityMonitorData[4] != "AV1" ? <span #recording>{recording ? svg_recording_on : svg_recording_off}</span> : ""}
{this.renderKeyboardPop()}
{this.renderDisplayPop()}
{this.renderActionPop()}

View File

@ -522,6 +522,7 @@ handler.updateQualityStatus = function(speed, fps, delay, bitrate, codec_format)
bitrate ? qualityMonitorData[3] = bitrate:null;
codec_format ? qualityMonitorData[4] = codec_format:null;
qualityMonitor.update();
if (codec_format) header.update();
}
handler.setPermission = function(name, enabled) {