|
1 | 1 | -- RANDOM STINGER VIDEO |
2 | | --- Version 1.03 |
| 2 | +-- Version 1.04 |
3 | 3 | -- "Imports" |
4 | 4 | local obs = obslua |
5 | 5 | local math = require 'math' |
@@ -120,15 +120,20 @@ function set_random_video_on_transition() |
120 | 120 | obs.source_list_release(transitions) |
121 | 121 | end |
122 | 122 |
|
| 123 | +function delayed_update() |
| 124 | + set_random_video_on_transition() |
| 125 | + obs.timer_remove(delayed_update) |
| 126 | +end |
| 127 | + |
123 | 128 | -- Built-in: raised on OBS events |
124 | 129 | function on_event(event) |
125 | 130 | -- When the scene has changed, set a new video to the transition source |
126 | 131 | if event == obs.OBS_FRONTEND_EVENT_SCENE_CHANGED then |
127 | | - set_random_video_on_transition() |
| 132 | + obs.timer_add(delayed_update, 1000) |
128 | 133 | end |
129 | 134 | end |
130 | 135 |
|
131 | | --- Built-in: Called when the script’s 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. |
132 | 137 | function script_update(settings) |
133 | 138 | -- Read settings |
134 | 139 | transitionName = obs.obs_data_get_string(settings, "transition") |
@@ -171,8 +176,12 @@ function script_load(settings) |
171 | 176 | obs.obs_frontend_add_event_callback(on_event) |
172 | 177 | end |
173 | 178 |
|
| 179 | +function script_unload() |
| 180 | + obs.timer_remove(delayed_update) |
| 181 | +end |
| 182 | + |
174 | 183 | -- Built-in: Returns the script description. |
175 | 184 | function script_description() |
176 | 185 | 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" |
178 | 187 | end |
0 commit comments