fix recording start stop

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-09-21 16:03:08 +08:00
parent eff5dd2e03
commit e74f155cb6
8 changed files with 28 additions and 29 deletions

View File

@@ -257,7 +257,7 @@ impl InvokeUiSession for FlutterHandler {
self.push_event(
"switch_display",
vec![
("display", &display.to_string()),
("display", &display.display.to_string()),
("x", &display.x.to_string()),
("y", &display.y.to_string()),
("width", &display.width.to_string()),
@@ -485,4 +485,4 @@ pub fn make_fd_flutter(id: i32, entries: &Vec<FileEntry>, only_count: bool) -> S
}
m.insert("total_size".into(), json!(n as f64));
serde_json::to_string(&m).unwrap_or("".into())
}
}

View File

@@ -93,7 +93,6 @@ function editOSPassword(login=false) {
}
var recording = false;
var recording_refresh = false;
class Header: Reactor.Component {
this var conn_note = "";
@@ -286,10 +285,12 @@ class Header: Reactor.Component {
}
event click $(span#recording) (_, me) {
handler.record_screen(!recording, display_width, display_height);
recording = !recording;
header.update();
if (recording) self.timer(100ms, function() { recording_refresh = true; handler.refresh_video(); });
if (recording)
handler.refresh_video();
else
handler.record_screen(false, display_width, display_height);
}
event click $(#screen) (_, me) {

View File

@@ -20,9 +20,7 @@ handler.setDisplay = function(x, y, w, h) {
display_origin_x = x;
display_origin_y = y;
adaptDisplay();
if (recording && !recording_refresh) handler.record_screen(true, w, h);
recording_refresh = false;
if (recording) handler.record_screen(true, w, h);
}
// in case toolbar not shown correclty
@@ -470,6 +468,7 @@ function self.closing() {
var (x, y, w, h) = view.box(#rectw, #border, #screen);
if (is_file_transfer) save_file_transfer_close_state();
if (is_file_transfer || is_port_forward || size_adapted) handler.save_size(x, y, w, h);
if (recording) handler.record_screen(false, display_width, display_height);
}
var qualityMonitor;