Skip to content
Matt Gajownik edited this page Feb 24, 2019 · 2 revisions

This contains documentation of all functions and events provided to webpages via OBS Browser.

Events

// Setting up an event listener
window.addEventListener('obsEventName', (event) => {
    console.log(event.detail);
});

// Removing a listener
window.removeEventListener('obsEventName');
Event Name Notes
obsStreamingStarting Immediately after 'start' has been triggered, but before an encoder is launched
obsStreamingStarted Immediately after an encoder is launched
obsStreamingStopping Immediately after 'stop' has been triggered, but before an encoder is shut down
obsStreamingStopped Immediately after an encoder is stopped
Event Name Notes
obsRecordingStarting Immediately after 'start' has been triggered, but before an encoder is launched
obsRecordingStarted Immediately after an encoder is launched
obsRecordingStopping Immediately after 'stop' has been triggered, but before an encoder is shut down
obsRecordingStopped Immediately after an encoder is stopped
Event Name Notes
obsReplaybufferStarting Immediately after 'start' has been triggered, but before an encoder is launched
obsReplaybufferStarted Immediately after an encoder is launched
obsReplaybufferStopping Immediately after 'stop' has been triggered, but before an encoder is shut down
obsReplaybufferStopped Immediately after an encoder is stopped

Functions

Functions can be called via the global obsstudio object or (if needed) via window.obsstudio. Most getters require a callback function, and most setters will not return anything (neither will starting/stopping outputs).

// Callbacks
obsstudio.getStatus((data) => {
    console.log(data.status);
});

// Performing actions
obsstudio.setCurrentScene('SceneName');
Function Name Parameters Response format Example
getOBSVersion(f) (callback) Object { major: 22, minor: 0, patch: 0, version: "22.0.0-modified" }
getStatus(f) (callback) Object { streaming: true, recording: false, replaybuffer: false }
pluginVersion String "2.2.0"
Function Name Parameters Response format Example
getCurrentProfile(f) (callback) Object (via Callback only) { profile: "Profile 2" }
getProfiles(f) (callback) Object (via Callback only) { profiles: ["Profile 1", "Profile 2"] }
setProfile(s) (name) [Use Event Listener] setProfile("Profile 1")
Function Name Parameters Response format Example
getCurrentScene(f) (callback) Object (via Callback only) { scene: "Scene 2" }
getScenes(f) (callback) Object (via Callback only) { scenes: ["Scene 1", "Scene 2"] }
setScene(s) (name) [Use Event Listener] setScene("Scene 1")
Function Name Parameters Response format Example
getCurrentTransition(f) (callback) Object (via Callback only) { scene: "Transition 2" }
getTransitions(f) (callback) Object (via Callback only) { transitions: ["Transition 1", "Transition 2"] }
setTransition(s) (name) [Use Event Listener] setTransition("Transition 1")
Clone this wiki locally