auto record outgoing (#9711)

* Add option auto record outgoing session
* In the same connection, all displays and all windows share the same
  recording state.

todo:

Android check external storage permission

Known issue:

* Sciter old issue, stop the process directly without stop record, the record file can't play.

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-10-21 14:34:06 +08:00
committed by GitHub
parent 289076aa70
commit e8187588c1
65 changed files with 442 additions and 322 deletions

View File

@@ -301,26 +301,12 @@ class Header: Reactor.Component {
}
event click $(span#recording) (_, me) {
recording = !recording;
header.update();
handler.record_status(recording);
// 0 is just a dummy value. It will be ignored by the handler.
if (recording) {
handler.refresh_video(0);
if (handler.version_cmp(pi.version, '1.2.4') >= 0) handler.record_screen(recording, pi.current_display, display_width, display_height);
}
else {
handler.record_screen(recording, pi.current_display, display_width, display_height);
}
handler.record_screen(!recording)
}
event click $(#screen) (_, me) {
if (pi.current_display == me.index) return;
if (recording) {
recording = false;
handler.record_screen(false, pi.current_display, display_width, display_height);
handler.record_status(false);
}
handler.switch_display(me.index);
}
@@ -518,6 +504,7 @@ if (!(is_file_transfer || is_port_forward)) {
handler.updatePi = function(v) {
pi = v;
recording = handler.is_recording();
header.update();
if (is_port_forward) {
view.windowState = View.WINDOW_MINIMIZED;
@@ -682,3 +669,8 @@ handler.setConnectionType = function(secured, direct) {
direct_connection: direct,
});
}
handler.updateRecordStatus = function(status) {
recording = status;
header.update();
}

View File

@@ -253,10 +253,12 @@ class Enhancements: Reactor.Component {
var root_dir = show_root_dir ? handler.video_save_directory(true) : "";
var ts0 = handler.get_option("enable-record-session") == '' ? { checked: true } : {};
var ts1 = handler.get_option("allow-auto-record-incoming") == 'Y' ? { checked: true } : {};
var ts2 = handler.get_option("allow-auto-record-outgoing") == 'Y' ? { checked: true } : {};
msgbox("custom-recording", translate('Recording'),
<div .form>
<div><button|checkbox(enable_record_session) {ts0}>{translate('Enable recording session')}</button></div>
<div><button|checkbox(auto_record_incoming) {ts1}>{translate('Automatically record incoming sessions')}</button></div>
<div><button|checkbox(auto_record_outgoing) {ts2}>{translate('Automatically record outgoing sessions')}</button></div>
<div>
{show_root_dir ? <div style="word-wrap:break-word"><span>{translate("Incoming")}:&nbsp;&nbsp;</span><span>{root_dir}</span></div> : ""}
<div style="word-wrap:break-word"><span>{translate(show_root_dir ? "Outgoing" : "Directory")}:&nbsp;&nbsp;</span><span #folderPath>{user_dir}</span></div>
@@ -267,6 +269,7 @@ class Enhancements: Reactor.Component {
if (!res) return;
handler.set_option("enable-record-session", res.enable_record_session ? '' : 'N');
handler.set_option("allow-auto-record-incoming", res.auto_record_incoming ? 'Y' : '');
handler.set_option("allow-auto-record-outgoing", res.auto_record_outgoing ? 'Y' : '');
handler.set_option("video-save-directory", $(#folderPath).text);
});
}

View File

@@ -335,6 +335,10 @@ impl InvokeUiSession for SciterHandler {
}
fn next_rgba(&self, _display: usize) {}
fn update_record_status(&self, start: bool) {
self.call("updateRecordStatus", &make_args!(start));
}
}
pub struct SciterSession(Session<SciterHandler>);
@@ -478,8 +482,7 @@ impl sciter::EventHandler for SciterSession {
fn save_image_quality(String);
fn save_custom_image_quality(i32);
fn refresh_video(i32);
fn record_screen(bool, i32, i32, i32);
fn record_status(bool);
fn record_screen(bool);
fn get_toggle_option(String);
fn is_privacy_mode_supported();
fn toggle_option(String);
@@ -496,6 +499,7 @@ impl sciter::EventHandler for SciterSession {
fn close_voice_call();
fn version_cmp(String, String);
fn set_selected_windows_session_id(String);
fn is_recording();
}
}