This commit is contained in:
parent
cf9880281f
commit
4dd5fd95fe
1 changed files with 11 additions and 3 deletions
|
@ -18,8 +18,7 @@ function script_load()
|
||||||
long long last_input_received(void);
|
long long last_input_received(void);
|
||||||
]]
|
]]
|
||||||
monitor = ffi.load(script_path() .. "monitor.dll")
|
monitor = ffi.load(script_path() .. "monitor.dll")
|
||||||
|
start_loop()
|
||||||
obs.timer_add(check_restart, wait_time * 1000)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function script_unload()
|
function script_unload()
|
||||||
|
@ -28,9 +27,17 @@ function script_unload()
|
||||||
monitor.stop_hook()
|
monitor.stop_hook()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function start_loop()
|
||||||
|
print("Start idle")
|
||||||
|
obs.timer_add(check_restart, wait_time * 1000)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function check_restart()
|
function check_restart()
|
||||||
obs.timer_remove(check_restart)
|
obs.timer_remove(check_restart)
|
||||||
|
|
||||||
|
print("Start check every " .. idle_time .. "secs")
|
||||||
|
|
||||||
monitor.start_hook()
|
monitor.start_hook()
|
||||||
obs.timer_add(check_idle, idle_time * 1000)
|
obs.timer_add(check_idle, idle_time * 1000)
|
||||||
end
|
end
|
||||||
|
@ -43,6 +50,7 @@ function check_idle()
|
||||||
if current_time - last_input_time >= idle_time then
|
if current_time - last_input_time >= idle_time then
|
||||||
monitor.stop_hook()
|
monitor.stop_hook()
|
||||||
|
|
||||||
|
print("No activity detected, restart replay buffer")
|
||||||
obs.obs_frontend_replay_buffer_stop()
|
obs.obs_frontend_replay_buffer_stop()
|
||||||
obs.timer_add(start_replay_buffer, 2000)
|
obs.timer_add(start_replay_buffer, 2000)
|
||||||
else
|
else
|
||||||
|
@ -54,5 +62,5 @@ function start_replay_buffer()
|
||||||
obs.timer_remove(start_replay_buffer)
|
obs.timer_remove(start_replay_buffer)
|
||||||
obs.obs_frontend_replay_buffer_start()
|
obs.obs_frontend_replay_buffer_start()
|
||||||
|
|
||||||
obs.timer_add(check_restart, wait_time * 1000)
|
start_loop()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue