fix recording start stop
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
eff5dd2e03
commit
e74f155cb6
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2444,7 +2444,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "hwcodec"
|
name = "hwcodec"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/21pages/hwcodec#097a476a0ee249e28d99573899ed4c9c0c01f884"
|
source = "git+https://github.com/21pages/hwcodec#1f03d203eca24dc976c21a47228f3bc31484c2bc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen",
|
"bindgen",
|
||||||
"cc",
|
"cc",
|
||||||
|
@ -118,6 +118,7 @@ class _RemotePageState extends State<RemotePage>
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
debugPrint("REMOTE PAGE dispose ${widget.id}");
|
debugPrint("REMOTE PAGE dispose ${widget.id}");
|
||||||
_ffi.dialogManager.hideMobileActionsOverlay();
|
_ffi.dialogManager.hideMobileActionsOverlay();
|
||||||
|
_ffi.recordingModel.onClose();
|
||||||
_rawKeyFocusNode.dispose();
|
_rawKeyFocusNode.dispose();
|
||||||
_ffi.close();
|
_ffi.close();
|
||||||
_timer?.cancel();
|
_timer?.cancel();
|
||||||
|
@ -359,9 +359,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
|||||||
tooltip: value.start
|
tooltip: value.start
|
||||||
? translate('Stop session recording')
|
? translate('Stop session recording')
|
||||||
: translate('Start session recording'),
|
: translate('Start session recording'),
|
||||||
onPressed: () async {
|
onPressed: () => value.toggle(),
|
||||||
await value.toggle();
|
|
||||||
},
|
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
value.start
|
value.start
|
||||||
? Icons.pause_circle_filled
|
? Icons.pause_circle_filled
|
||||||
|
@ -197,13 +197,13 @@ class FfiModel with ChangeNotifier {
|
|||||||
_display.height = int.parse(evt['height']);
|
_display.height = int.parse(evt['height']);
|
||||||
if (old != _pi.currentDisplay) {
|
if (old != _pi.currentDisplay) {
|
||||||
parent.target?.cursorModel.updateDisplayOrigin(_display.x, _display.y);
|
parent.target?.cursorModel.updateDisplayOrigin(_display.x, _display.y);
|
||||||
parent.target?.recordingModel.switchDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remote is mobile, and orientation changed
|
// remote is mobile, and orientation changed
|
||||||
if ((_display.width > _display.height) != oldOrientation) {
|
if ((_display.width > _display.height) != oldOrientation) {
|
||||||
gFFI.canvasModel.updateViewStyle();
|
gFFI.canvasModel.updateViewStyle();
|
||||||
}
|
}
|
||||||
|
parent.target?.recordingModel.onSwitchDisplay();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -979,33 +979,35 @@ class RecordingModel with ChangeNotifier {
|
|||||||
bool _start = false;
|
bool _start = false;
|
||||||
get start => _start;
|
get start => _start;
|
||||||
|
|
||||||
switchDisplay() {
|
onSwitchDisplay() {
|
||||||
if (!isDesktop || !_start) return;
|
if (!isDesktop || !_start) return;
|
||||||
var id = parent.target?.id;
|
var id = parent.target?.id;
|
||||||
int? width = parent.target?.canvasModel.getDisplayWidth();
|
int? width = parent.target?.canvasModel.getDisplayWidth();
|
||||||
int? height = parent.target?.canvasModel.getDisplayWidth();
|
int? height = parent.target?.canvasModel.getDisplayWidth();
|
||||||
if (id == null || width == null || height == null) return;
|
if (id == null || width == null || height == null) return;
|
||||||
bind.sessionRecordScreen(
|
bind.sessionRecordScreen(id: id, start: true, width: width, height: height);
|
||||||
id: id, start: _start, width: width, height: height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> toggle() async {
|
toggle() {
|
||||||
if (!isDesktop) return;
|
if (!isDesktop) return;
|
||||||
var id = parent.target?.id;
|
var id = parent.target?.id;
|
||||||
int? width = parent.target?.canvasModel.getDisplayWidth();
|
if (id == null) return;
|
||||||
int? height = parent.target?.canvasModel.getDisplayWidth();
|
|
||||||
if (id == null || width == null || height == null) return;
|
|
||||||
|
|
||||||
await bind.sessionRecordScreen(
|
|
||||||
id: id, start: !_start, width: width, height: height);
|
|
||||||
_start = !_start;
|
_start = !_start;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
if (_start) {
|
if (_start) {
|
||||||
Future.delayed(const Duration(milliseconds: 100), () {
|
bind.sessionRefresh(id: id);
|
||||||
bind.sessionRefresh(id: id);
|
} else {
|
||||||
});
|
bind.sessionRecordScreen(id: id, start: false, width: 0, height: 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClose() {
|
||||||
|
if (!isDesktop) return;
|
||||||
|
var id = parent.target?.id;
|
||||||
|
if (id == null) return;
|
||||||
|
_start = false;
|
||||||
|
bind.sessionRecordScreen(id: id, start: false, width: 0, height: 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mouse button enum.
|
/// Mouse button enum.
|
||||||
@ -1174,7 +1176,7 @@ class FFI {
|
|||||||
Map<String, dynamic> event = json.decode(message.field0);
|
Map<String, dynamic> event = json.decode(message.field0);
|
||||||
await cb(event);
|
await cb(event);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('json.decode fail(): $e');
|
debugPrint('json.decode fail1(): $e, ${message.field0}');
|
||||||
}
|
}
|
||||||
} else if (message is Rgba) {
|
} else if (message is Rgba) {
|
||||||
imageModel.onRgba(message.field0, tabBarHeight);
|
imageModel.onRgba(message.field0, tabBarHeight);
|
||||||
|
@ -298,11 +298,9 @@ impl RecorderApi for HwRecorder {
|
|||||||
#[cfg(feature = "hwcodec")]
|
#[cfg(feature = "hwcodec")]
|
||||||
impl Drop for HwRecorder {
|
impl Drop for HwRecorder {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
log::info!("DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD {}", self.ctx.filename);
|
|
||||||
self.muxer.write_tail().ok();
|
self.muxer.write_tail().ok();
|
||||||
if !self.written || self.start.elapsed().as_secs() < MIN_SECS {
|
if !self.written || self.start.elapsed().as_secs() < MIN_SECS {
|
||||||
std::fs::remove_file(&self.ctx.filename).ok();
|
std::fs::remove_file(&self.ctx.filename).ok();
|
||||||
}
|
}
|
||||||
log::info!("DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD ok");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ impl InvokeUiSession for FlutterHandler {
|
|||||||
self.push_event(
|
self.push_event(
|
||||||
"switch_display",
|
"switch_display",
|
||||||
vec![
|
vec![
|
||||||
("display", &display.to_string()),
|
("display", &display.display.to_string()),
|
||||||
("x", &display.x.to_string()),
|
("x", &display.x.to_string()),
|
||||||
("y", &display.y.to_string()),
|
("y", &display.y.to_string()),
|
||||||
("width", &display.width.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));
|
m.insert("total_size".into(), json!(n as f64));
|
||||||
serde_json::to_string(&m).unwrap_or("".into())
|
serde_json::to_string(&m).unwrap_or("".into())
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,6 @@ function editOSPassword(login=false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var recording = false;
|
var recording = false;
|
||||||
var recording_refresh = false;
|
|
||||||
|
|
||||||
class Header: Reactor.Component {
|
class Header: Reactor.Component {
|
||||||
this var conn_note = "";
|
this var conn_note = "";
|
||||||
@ -286,10 +285,12 @@ class Header: Reactor.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
event click $(span#recording) (_, me) {
|
event click $(span#recording) (_, me) {
|
||||||
handler.record_screen(!recording, display_width, display_height);
|
|
||||||
recording = !recording;
|
recording = !recording;
|
||||||
header.update();
|
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) {
|
event click $(#screen) (_, me) {
|
||||||
|
@ -20,9 +20,7 @@ handler.setDisplay = function(x, y, w, h) {
|
|||||||
display_origin_x = x;
|
display_origin_x = x;
|
||||||
display_origin_y = y;
|
display_origin_y = y;
|
||||||
adaptDisplay();
|
adaptDisplay();
|
||||||
|
if (recording) handler.record_screen(true, w, h);
|
||||||
if (recording && !recording_refresh) handler.record_screen(true, w, h);
|
|
||||||
recording_refresh = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// in case toolbar not shown correclty
|
// in case toolbar not shown correclty
|
||||||
@ -470,6 +468,7 @@ function self.closing() {
|
|||||||
var (x, y, w, h) = view.box(#rectw, #border, #screen);
|
var (x, y, w, h) = view.box(#rectw, #border, #screen);
|
||||||
if (is_file_transfer) save_file_transfer_close_state();
|
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 (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;
|
var qualityMonitor;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user