OBS
See OBS's scenes and audio, switch scenes, mute inputs, show or hide sources, and hear what changes.
Functions
obs.state()
OBS as ForgeCast sees it now.
Returns ObsState
obs.set_scene(scene, callback)
Switch OBS to a scene. callback(ok, error) is called when OBS has answered.
(A plugin can never start or stop the stream or the recording.)
scene:stringcallback:fun(ok: boolean, error?: string), optional
Returns integer id
obs.set_mute(input, muted, callback)
Mute or unmute one of OBS's audio inputs (obs.state().audio lists them).
Name
Type
Returns integer id
obs.set_source_visible(scene, source, visible, callback)
Show or hide a source in a scene (a webcam, an image, a browser source…).
Name
Type
Returns integer id
obs.on(event, handler)
Listen for what happens in OBS (Event.ObsScene, ObsStreaming, ObsRecording, ObsConnected).
event:stringhandler:fun(e: table)
Returns integer id
obs.off(id)
Stop a handler made with obs.on.
id:integer
Returns boolean found
obs.levels()
Every input's loudness: { ["Mic/Aux"] = { db = -22.5, talking = true } }. OBS sends it while a plugin asks (or listens for Event.ObsTalking): the first call can be empty.
Returns table<string, ObsLevel>
obs.talking(input)
Whether an input hears someone talking (any microphone when no input is given).
input:string, optional
Returns boolean
obs.save_replay(callback)
Save the replay buffer as a clip (OBS's Replay Buffer has to be on).
callback:fun(ok: boolean?, error?: string), optional
obs.screenshot(source, opts, callback)
A picture of a source or scene (the scene on air by default), as an image address the interface can show or ai.ask can look at.
Name
Type
obs.filters(source, callback)
A source's filters.
source:stringcallback:fun(filters: ObsFilter[]?, error?: string)
obs.filter(source, filter, on, callback)
Turn one of a source's filters on or off ("blur my cam").
Name
Type
obs.transform(scene, source, transform, callback)
Move, size or turn a source in a scene (only the fields you give change).
Name
Type
obs.get_transform(scene, source, callback)
Where a source is in a scene: { x, y, scale_x, scale_y, rotation, width, height }.
Name
Type
obs.media(source, action, callback)
Play, pause, stop, restart, or skip a media source (a video or a sound).
Name
Type
obs.set_text(source, text, callback)
Change the text of an OBS text source (up to 2000 characters).
Name
Type
obs.get_volume(input, callback)
An input's volume in dB.
input:stringcallback:fun(db: number?, error?: string)
obs.set_volume(input, db, callback)
Set an input's volume in dB (-100 is silent, 0 is as recorded).
Name
Type
obs.fade_volume(input, db, ms, callback)
Slide an input's volume to db over ms milliseconds (lower the music while a sound plays).
Name
Type
Types
Open a type to see its fields; type names above link here.

