Skip to content

Commit c7d313e

Browse files
committed
Fixing new transition file playing for a second after changing scene (OBS 32)
1 parent 41f622c commit c7d313e

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

RandomStingerVideo/RandomStingerVideo.lua

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- RANDOM STINGER VIDEO
2-
-- Version 1.03
2+
-- Version 1.04
33
-- "Imports"
44
local obs = obslua
55
local math = require 'math'
@@ -120,15 +120,20 @@ function set_random_video_on_transition()
120120
obs.source_list_release(transitions)
121121
end
122122

123+
function delayed_update()
124+
set_random_video_on_transition()
125+
obs.timer_remove(delayed_update)
126+
end
127+
123128
-- Built-in: raised on OBS events
124129
function on_event(event)
125130
-- When the scene has changed, set a new video to the transition source
126131
if event == obs.OBS_FRONTEND_EVENT_SCENE_CHANGED then
127-
set_random_video_on_transition()
132+
obs.timer_add(delayed_update, 1000)
128133
end
129134
end
130135

131-
-- Built-in: Called when the scripts settings (if any) have been changed by the user.
136+
-- Built-in: Called when the script's settings (if any) have been changed by the user.
132137
function script_update(settings)
133138
-- Read settings
134139
transitionName = obs.obs_data_get_string(settings, "transition")
@@ -171,8 +176,12 @@ function script_load(settings)
171176
obs.obs_frontend_add_event_callback(on_event)
172177
end
173178

179+
function script_unload()
180+
obs.timer_remove(delayed_update)
181+
end
182+
174183
-- Built-in: Returns the script description.
175184
function script_description()
176185
return
177-
"Randomly assigns a video to a stinger transition on scene change.\nAuthors: FineWolf <me@finewolf.com>, extraxterrestrial\nVersion: 1.03"
186+
"Randomly assigns a video to a stinger transition on scene change.\nAuthors: FineWolf <me@finewolf.com>, extraxterrestrial\nVersion: 1.04"
178187
end

0 commit comments

Comments
 (0)