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);
|
||||
]]
|
||||
monitor = ffi.load(script_path() .. "monitor.dll")
|
||||
|
||||
obs.timer_add(check_restart, wait_time * 1000)
|
||||
start_loop()
|
||||
end
|
||||
|
||||
function script_unload()
|
||||
|
@ -28,9 +27,17 @@ function script_unload()
|
|||
monitor.stop_hook()
|
||||
end
|
||||
|
||||
function start_loop()
|
||||
print("Start idle")
|
||||
obs.timer_add(check_restart, wait_time * 1000)
|
||||
end
|
||||
|
||||
|
||||
function check_restart()
|
||||
obs.timer_remove(check_restart)
|
||||
|
||||
print("Start check every " .. idle_time .. "secs")
|
||||
|
||||
monitor.start_hook()
|
||||
obs.timer_add(check_idle, idle_time * 1000)
|
||||
end
|
||||
|
@ -43,6 +50,7 @@ function check_idle()
|
|||
if current_time - last_input_time >= idle_time then
|
||||
monitor.stop_hook()
|
||||
|
||||
print("No activity detected, restart replay buffer")
|
||||
obs.obs_frontend_replay_buffer_stop()
|
||||
obs.timer_add(start_replay_buffer, 2000)
|
||||
else
|
||||
|
@ -54,5 +62,5 @@ function start_replay_buffer()
|
|||
obs.timer_remove(start_replay_buffer)
|
||||
obs.obs_frontend_replay_buffer_start()
|
||||
|
||||
obs.timer_add(check_restart, wait_time * 1000)
|
||||
start_loop()
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue