OBSClient๏
Inherits: Object
Singleton for connecting to and controlling OBS Studio via WebSocket.
Description๏
OBSClient is a singleton that provides a complete implementation of the obs-websocket 5.x protocol, allowing Blazium Engine games and applications to connect to and control OBS Studio. It supports authentication, all request types, event subscription, and both signal-based and callback-based event handling.
The client must be connected to an OBS instance running obs-websocket 5.x or later. Use connect_to_obs() to establish a connection, and call poll() regularly (typically in _process) to receive and process messages.
func _ready():
# Connect to OBS with password
var error = OBSClient.connect_to_obs("ws://localhost:4455", "my_password")
if error != OK:
print("Failed to connect to OBS")
return
# Subscribe to scene change events
OBSClient.current_program_scene_changed.connect(_on_scene_changed)
# Get OBS version
OBSClient.get_version(func(status, data):
if status.result:
print("OBS Version: ", data.obsVersion)
)
func _process(delta):
# Poll must be called regularly to receive messages
OBSClient.poll()
func _on_scene_changed(scene_name: String, scene_uuid: String):
print("Scene changed to: ", scene_name)
Tutorials๏
Methods๏
void |
broadcast_custom_event(event_data: Dictionary) |
connect_to_obs(url: String, password: String = "", event_subscriptions: int = 2047) |
|
void |
create_input(scene_name: String, input_name: String, input_kind: String, input_settings: Dictionary = {}, scene_item_enabled: bool = true, callback: Callable = Callable()) |
void |
create_profile(profile_name: String) |
void |
create_record_chapter(chapter_name: String = "") |
void |
create_scene(scene_name: String, callback: Callable = Callable()) |
void |
create_scene_collection(scene_collection_name: String) |
void |
create_scene_item(scene_name: String, source_name: String, scene_item_enabled: bool = true, callback: Callable = Callable()) |
void |
create_source_filter(source_name: String, filter_name: String, filter_kind: String, filter_settings: Dictionary = {}) |
void |
|
void |
duplicate_scene_item(scene_name: String, scene_item_id: int, destination_scene_name: String = "", callback: Callable = Callable()) |
get_connection_state() const |
|
void |
get_current_preview_scene(callback: Callable = Callable()) |
void |
get_current_program_scene(callback: Callable = Callable()) |
void |
get_current_scene_transition(callback: Callable = Callable()) |
void |
get_group_list(callback: Callable = Callable()) |
void |
get_group_scene_item_list(scene_name: String, callback: Callable = Callable()) |
void |
get_hotkey_list(callback: Callable = Callable()) |
void |
get_input_default_settings(input_kind: String, callback: Callable = Callable()) |
void |
get_input_kind_list(unversioned: bool = false, callback: Callable = Callable()) |
void |
get_input_list(input_kind: String = "", callback: Callable = Callable()) |
void |
get_input_mute(input_name: String, callback: Callable = Callable()) |
void |
get_input_settings(input_name: String, callback: Callable = Callable()) |
void |
get_input_volume(input_name: String, callback: Callable = Callable()) |
void |
get_last_replay_buffer_replay(callback: Callable = Callable()) |
void |
get_media_input_status(input_name: String, callback: Callable = Callable()) |
void |
get_monitor_list(callback: Callable = Callable()) |
get_negotiated_rpc_version() const |
|
void |
get_persistent_data(realm: String, slot_name: String, callback: Callable = Callable()) |
void |
get_profile_list(callback: Callable = Callable()) |
void |
get_profile_parameter(parameter_category: String, parameter_name: String, callback: Callable = Callable()) |
void |
get_record_directory(callback: Callable = Callable()) |
void |
get_record_status(callback: Callable = Callable()) |
void |
get_replay_buffer_status(callback: Callable = Callable()) |
void |
get_scene_collection_list(callback: Callable = Callable()) |
void |
get_scene_item_blend_mode(scene_name: String, scene_item_id: int, callback: Callable = Callable()) |
void |
get_scene_item_enabled(scene_name: String, scene_item_id: int, callback: Callable = Callable()) |
void |
get_scene_item_id(scene_name: String, source_name: String, search_offset: int = 0, callback: Callable = Callable()) |
void |
get_scene_item_index(scene_name: String, scene_item_id: int, callback: Callable = Callable()) |
void |
get_scene_item_list(scene_name: String, callback: Callable = Callable()) |
void |
get_scene_item_locked(scene_name: String, scene_item_id: int, callback: Callable = Callable()) |
void |
get_scene_item_transform(scene_name: String, scene_item_id: int, callback: Callable = Callable()) |
void |
get_scene_list(callback: Callable = Callable()) |
void |
get_scene_scene_transition_override(scene_name: String, callback: Callable = Callable()) |
void |
get_scene_transition_list(callback: Callable = Callable()) |
get_server_info() const |
|
void |
get_source_active(source_name: String, callback: Callable = Callable()) |
void |
get_source_filter(source_name: String, filter_name: String, callback: Callable = Callable()) |
void |
get_source_filter_default_settings(filter_kind: String, callback: Callable = Callable()) |
void |
get_source_filter_kind_list(callback: Callable = Callable()) |
void |
get_source_filter_list(source_name: String, callback: Callable = Callable()) |
void |
get_source_screenshot(source_name: String, image_format: String, image_width: int = -1, image_height: int = -1, image_compression_quality: int = -1, callback: Callable = Callable()) |
void |
get_special_inputs(callback: Callable = Callable()) |
void |
|
void |
get_stream_service_settings(callback: Callable = Callable()) |
void |
get_stream_status(callback: Callable = Callable()) |
void |
get_studio_mode_enabled(callback: Callable = Callable()) |
void |
get_transition_kind_list(callback: Callable = Callable()) |
void |
get_version(callback: Callable = Callable()) |
void |
get_video_settings(callback: Callable = Callable()) |
void |
get_virtual_cam_status(callback: Callable = Callable()) |
is_obs_connected() const |
|
void |
offset_media_input_cursor(input_name: String, media_cursor_offset: int) |
void |
open_input_filters_dialog(input_name: String) |
void |
open_input_interact_dialog(input_name: String) |
void |
open_input_properties_dialog(input_name: String) |
void |
open_source_projector(source_name: String, monitor_index: int = -1, projector_geometry: String = "") |
void |
open_video_mix_projector(video_mix_type: String, monitor_index: int = -1, projector_geometry: String = "") |
void |
|
void |
poll() |
void |
reidentify(event_subscriptions: int) |
void |
remove_input(input_name: String) |
void |
remove_profile(profile_name: String) |
void |
remove_scene(scene_name: String) |
void |
remove_scene_item(scene_name: String, scene_item_id: int) |
void |
remove_source_filter(source_name: String, filter_name: String) |
void |
|
void |
|
void |
save_source_screenshot(source_name: String, image_format: String, image_file_path: String, image_width: int = -1, image_height: int = -1, image_compression_quality: int = -1) |
send_request(request_type: String, request_data: Dictionary = {}, callback: Callable = Callable()) |
|
send_request_batch(requests: Array, halt_on_failure: bool = false, execution_type: int = 0, callback: Callable = Callable()) |
|
void |
send_stream_caption(caption_text: String) |
void |
set_current_preview_scene(scene_name: String) |
void |
set_current_profile(profile_name: String) |
void |
set_current_program_scene(scene_name: String) |
void |
set_current_scene_collection(scene_collection_name: String) |
void |
set_current_scene_transition(transition_name: String) |
void |
set_current_scene_transition_duration(transition_duration: int) |
void |
set_current_scene_transition_settings(transition_settings: Dictionary, overlay: bool = true) |
void |
set_input_mute(input_name: String, input_muted: bool) |
void |
set_input_name(input_name: String, new_input_name: String) |
void |
set_input_settings(input_name: String, input_settings: Dictionary, overlay: bool = true) |
void |
set_input_volume(input_name: String, input_volume_mul: float = -1.0, input_volume_db: float = 0.0) |
void |
set_media_input_cursor(input_name: String, media_cursor: int) |
void |
set_persistent_data(realm: String, slot_name: String, slot_value: Variant) |
void |
set_profile_parameter(parameter_category: String, parameter_name: String, parameter_value: String) |
void |
set_record_directory(record_directory: String) |
void |
set_scene_item_blend_mode(scene_name: String, scene_item_id: int, scene_item_blend_mode: String) |
void |
set_scene_item_enabled(scene_name: String, scene_item_id: int, scene_item_enabled: bool) |
void |
set_scene_item_index(scene_name: String, scene_item_id: int, scene_item_index: int) |
void |
set_scene_item_locked(scene_name: String, scene_item_id: int, scene_item_locked: bool) |
void |
set_scene_item_transform(scene_name: String, scene_item_id: int, scene_item_transform: Dictionary) |
void |
set_scene_name(scene_name: String, new_scene_name: String) |
void |
set_scene_scene_transition_override(scene_name: String, transition_name: String, transition_duration: int = -1) |
void |
set_source_filter_enabled(source_name: String, filter_name: String, filter_enabled: bool) |
void |
set_source_filter_index(source_name: String, filter_name: String, filter_index: int) |
void |
set_source_filter_name(source_name: String, filter_name: String, new_filter_name: String) |
void |
set_source_filter_settings(source_name: String, filter_name: String, filter_settings: Dictionary, overlay: bool = true) |
void |
set_stream_service_settings(stream_service_type: String, stream_service_settings: Dictionary) |
void |
set_studio_mode_enabled(studio_mode_enabled: bool) |
void |
set_tbar_position(position: float, release: bool = true) |
void |
set_video_settings(video_settings: Dictionary) |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
stop_record(callback: Callable = Callable()) |
void |
|
void |
|
void |
|
void |
subscribe_to_events(event_mask: int, callback: Callable) |
void |
toggle_input_mute(input_name: String, callback: Callable = Callable()) |
void |
toggle_record(callback: Callable = Callable()) |
void |
|
void |
toggle_replay_buffer(callback: Callable = Callable()) |
void |
toggle_stream(callback: Callable = Callable()) |
void |
toggle_virtual_cam(callback: Callable = Callable()) |
void |
trigger_hotkey_by_name(hotkey_name: String, context_name: String = "") |
void |
trigger_media_input_action(input_name: String, media_action: String) |
void |
|
void |
unsubscribe_from_events(event_mask: int, callback: Callable) |
Signals๏
connected() ๐
There is currently no description for this signal. Please help us by contributing one!
connection_error(error_message: String) ๐
There is currently no description for this signal. Please help us by contributing one!
current_preview_scene_changed(scene_name: String, scene_uuid: String) ๐
Emitted when the current preview scene has changed in studio mode.
current_profile_changed(profile_name: String) ๐
Emitted when the current profile has changed.
current_profile_changing(profile_name: String) ๐
Emitted when the current profile has begun changing.
current_program_scene_changed(scene_name: String, scene_uuid: String) ๐
Emitted when the current program scene has changed.
current_scene_collection_changed(scene_collection_name: String) ๐
Emitted when the current scene collection has changed.
current_scene_collection_changing(scene_collection_name: String) ๐
Emitted when the current scene collection has begun changing. It is recommended to pause polling requests during this event.
current_scene_transition_changed(transition_name: String, transition_uuid: String) ๐
Emitted when the current scene transition has changed.
current_scene_transition_duration_changed(transition_duration: int) ๐
Emitted when the current scene transition duration has changed. The duration is in milliseconds.
custom_event(event_data: Dictionary) ๐
Emitted when a custom event is received from OBS or another WebSocket client. The event_data contains the event payload.
disconnected(reason: String) ๐
There is currently no description for this signal. Please help us by contributing one!
exit_started() ๐
Emitted when OBS has begun the shutdown process.
input_active_state_changed(input_name: String, input_uuid: String, video_active: bool) ๐
Emitted when an input's active state changes. An input is active when it is rendering video.
input_audio_balance_changed(input_name: String, input_uuid: String, input_audio_balance: float) ๐
Emitted when an input's audio balance (stereo pan) changes. Values range from 0.0 (left) to 1.0 (right), with 0.5 being center.
input_audio_monitor_type_changed(input_name: String, input_uuid: String, monitor_type: String) ๐
Emitted when an input's audio monitor type changes (e.g., "OBS_MONITORING_TYPE_NONE", "OBS_MONITORING_TYPE_MONITOR_ONLY", "OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT").
input_audio_sync_offset_changed(input_name: String, input_uuid: String, input_audio_sync_offset: int) ๐
Emitted when an input's audio sync offset changes. The offset is in milliseconds.
input_audio_tracks_changed(input_name: String, input_uuid: String, input_audio_tracks: Dictionary) ๐
Emitted when an input's audio track assignments change.
input_created(input_name: String, input_uuid: String, input_kind: String, input_settings: Dictionary) ๐
Emitted when a new input (source) has been created.
input_mute_state_changed(input_name: String, input_uuid: String, input_muted: bool) ๐
Emitted when an input's mute state changes.
input_name_changed(input_uuid: String, old_input_name: String, input_name: String) ๐
Emitted when an input has been renamed.
input_removed(input_name: String, input_uuid: String) ๐
Emitted when an input has been removed.
input_settings_changed(input_name: String, input_uuid: String, input_settings: Dictionary) ๐
Emitted when an input's settings have changed.
input_show_state_changed(input_name: String, input_uuid: String, video_showing: bool) ๐
Emitted when an input's show state changes. An input is showing when it is visible in a scene.
input_volume_changed(input_name: String, input_uuid: String, input_volume_mul: float, input_volume_db: float) ๐
Emitted when an input's volume level changes.
input_volume_meters(inputs: Array) ๐
Emitted continuously with volume meter data for all inputs. This is a high-volume event and must be specifically subscribed to.
media_input_action_triggered(input_name: String, input_uuid: String, media_action: String) ๐
Emitted when a media action has been triggered on a media input.
media_input_playback_ended(input_name: String, input_uuid: String) ๐
Emitted when a media input has finished playing.
media_input_playback_started(input_name: String, input_uuid: String) ๐
Emitted when a media input has started playing.
profile_list_changed(profiles: Array) ๐
Emitted when the list of available profiles has changed.
record_file_changed(new_output_path: String) ๐
Emitted when the recording file has been changed (e.g., when splitting files).
record_state_changed(output_active: bool, output_state: String, output_path: String) ๐
Emitted when the state of the record output has changed. The output_path contains the file path if recording stopped, otherwise it is empty.
replay_buffer_saved(saved_replay_path: String) ๐
Emitted when a replay buffer has been saved to disk. The saved_replay_path contains the file path where it was saved.
replay_buffer_state_changed(output_active: bool, output_state: String) ๐
Emitted when the state of the replay buffer output has changed.
scene_collection_list_changed(scene_collections: Array) ๐
Emitted when the list of available scene collections has changed.
scene_created(scene_name: String, scene_uuid: String, is_group: bool) ๐
Emitted when a new scene has been created.
scene_item_created(scene_name: String, scene_uuid: String, source_name: String, scene_item_id: int, scene_item_index: int) ๐
Emitted when a new scene item has been created in a scene.
scene_item_enable_state_changed(scene_name: String, scene_uuid: String, scene_item_id: int, scene_item_enabled: bool) ๐
Emitted when a scene item's enabled (visibility) state has changed.
scene_item_list_reindexed(scene_name: String, scene_uuid: String, scene_items: Array) ๐
Emitted when scene items have been reordered in a scene. The scene_items array contains the new ordering.
scene_item_lock_state_changed(scene_name: String, scene_uuid: String, scene_item_id: int, scene_item_locked: bool) ๐
Emitted when a scene item's lock state has changed.
scene_item_removed(scene_name: String, scene_uuid: String, source_name: String, scene_item_id: int) ๐
Emitted when a scene item has been removed from a scene.
scene_item_selected(scene_name: String, scene_uuid: String, scene_item_id: int) ๐
Emitted when a scene item has been selected in the OBS user interface.
scene_item_transform_changed(scene_name: String, scene_uuid: String, scene_item_id: int, scene_item_transform: Dictionary) ๐
Emitted when a scene item's transform (position, scale, rotation, etc.) has changed. This is a high-volume event and must be specifically subscribed to.
scene_list_changed(scenes: Array) ๐
Emitted when the list of scenes has changed.
scene_name_changed(scene_uuid: String, old_scene_name: String, scene_name: String) ๐
Emitted when the name of a scene has changed.
scene_removed(scene_name: String, scene_uuid: String, is_group: bool) ๐
Emitted when a scene has been removed.
scene_transition_ended(transition_name: String, transition_uuid: String) ๐
Emitted when a scene transition has completed.
scene_transition_started(transition_name: String, transition_uuid: String) ๐
Emitted when a scene transition has started.
scene_transition_video_ended(transition_name: String, transition_uuid: String) ๐
Emitted when a scene transition's video has finished playing (for transitions with video).
screenshot_saved(saved_screenshot_path: String) ๐
Emitted when a screenshot has been saved to disk. The saved_screenshot_path contains the file path where it was saved.
source_filter_created(source_name: String, filter_name: String, filter_kind: String, filter_index: int, filter_settings: Dictionary) ๐
Emitted when a new filter has been created on a source.
source_filter_enable_state_changed(source_name: String, filter_name: String, filter_enabled: bool) ๐
Emitted when a filter's enabled state has changed.
source_filter_list_reindexed(source_name: String, filters: Array) ๐
Emitted when filters have been reordered on a source. The filters array contains the new ordering.
source_filter_name_changed(source_name: String, old_filter_name: String, filter_name: String) ๐
Emitted when a filter has been renamed.
source_filter_removed(source_name: String, filter_name: String) ๐
Emitted when a filter has been removed from a source.
source_filter_settings_changed(source_name: String, filter_name: String, filter_settings: Dictionary) ๐
Emitted when a filter's settings have changed.
stream_state_changed(output_active: bool, output_state: String) ๐
Emitted when the state of the stream output has changed.
studio_mode_state_changed(studio_mode_enabled: bool) ๐
Emitted when studio mode has been enabled or disabled.
vendor_event(vendor_name: String, event_type: String, event_data: Dictionary) ๐
Emitted when a vendor-specific event is received from OBS. Vendor events are custom events from OBS plugins or extensions.
virtualcam_state_changed(output_active: bool, output_state: String) ๐
Emitted when the state of the virtual camera output has changed.
Enumerations๏
enum ConnectionState: ๐
ConnectionState STATE_DISCONNECTED = 0
Not connected to OBS.
ConnectionState STATE_CONNECTING = 1
Connection to OBS in progress.
ConnectionState STATE_IDENTIFYING = 2
Authenticating with OBS.
ConnectionState STATE_CONNECTED = 3
Fully connected and authenticated with OBS.
Constants๏
OBS_WEBSOCKET_OPCODE_HELLO = 0 ๐
OpCode for Hello message (server to client).
OBS_WEBSOCKET_OPCODE_IDENTIFY = 1 ๐
OpCode for Identify message (client to server).
OBS_WEBSOCKET_OPCODE_IDENTIFIED = 2 ๐
OpCode for Identified message (server to client).
OBS_WEBSOCKET_OPCODE_REIDENTIFY = 3 ๐
OpCode for Reidentify message (client to server).
OBS_WEBSOCKET_OPCODE_EVENT = 5 ๐
OpCode for Event message (server to client).
OBS_WEBSOCKET_OPCODE_REQUEST = 6 ๐
OpCode for Request message (client to server).
OBS_WEBSOCKET_OPCODE_REQUEST_RESPONSE = 7 ๐
OpCode for RequestResponse message (server to client).
OBS_WEBSOCKET_OPCODE_REQUEST_BATCH = 8 ๐
OpCode for RequestBatch message (client to server).
OBS_WEBSOCKET_OPCODE_REQUEST_BATCH_RESPONSE = 9 ๐
OpCode for RequestBatchResponse message (server to client).
OBS_EVENT_SUBSCRIPTION_NONE = 0 ๐
Disable all events.
OBS_EVENT_SUBSCRIPTION_GENERAL = 1 ๐
Subscribe to general events.
OBS_EVENT_SUBSCRIPTION_CONFIG = 2 ๐
Subscribe to configuration events.
OBS_EVENT_SUBSCRIPTION_SCENES = 4 ๐
Subscribe to scene events.
OBS_EVENT_SUBSCRIPTION_INPUTS = 8 ๐
Subscribe to input events.
OBS_EVENT_SUBSCRIPTION_TRANSITIONS = 16 ๐
Subscribe to transition events.
OBS_EVENT_SUBSCRIPTION_FILTERS = 32 ๐
Subscribe to filter events.
OBS_EVENT_SUBSCRIPTION_OUTPUTS = 64 ๐
Subscribe to output events.
OBS_EVENT_SUBSCRIPTION_SCENE_ITEMS = 128 ๐
Subscribe to scene item events.
OBS_EVENT_SUBSCRIPTION_MEDIA_INPUTS = 256 ๐
Subscribe to media input events.
OBS_EVENT_SUBSCRIPTION_VENDORS = 512 ๐
Subscribe to vendor events.
OBS_EVENT_SUBSCRIPTION_UI = 1024 ๐
Subscribe to UI events.
OBS_EVENT_SUBSCRIPTION_INPUT_VOLUME_METERS = 65536 ๐
Subscribe to high-volume InputVolumeMeters event.
OBS_EVENT_SUBSCRIPTION_INPUT_ACTIVE_STATE_CHANGED = 131072 ๐
Subscribe to high-volume InputActiveStateChanged event.
OBS_EVENT_SUBSCRIPTION_INPUT_SHOW_STATE_CHANGED = 262144 ๐
Subscribe to high-volume InputShowStateChanged event.
OBS_EVENT_SUBSCRIPTION_SCENE_ITEM_TRANSFORM_CHANGED = 524288 ๐
Subscribe to high-volume SceneItemTransformChanged event.
OBS_EVENT_SUBSCRIPTION_ALL = 2047 ๐
Subscribe to all standard events (excludes high-volume events).
OBS_REQUEST_STATUS_UNKNOWN = 0 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_NO_ERROR = 10 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_SUCCESS = 100 ๐
Request completed successfully.
OBS_REQUEST_STATUS_MISSING_REQUEST_TYPE = 203 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_UNKNOWN_REQUEST_TYPE = 204 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_GENERIC_ERROR = 205 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_UNSUPPORTED_REQUEST_BATCH_EXECUTION_TYPE = 206 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_NOT_READY = 207 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_MISSING_REQUEST_FIELD = 300 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_MISSING_REQUEST_DATA = 301 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_INVALID_REQUEST_FIELD = 400 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_INVALID_REQUEST_FIELD_TYPE = 401 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_REQUEST_FIELD_OUT_OF_RANGE = 402 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_REQUEST_FIELD_EMPTY = 403 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_TOO_MANY_REQUEST_FIELDS = 404 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_OUTPUT_RUNNING = 500 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_OUTPUT_NOT_RUNNING = 501 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_OUTPUT_PAUSED = 502 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_OUTPUT_NOT_PAUSED = 503 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_OUTPUT_DISABLED = 504 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_STUDIO_MODE_ACTIVE = 505 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_STUDIO_MODE_NOT_ACTIVE = 506 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_RESOURCE_NOT_FOUND = 600 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_RESOURCE_ALREADY_EXISTS = 601 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_INVALID_RESOURCE_TYPE = 602 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_NOT_ENOUGH_RESOURCES = 603 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_INVALID_RESOURCE_STATE = 604 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_INVALID_INPUT_KIND = 605 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_RESOURCE_NOT_CONFIGURABLE = 606 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_INVALID_FILTER_KIND = 607 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_RESOURCE_CREATION_FAILED = 700 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_RESOURCE_ACTION_FAILED = 701 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_REQUEST_PROCESSING_FAILED = 702 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_STATUS_CANNOT_ACT = 703 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_REQUEST_BATCH_EXECUTION_TYPE_NONE = -1 ๐
Not a request batch.
OBS_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_REALTIME = 0 ๐
Process requests serially as fast as possible.
OBS_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_FRAME = 1 ๐
Process requests serially in sync with graphics thread.
OBS_REQUEST_BATCH_EXECUTION_TYPE_PARALLEL = 2 ๐
Process requests in parallel using thread pool.
OBS_WEBSOCKET_CLOSE_DONT_CLOSE = 0 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_UNKNOWN_REASON = 4000 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_MESSAGE_DECODE_ERROR = 4002 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_MISSING_DATA_FIELD = 4003 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_INVALID_DATA_FIELD_TYPE = 4004 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_INVALID_DATA_FIELD_VALUE = 4005 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_UNKNOWN_OPCODE = 4006 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_NOT_IDENTIFIED = 4007 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_ALREADY_IDENTIFIED = 4008 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_AUTHENTICATION_FAILED = 4009 ๐
WebSocket closed due to authentication failure.
OBS_WEBSOCKET_CLOSE_UNSUPPORTED_RPC_VERSION = 4010 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_SESSION_INVALIDATED = 4011 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_WEBSOCKET_CLOSE_UNSUPPORTED_FEATURE = 4012 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_MEDIA_INPUT_ACTION_NONE = 0 ๐
No media action.
OBS_MEDIA_INPUT_ACTION_PLAY = 1 ๐
Play media input.
OBS_MEDIA_INPUT_ACTION_PAUSE = 2 ๐
Pause media input.
OBS_MEDIA_INPUT_ACTION_STOP = 3 ๐
Stop media input.
OBS_MEDIA_INPUT_ACTION_RESTART = 4 ๐
Restart media input.
OBS_MEDIA_INPUT_ACTION_NEXT = 5 ๐
Go to next playlist item.
OBS_MEDIA_INPUT_ACTION_PREVIOUS = 6 ๐
Go to previous playlist item.
OBS_OUTPUT_STATE_UNKNOWN = 0 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_OUTPUT_STATE_STARTING = 1 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_OUTPUT_STATE_STARTED = 2 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_OUTPUT_STATE_STOPPING = 3 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_OUTPUT_STATE_STOPPED = 4 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_OUTPUT_STATE_RECONNECTING = 5 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_OUTPUT_STATE_RECONNECTED = 6 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_OUTPUT_STATE_PAUSED = 7 ๐
There is currently no description for this constant. Please help us by contributing one!
OBS_OUTPUT_STATE_RESUMED = 8 ๐
There is currently no description for this constant. Please help us by contributing one!
Method Descriptions๏
void broadcast_custom_event(event_data: Dictionary) ๐
Broadcasts a custom event to all connected WebSocket clients. The event will be received by other clients subscribed to custom events.
OBSClient.broadcast_custom_event({})
Error connect_to_obs(url: String, password: String = "", event_subscriptions: int = 2047) ๐
Connects to an OBS WebSocket server at the specified url. If the server requires authentication, provide the password. The event_subscriptions parameter controls which event categories to subscribe to using OBSEventSubscription flags.
Returns @GlobalScope.OK if the connection was initiated successfully. You must call poll() regularly after connecting to complete the handshake and receive messages.
# Connect without password
OBSClient.connect_to_obs("ws://localhost:4455")
# Connect with password
OBSClient.connect_to_obs("ws://localhost:4455", "my_password")
# Connect with specific event subscriptions
OBSClient.connect_to_obs("ws://localhost:4455", "",
OBSEventSubscription.SCENES | OBSEventSubscription.OUTPUTS)
void create_input(scene_name: String, input_name: String, input_kind: String, input_settings: Dictionary = {}, scene_item_enabled: bool = true, callback: Callable = Callable()) ๐
Creates a new input source in the specified scene. The input_kind specifies the type of input (e.g., "browser_source", "image_source"). The input_settings dictionary contains input-specific configuration. If scene_item_enabled is true, the input will be visible immediately. The callback receives the input UUID and scene item ID.
OBSClient.create_input("scene_name_value", "input_name_value", "input_kind_value", func(status, data):
if status.result:
pass
)
void create_profile(profile_name: String) ๐
Creates a new profile with the specified name. Profiles contain OBS configuration settings like output, audio, and video settings.
OBSClient.create_profile("profile_name_value")
void create_record_chapter(chapter_name: String = "") ๐
Creates a chapter marker in the current recording at the current timestamp. If chapter_name is empty, OBS will use a default name. Chapters are useful for marking important moments during long recordings.
OBSClient.create_record_chapter()
void create_scene(scene_name: String, callback: Callable = Callable()) ๐
Creates a new scene in OBS with the specified scene_name. If provided, callback will be called with the response containing the new scene's UUID.
OBSClient.create_scene("scene_name_value", func(status, data):
if status.result:
pass
)
void create_scene_collection(scene_collection_name: String) ๐
Creates a new scene collection with the specified name. Scene collections are complete sets of scenes, sources, and their configurations.
OBSClient.create_scene_collection("scene_collection_name_value")
void create_scene_item(scene_name: String, source_name: String, scene_item_enabled: bool = true, callback: Callable = Callable()) ๐
Adds an existing source to a scene as a scene item. The source_name must reference an existing input or scene. If scene_item_enabled is true, the item will be visible. The callback receives the new scene item ID.
OBSClient.create_scene_item("scene_name_value", "source_name_value", func(status, data):
if status.result:
pass
)
void create_source_filter(source_name: String, filter_name: String, filter_kind: String, filter_settings: Dictionary = {}) ๐
Creates a new filter on the specified source. The filter_kind specifies the type of filter (e.g., "color_correction", "sharpness_filter"). The filter_settings dictionary contains filter-specific configuration.
OBSClient.create_source_filter("source_name_value", "filter_name_value", "filter_kind_value")
void disconnect_from_obs() ๐
Disconnects from the OBS WebSocket server and cleans up all connection resources. Any pending requests will be cancelled.
OBSClient.disconnect_from_obs()
void duplicate_scene_item(scene_name: String, scene_item_id: int, destination_scene_name: String = "", callback: Callable = Callable()) ๐
Duplicates a scene item to the same scene or a different scene. If destination_scene_name is empty, the item is duplicated in the same scene. The callback receives the new scene item ID.
OBSClient.duplicate_scene_item("scene_name_value", 0, func(status, data):
if status.result:
pass
)
ConnectionState get_connection_state() const ๐
Returns the current connection state. Possible values are:
STATE_DISCONNECTED: Not connected
STATE_CONNECTING: Connection in progress
STATE_IDENTIFYING: Authenticating with server
STATE_CONNECTED: Fully connected and ready
OBSClient.get_connection_state()
void get_current_preview_scene(callback: Callable = Callable()) ๐
Gets the current preview scene when studio mode is enabled. The callback receives the scene name and UUID. Returns an error if studio mode is not active.
OBSClient.get_current_preview_scene(func(status, data):
if status.result:
pass
)
void get_current_program_scene(callback: Callable = Callable()) ๐
Gets the current program scene. The callback receives the scene name and UUID.
OBSClient.get_current_program_scene(func(status, data):
if status.result:
pass
)
void get_current_scene_transition(callback: Callable = Callable()) ๐
Gets the current scene transition. The callback receives the transition name, UUID, kind, whether it's fixed, and its settings.
OBSClient.get_current_scene_transition(func(status, data):
if status.result:
pass
)
void get_group_list(callback: Callable = Callable()) ๐
Gets a list of all groups in OBS. Groups are special scenes that can be nested within other scenes. The callback receives an array of group names.
OBSClient.get_group_list(func(status, data):
if status.result:
pass
)
void get_group_scene_item_list(scene_name: String, callback: Callable = Callable()) ๐
Gets the list of scene items within a group. The callback receives an array of scene item objects containing their IDs, source names, and other properties.
OBSClient.get_group_scene_item_list("scene_name_value", func(status, data):
if status.result:
pass
)
void get_hotkey_list(callback: Callable = Callable()) ๐
Gets a list of all available hotkeys in OBS. The callback receives an array of hotkey names that can be triggered using trigger_hotkey_by_name().
OBSClient.get_hotkey_list(func(status, data):
if status.result:
pass
)
void get_input_default_settings(input_kind: String, callback: Callable = Callable()) ๐
Gets the default settings for a specific input kind. The callback receives a dictionary containing the default configuration values for that input type.
OBSClient.get_input_default_settings("input_kind_value", func(status, data):
if status.result:
pass
)
void get_input_kind_list(unversioned: bool = false, callback: Callable = Callable()) ๐
Gets a list of all available input kinds. If unversioned is true, returns input kinds without version suffixes. The callback receives an array of input kind strings like "browser_source", "image_source", etc.
OBSClient.get_input_kind_list(func(status, data):
if status.result:
pass
)
void get_input_list(input_kind: String = "", callback: Callable = Callable()) ๐
Gets a list of all inputs (sources). If input_kind is specified, only returns inputs of that type. The callback receives an array of input objects containing names, UUIDs, kinds, and other properties.
OBSClient.get_input_list(func(status, data):
if status.result:
pass
)
void get_input_mute(input_name: String, callback: Callable = Callable()) ๐
Gets the mute state of an input. The callback receives a boolean indicating whether the input is muted.
OBSClient.get_input_mute("input_name_value", func(status, data):
if status.result:
pass
)
void get_input_settings(input_name: String, callback: Callable = Callable()) ๐
Gets the settings dictionary for an input. The callback receives the input's kind, settings dictionary, and default settings.
OBSClient.get_input_settings("input_name_value", func(status, data):
if status.result:
pass
)
void get_input_volume(input_name: String, callback: Callable = Callable()) ๐
Gets the volume level of an input. The callback receives the volume as a multiplier (0.0 to 1.0+) and in decibels.
OBSClient.get_input_volume("input_name_value", func(status, data):
if status.result:
pass
)
void get_last_replay_buffer_replay(callback: Callable = Callable()) ๐
Gets the file path of the last saved replay buffer. The callback receives the saved replay path string.
OBSClient.get_last_replay_buffer_replay(func(status, data):
if status.result:
pass
)
void get_media_input_status(input_name: String, callback: Callable = Callable()) ๐
Gets the status of a media input (video/audio file playback). The callback receives playback state, current time, duration, and other media properties.
OBSClient.get_media_input_status("input_name_value", func(status, data):
if status.result:
pass
)
void get_monitor_list(callback: Callable = Callable()) ๐
Gets a list of all monitors/displays available on the system. The callback receives an array of monitor information for use with projector functions.
OBSClient.get_monitor_list(func(status, data):
if status.result:
pass
)
int get_negotiated_rpc_version() const ๐
Returns the RPC version negotiated with the server during connection. Returns 0 if not connected.
OBSClient.get_negotiated_rpc_version()
void get_persistent_data(realm: String, slot_name: String, callback: Callable = Callable()) ๐
Gets persistent data stored in OBS. The realm defines the storage namespace (e.g., "OBS_WEBSOCKET_DATA_REALM_GLOBAL"). The callback receives the stored value.
OBSClient.get_persistent_data("example_string", "slot_name_value", func(status, data):
if status.result:
pass
)
void get_profile_list(callback: Callable = Callable()) ๐
Gets a list of all available profiles. The callback receives an array of profile names and the current profile name.
OBSClient.get_profile_list(func(status, data):
if status.result:
pass
)
void get_profile_parameter(parameter_category: String, parameter_name: String, callback: Callable = Callable()) ๐
Gets a specific parameter value from the current profile's configuration file. The parameter_category is the INI section name. The callback receives the parameter value and default value.
OBSClient.get_profile_parameter("example_string", "parameter_name_value", func(status, data):
if status.result:
pass
)
void get_record_directory(callback: Callable = Callable()) ๐
Gets the directory path where recordings are saved. The callback receives the record directory path string.
OBSClient.get_record_directory(func(status, data):
if status.result:
pass
)
void get_record_status(callback: Callable = Callable()) ๐
Gets the current status of the record output. The callback receives information about whether recording is active, paused, and the current timecode.
OBSClient.get_record_status(func(status, data):
if status.result:
pass
)
void get_replay_buffer_status(callback: Callable = Callable()) ๐
Gets the current status of the replay buffer output. The callback receives information about whether the replay buffer is active.
OBSClient.get_replay_buffer_status(func(status, data):
if status.result:
pass
)
void get_scene_collection_list(callback: Callable = Callable()) ๐
Gets a list of all available scene collections. The callback receives an array of scene collection names and the current scene collection name.
OBSClient.get_scene_collection_list(func(status, data):
if status.result:
pass
)
void get_scene_item_blend_mode(scene_name: String, scene_item_id: int, callback: Callable = Callable()) ๐
Gets the blend mode of a scene item. The callback receives the blend mode string (e.g., "OBS_BLEND_NORMAL", "OBS_BLEND_ADDITIVE").
OBSClient.get_scene_item_blend_mode("scene_name_value", 0, func(status, data):
if status.result:
pass
)
void get_scene_item_enabled(scene_name: String, scene_item_id: int, callback: Callable = Callable()) ๐
Gets whether a scene item is enabled (visible). The callback receives a boolean indicating the enabled state.
OBSClient.get_scene_item_enabled("scene_name_value", 0, func(status, data):
if status.result:
pass
)
void get_scene_item_id(scene_name: String, source_name: String, search_offset: int = 0, callback: Callable = Callable()) ๐
Gets the scene item ID for a source in a scene. Use search_offset to find subsequent items if the same source appears multiple times. The callback receives the scene item ID.
OBSClient.get_scene_item_id("scene_name_value", "source_name_value", func(status, data):
if status.result:
pass
)
void get_scene_item_index(scene_name: String, scene_item_id: int, callback: Callable = Callable()) ๐
Gets the index (z-order position) of a scene item. The callback receives the item's index in the scene's layer stack.
OBSClient.get_scene_item_index("scene_name_value", 0, func(status, data):
if status.result:
pass
)
void get_scene_item_list(scene_name: String, callback: Callable = Callable()) ๐
Gets a list of all scene items in a scene. The callback receives an array of scene item objects containing their IDs, source names, transforms, and other properties.
OBSClient.get_scene_item_list("scene_name_value", func(status, data):
if status.result:
pass
)
void get_scene_item_locked(scene_name: String, scene_item_id: int, callback: Callable = Callable()) ๐
Gets whether a scene item is locked (cannot be moved or resized in the OBS UI). The callback receives a boolean indicating the locked state.
OBSClient.get_scene_item_locked("scene_name_value", 0, func(status, data):
if status.result:
pass
)
void get_scene_item_transform(scene_name: String, scene_item_id: int, callback: Callable = Callable()) ๐
Gets the transform properties of a scene item including position, scale, rotation, crop, and alignment. The callback receives a dictionary with all transform values.
OBSClient.get_scene_item_transform("scene_name_value", 0, func(status, data):
if status.result:
pass
)
void get_scene_list(callback: Callable = Callable()) ๐
Gets a list of all scenes in OBS. The callback receives an array of scene objects, the current program scene, and current preview scene (if in studio mode).
OBSClient.get_scene_list(func(status, data):
if status.result:
pass
)
void get_scene_scene_transition_override(scene_name: String, callback: Callable = Callable()) ๐
Gets the transition override settings for a specific scene. The callback receives the override transition name and duration if set.
OBSClient.get_scene_scene_transition_override("scene_name_value", func(status, data):
if status.result:
pass
)
void get_scene_transition_list(callback: Callable = Callable()) ๐
Gets a list of all available scene transitions. The callback receives an array of transition objects with their names, kinds, and whether they are fixed.
OBSClient.get_scene_transition_list(func(status, data):
if status.result:
pass
)
Dictionary get_server_info() const ๐
Returns information about the connected OBS server, including OBS version, obs-websocket version, and RPC version. Returns an empty dictionary if not connected.
OBSClient.get_server_info()
void get_source_active(source_name: String, callback: Callable = Callable()) ๐
Gets whether a source is currently active (visible in the program output). The callback receives boolean values for video active and showing state.
OBSClient.get_source_active("source_name_value", func(status, data):
if status.result:
pass
)
void get_source_filter(source_name: String, filter_name: String, callback: Callable = Callable()) ๐
Gets information about a specific filter on a source. The callback receives the filter's enabled state, index, kind, and settings.
OBSClient.get_source_filter("source_name_value", "filter_name_value", func(status, data):
if status.result:
pass
)
void get_source_filter_default_settings(filter_kind: String, callback: Callable = Callable()) ๐
Gets the default settings for a specific filter kind. The callback receives a dictionary containing the default configuration values for that filter type.
OBSClient.get_source_filter_default_settings("filter_kind_value", func(status, data):
if status.result:
pass
)
void get_source_filter_kind_list(callback: Callable = Callable()) ๐
Gets a list of all available filter kinds. The callback receives an array of filter kind strings like "color_correction", "sharpness_filter", etc.
OBSClient.get_source_filter_kind_list(func(status, data):
if status.result:
pass
)
void get_source_filter_list(source_name: String, callback: Callable = Callable()) ๐
Gets a list of all filters applied to a source. The callback receives an array of filter objects containing their names, kinds, enabled states, and settings.
OBSClient.get_source_filter_list("source_name_value", func(status, data):
if status.result:
pass
)
void get_source_screenshot(source_name: String, image_format: String, image_width: int = -1, image_height: int = -1, image_compression_quality: int = -1, callback: Callable = Callable()) ๐
Takes a screenshot of a source and returns it as a base64-encoded image. The image_format can be "png", "jpg", etc. Optional parameters control the dimensions and quality. The callback receives the base64-encoded image data.
OBSClient.get_source_screenshot("source_name_value", "example_string", func(status, data):
if status.result:
pass
)
void get_special_inputs(callback: Callable = Callable()) ๐
Gets the names of special inputs like Desktop Audio, Mic/Aux, and others. The callback receives a dictionary with the special input names.
OBSClient.get_special_inputs(func(status, data):
if status.result:
pass
)
void get_stats(callback: Callable = Callable()) ๐
Gets statistics about OBS performance including CPU usage, memory usage, FPS, and frame counts.
OBSClient.get_stats(func(status, data):
if status.result:
pass
)
void get_stream_service_settings(callback: Callable = Callable()) ๐
Gets the current streaming service settings including service type and configuration. The callback receives the stream service type and settings dictionary.
OBSClient.get_stream_service_settings(func(status, data):
if status.result:
pass
)
void get_stream_status(callback: Callable = Callable()) ๐
Gets the current status of the stream output. The callback receives information about whether streaming is active, the timecode, bitrate, and other streaming metrics.
OBSClient.get_stream_status(func(status, data):
if status.result:
pass
)
void get_studio_mode_enabled(callback: Callable = Callable()) ๐
Gets whether studio mode is currently enabled. Studio mode allows previewing scenes before transitioning them to program. The callback receives a boolean indicating studio mode state.
OBSClient.get_studio_mode_enabled(func(status, data):
if status.result:
pass
)
void get_transition_kind_list(callback: Callable = Callable()) ๐
Gets a list of all available transition kinds. The callback receives an array of transition kind strings like "fade_transition", "cut_transition", etc.
OBSClient.get_transition_kind_list(func(status, data):
if status.result:
pass
)
void get_version(callback: Callable = Callable()) ๐
Gets version information about OBS and obs-websocket. The callback receives the OBS version, obs-websocket version, RPC version, available requests, and platform information.
OBSClient.get_version(func(status, data):
if status.result:
pass
)
void get_video_settings(callback: Callable = Callable()) ๐
Gets the current video settings including base and output resolution, FPS, and video format. The callback receives a dictionary with all video configuration values.
OBSClient.get_video_settings(func(status, data):
if status.result:
pass
)
void get_virtual_cam_status(callback: Callable = Callable()) ๐
Gets the current status of the virtual camera output.
OBSClient.get_virtual_cam_status(func(status, data):
if status.result:
pass
)
bool is_obs_connected() const ๐
Returns true if currently connected and authenticated with an OBS WebSocket server.
OBSClient.is_obs_connected()
void offset_media_input_cursor(input_name: String, media_cursor_offset: int) ๐
Offsets the current playback position of a media input by the specified number of milliseconds. Use negative values to seek backwards.
OBSClient.offset_media_input_cursor("input_name_value", 0)
void open_input_filters_dialog(input_name: String) ๐
Opens the filters dialog for the specified input in the OBS user interface.
OBSClient.open_input_filters_dialog("input_name_value")
void open_input_interact_dialog(input_name: String) ๐
Opens the interact dialog for the specified input in the OBS user interface. This is useful for sources like browser sources that support interaction.
OBSClient.open_input_interact_dialog("input_name_value")
void open_input_properties_dialog(input_name: String) ๐
Opens the properties dialog for the specified input in the OBS user interface.
OBSClient.open_input_properties_dialog("input_name_value")
void open_source_projector(source_name: String, monitor_index: int = -1, projector_geometry: String = "") ๐
Opens a projector window displaying the specified source. Use monitor_index to open on a specific monitor, or provide projector_geometry as a string in the format "X,Y,Width,Height" for custom positioning.
OBSClient.open_source_projector("source_name_value")
void open_video_mix_projector(video_mix_type: String, monitor_index: int = -1, projector_geometry: String = "") ๐
Opens a projector window displaying a video mix. The video_mix_type can be "OBS_WEBSOCKET_VIDEO_MIX_TYPE_PREVIEW" or "OBS_WEBSOCKET_VIDEO_MIX_TYPE_PROGRAM". Use monitor_index to open on a specific monitor, or provide projector_geometry for custom positioning.
OBSClient.open_video_mix_projector("example_string")
void pause_record() ๐
Pauses the record output. The recording will remain active but stop writing to the file.
OBSClient.pause_record()
void poll() ๐
Polls the WebSocket connection to process incoming and outgoing messages. This method must be called regularly (typically in _process) for the client to function properly. Without regular polling, messages will not be received and the connection will not complete its handshake.
func _process(delta):
OBSClient.poll()
void reidentify(event_subscriptions: int) ๐
Updates the event subscription mask without disconnecting. Use this to change which event categories you want to receive.
# Change to only receive scene and output events
OBSClient.reidentify(
OBSEventSubscription.SCENES | OBSEventSubscription.OUTPUTS
)
void remove_input(input_name: String) ๐
Removes an input (source) from OBS. This will also remove all scene items referencing this input.
OBSClient.remove_input("input_name_value")
void remove_profile(profile_name: String) ๐
Removes a profile from OBS. The profile cannot be the currently active profile.
OBSClient.remove_profile("profile_name_value")
void remove_scene(scene_name: String) ๐
Removes a scene from OBS. The scene cannot be the currently active program or preview scene.
OBSClient.remove_scene("scene_name_value")
void remove_scene_item(scene_name: String, scene_item_id: int) ๐
Removes a scene item from a scene. This does not delete the underlying source, only the reference to it in this scene.
OBSClient.remove_scene_item("scene_name_value", 0)
void remove_source_filter(source_name: String, filter_name: String) ๐
Removes a filter from a source.
OBSClient.remove_source_filter("source_name_value", "filter_name_value")
void resume_record() ๐
Resumes the record output after it has been paused.
OBSClient.resume_record()
void save_replay_buffer() ๐
Saves the current replay buffer to disk. The replay buffer must be active for this to work.
OBSClient.save_replay_buffer()
void save_source_screenshot(source_name: String, image_format: String, image_file_path: String, image_width: int = -1, image_height: int = -1, image_compression_quality: int = -1) ๐
Takes a screenshot of a source and saves it to a file. The image_format can be "png", "jpg", etc. The image_file_path specifies where to save the file. Optional parameters control the dimensions and quality.
OBSClient.save_source_screenshot("source_name_value", "example_string", "example_string")
String send_request(request_type: String, request_data: Dictionary = {}, callback: Callable = Callable()) ๐
Sends a generic request to OBS. This is a low-level method that can be used for any request type. Returns the request ID string. If callback is provided, it will be called when the response is received with the request status and response data.
OBSClient.send_request("GetInputList", {"inputKind": "browser_source"},
func(status, data):
if status.result:
print("Browser sources: ", data.inputs)
)
String send_request_batch(requests: Array, halt_on_failure: bool = false, execution_type: int = 0, callback: Callable = Callable()) ๐
Sends a batch of requests to OBS. If halt_on_failure is true, processing stops at the first failed request. The execution_type determines how requests are processed (serial realtime, serial frame, or parallel).
OBSClient.send_request_batch([], func(status, data):
if status.result:
pass
)
void send_stream_caption(caption_text: String) ๐
Sends CEA-608 caption text over the stream output.
OBSClient.send_stream_caption("example_string")
void set_current_preview_scene(scene_name: String) ๐
Sets the current preview scene when studio mode is enabled. Returns an error if studio mode is not active.
OBSClient.set_current_preview_scene("scene_name_value")
void set_current_profile(profile_name: String) ๐
Switches to the specified profile. This will reload OBS configuration with the settings from that profile.
OBSClient.set_current_profile("profile_name_value")
void set_current_program_scene(scene_name: String) ๐
Switches to the specified scene in the program output.
OBSClient.set_current_program_scene("scene_name_value")
void set_current_scene_collection(scene_collection_name: String) ๐
Switches to the specified scene collection. Note: This will block until the collection has finished changing.
OBSClient.set_current_scene_collection("scene_collection_name_value")
void set_current_scene_transition(transition_name: String) ๐
Sets the current scene transition by name.
OBSClient.set_current_scene_transition("transition_name_value")
void set_current_scene_transition_duration(transition_duration: int) ๐
Sets the duration of the current scene transition in milliseconds.
OBSClient.set_current_scene_transition_duration(0)
void set_current_scene_transition_settings(transition_settings: Dictionary, overlay: bool = true) ๐
Sets the settings of the current scene transition. If overlay is true, only the provided settings are changed; if false, all settings are replaced.
OBSClient.set_current_scene_transition_settings({})
void set_input_mute(input_name: String, input_muted: bool) ๐
Sets the mute state of an input. If true, the input will be muted.
OBSClient.set_input_mute("input_name_value", true)
void set_input_name(input_name: String, new_input_name: String) ๐
Renames an input to a new name. The new name must not already exist.
OBSClient.set_input_name("input_name_value", "new_input_name_value")
void set_input_settings(input_name: String, input_settings: Dictionary, overlay: bool = true) ๐
Sets the settings of an input. If overlay is true, only the provided settings are changed; if false, all settings are replaced.
OBSClient.set_input_settings("input_name_value", {})
void set_input_volume(input_name: String, input_volume_mul: float = -1.0, input_volume_db: float = 0.0) ๐
Sets the volume of an input. Provide either input_volume_mul (multiplier 0.0 to 1.0+) or input_volume_db (decibels). If input_volume_mul is -1.0, the decibel value is used.
OBSClient.set_input_volume("input_name_value")
void set_media_input_cursor(input_name: String, media_cursor: int) ๐
Sets the absolute playback position of a media input in milliseconds.
OBSClient.set_media_input_cursor("input_name_value", 0)
void set_persistent_data(realm: String, slot_name: String, slot_value: Variant) ๐
Sets persistent data in OBS. The realm defines the storage namespace (e.g., "OBS_WEBSOCKET_DATA_REALM_GLOBAL"). The slot_value can be any JSON-serializable type.
OBSClient.set_persistent_data("example_string", "slot_name_value", null)
void set_profile_parameter(parameter_category: String, parameter_name: String, parameter_value: String) ๐
Sets a specific parameter value in the current profile's configuration file. The parameter_category is the INI section name.
OBSClient.set_profile_parameter("example_string", "parameter_name_value", "example_string")
void set_record_directory(record_directory: String) ๐
Sets the directory path where recordings will be saved.
OBSClient.set_record_directory("example_string")
void set_scene_item_blend_mode(scene_name: String, scene_item_id: int, scene_item_blend_mode: String) ๐
Sets the blend mode of a scene item. The scene_item_blend_mode should be a string like "OBS_BLEND_NORMAL", "OBS_BLEND_ADDITIVE", etc.
OBSClient.set_scene_item_blend_mode("scene_name_value", 0, "example_string")
void set_scene_item_enabled(scene_name: String, scene_item_id: int, scene_item_enabled: bool) ๐
Sets whether a scene item is enabled (visible). If false, the item will be hidden.
OBSClient.set_scene_item_enabled("scene_name_value", 0, true)
void set_scene_item_index(scene_name: String, scene_item_id: int, scene_item_index: int) ๐
Sets the index (z-order position) of a scene item. Lower indices are rendered first (behind higher indices).
OBSClient.set_scene_item_index("scene_name_value", 0, 0)
void set_scene_item_locked(scene_name: String, scene_item_id: int, scene_item_locked: bool) ๐
Sets whether a scene item is locked. Locked items cannot be moved or resized in the OBS user interface.
OBSClient.set_scene_item_locked("scene_name_value", 0, true)
void set_scene_item_transform(scene_name: String, scene_item_id: int, scene_item_transform: Dictionary) ๐
Sets the transform properties of a scene item. The scene_item_transform dictionary can include position, scale, rotation, crop, bounds, and alignment values.
OBSClient.set_scene_item_transform("scene_name_value", 0, {})
void set_scene_name(scene_name: String, new_scene_name: String) ๐
Renames a scene to a new name. The new name must not already exist.
OBSClient.set_scene_name("scene_name_value", "new_scene_name_value")
void set_scene_scene_transition_override(scene_name: String, transition_name: String, transition_duration: int = -1) ๐
Sets a transition override for a specific scene. When switching to this scene, the specified transition will be used instead of the default. If transition_duration is provided and not -1, it overrides the transition's default duration.
OBSClient.set_scene_scene_transition_override("scene_name_value", "transition_name_value")
void set_source_filter_enabled(source_name: String, filter_name: String, filter_enabled: bool) ๐
Sets whether a filter is enabled. Disabled filters remain on the source but don't affect the output.
OBSClient.set_source_filter_enabled("source_name_value", "filter_name_value", true)
void set_source_filter_index(source_name: String, filter_name: String, filter_index: int) ๐
Sets the index (order) of a filter in the filter chain. Filters are applied in order from index 0 upward.
OBSClient.set_source_filter_index("source_name_value", "filter_name_value", 0)
void set_source_filter_name(source_name: String, filter_name: String, new_filter_name: String) ๐
Renames a filter to a new name. The new name must not already exist on the source.
OBSClient.set_source_filter_name("source_name_value", "filter_name_value", "new_filter_name_value")
void set_source_filter_settings(source_name: String, filter_name: String, filter_settings: Dictionary, overlay: bool = true) ๐
Sets the settings of a filter. If overlay is true, only the provided settings are changed; if false, all settings are replaced.
OBSClient.set_source_filter_settings("source_name_value", "filter_name_value", {})
void set_stream_service_settings(stream_service_type: String, stream_service_settings: Dictionary) ๐
Sets the streaming service configuration. The stream_service_type specifies the service (e.g., "rtmp_custom"), and stream_service_settings contains the service-specific configuration like server and key.
OBSClient.set_stream_service_settings("example_string", {})
void set_studio_mode_enabled(studio_mode_enabled: bool) ๐
Enables or disables studio mode. When enabled, studio mode allows previewing scenes before transitioning them to program output.
OBSClient.set_studio_mode_enabled(true)
void set_tbar_position(position: float, release: bool = true) ๐
Sets the T-bar position for manual transition control in studio mode. The position ranges from 0.0 to 1.0. If release is true, the transition completes automatically; if false, it stays at the specified position.
OBSClient.set_tbar_position(0)
void set_video_settings(video_settings: Dictionary) ๐
Sets the video settings including base and output resolution, FPS numerator and denominator.
OBSClient.set_video_settings({})
void split_record_file() ๐
Splits the current recording file. The recording continues but starts writing to a new file. This is useful for creating segment breaks in long recordings.
OBSClient.split_record_file()
void start_record() ๐
Starts the record output.
OBSClient.start_record()
void start_replay_buffer() ๐
Starts the replay buffer output. The replay buffer continuously records recent video which can be saved on demand using save_replay_buffer().
OBSClient.start_replay_buffer()
void start_stream() ๐
Starts the stream output.
OBSClient.start_stream()
void start_virtual_cam() ๐
Starts the virtual camera output.
OBSClient.start_virtual_cam()
void stop_record(callback: Callable = Callable()) ๐
Stops the record output. The callback receives the file path where the recording was saved.
OBSClient.stop_record(func(status, data):
if status.result:
pass
)
void stop_replay_buffer() ๐
Stops the replay buffer output.
OBSClient.stop_replay_buffer()
void stop_stream() ๐
Stops the stream output.
OBSClient.stop_stream()
void stop_virtual_cam() ๐
Stops the virtual camera output.
OBSClient.stop_virtual_cam()
void subscribe_to_events(event_mask: int, callback: Callable) ๐
Subscribes to specific event categories using a callback function. The event_mask is a bitmask of OBSEventSubscription flags. The callback will be called for matching events with the event type and event data.
OBSClient.subscribe_to_events(
OBSEventSubscription.SCENES | OBSEventSubscription.OUTPUTS,
func(event_type, event_data):
print("Event: ", event_type)
print("Data: ", event_data)
)
void toggle_input_mute(input_name: String, callback: Callable = Callable()) ๐
Toggles the mute state of an input. If muted, it will be unmuted and vice versa. The callback receives the new mute state.
OBSClient.toggle_input_mute("input_name_value", func(status, data):
if status.result:
pass
)
void toggle_record(callback: Callable = Callable()) ๐
Toggles the record output state (starts if stopped, stops if started).
OBSClient.toggle_record(func(status, data):
if status.result:
pass
)
void toggle_record_pause() ๐
Toggles the pause state of the recording. If paused, it will resume; if recording, it will pause.
OBSClient.toggle_record_pause()
void toggle_replay_buffer(callback: Callable = Callable()) ๐
Toggles the replay buffer output state (starts if stopped, stops if started).
OBSClient.toggle_replay_buffer(func(status, data):
if status.result:
pass
)
void toggle_stream(callback: Callable = Callable()) ๐
Toggles the stream output state (starts if stopped, stops if started).
OBSClient.toggle_stream(func(status, data):
if status.result:
pass
)
void toggle_virtual_cam(callback: Callable = Callable()) ๐
Toggles the virtual camera output state (starts if stopped, stops if started).
OBSClient.toggle_virtual_cam(func(status, data):
if status.result:
pass
)
void trigger_hotkey_by_name(hotkey_name: String, context_name: String = "") ๐
Triggers a hotkey by its name. Use get_hotkey_list() to get available hotkey names. The optional context_name can specify a source context for source-specific hotkeys.
OBSClient.trigger_hotkey_by_name("hotkey_name_value")
void trigger_media_input_action(input_name: String, media_action: String) ๐
Triggers a media action on a media input. The media_action should be one of: "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY", "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE", "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP", "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART", "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NEXT", or "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PREVIOUS".
OBSClient.trigger_media_input_action("input_name_value", "example_string")
void trigger_studio_mode_transition() ๐
Triggers a transition from the current preview scene to program in studio mode. This is equivalent to clicking the Transition button in OBS.
OBSClient.trigger_studio_mode_transition()
void unsubscribe_from_events(event_mask: int, callback: Callable) ๐
Unsubscribes a previously registered callback from specific event categories.
OBSClient.unsubscribe_from_events(0, func(status, data):
if status.result:
pass
)