Last active
December 7, 2022 17:50
-
-
Save onyx-and-iris/4b824ee93ac9dbbd701e069ee133b306 to your computer and use it in GitHub Desktop.
toggles record state and prints event notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import obsws_python as obs | |
def on_record_state_changed(data): | |
"""The state of the record output has changed.""" | |
print(f"Current record state: {data.output_state}") | |
if data.output_state == "OBS_WEBSOCKET_OUTPUT_STARTED": | |
print(f"Output Path: {data.output_path}") | |
def main(): | |
client_e = obs.EventClient() | |
client_e.callback.register(on_record_state_changed) | |
with obs.ReqClient() as client_r: | |
client_r.start_record() | |
time.sleep(3) | |
client_r.stop_record() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires the obsws-python package which can be found at https://github.com/aatikturk/obsws-python
This example assumes existence of config file.
example config.toml:
config.toml
should be placed next to your__main__.py