Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions RandomStingerVideo/RandomStingerVideo.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- RANDOM STINGER VIDEO
-- Version 1.03
-- Version 1.04
-- "Imports"
local obs = obslua
local math = require 'math'
Expand Down Expand Up @@ -120,15 +120,20 @@ function set_random_video_on_transition()
obs.source_list_release(transitions)
end

function delayed_update()
set_random_video_on_transition()
obs.timer_remove(delayed_update)
end

-- Built-in: raised on OBS events
function on_event(event)
-- When the scene has changed, set a new video to the transition source
if event == obs.OBS_FRONTEND_EVENT_SCENE_CHANGED then
set_random_video_on_transition()
obs.timer_add(delayed_update, 1000)
end
end

-- Built-in: Called when the scripts settings (if any) have been changed by the user.
-- Built-in: Called when the script's settings (if any) have been changed by the user.
function script_update(settings)
-- Read settings
transitionName = obs.obs_data_get_string(settings, "transition")
Expand Down Expand Up @@ -171,8 +176,12 @@ function script_load(settings)
obs.obs_frontend_add_event_callback(on_event)
end

function script_unload()
obs.timer_remove(delayed_update)
end

-- Built-in: Returns the script description.
function script_description()
return
"Randomly assigns a video to a stinger transition on scene change.\nAuthors: FineWolf <me@finewolf.com>, extraxterrestrial\nVersion: 1.03"
"Randomly assigns a video to a stinger transition on scene change.\nAuthors: FineWolf <me@finewolf.com>, extraxterrestrial\nVersion: 1.04"
end