How to use obs-websocket-js - 5 common examples

To help you get started, we’ve selected a few obs-websocket-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GamesDoneQuick / agdq17-layouts / extension / obs-websocket.js View on Github external
module.exports = function (nodecg) {
	const currentScene = nodecg.Replicant('currentScene', {defaultValue: ''});

	// Start with a stub that we'll replace if we have all the config we need.
	module.exports.resetCropping = function () {};

	if (!nodecg.bundleConfig.obsWebsocket.address) {
		nodecg.log.error('"obsWebsocket" is not defined in cfg/agdq17-layouts.json! ' +
			'OBS Studio integration will be disabled.');
		return;
	}

	const ws = new OBSWebSocket();
	let notifiedConnectionFailed = false;

	ws.onConnectionOpened = function () {
		notifiedConnectionFailed = false;
		nodecg.log.info('[obs-websocket] Connected.');
	};

	ws.onAuthenticationSuccess = function () {
		nodecg.log.info('[obs-websocket] Authenticated.');
		getCurrentScene();
	};

	ws.onConnectionClosed = function () {
		nodecg.log.warn('[obs-websocket] Connection closed, attempting to reconnect in 5 seconds.');
		setTimeout(connectToOBS, 5000);
	};
github GamesDoneQuick / sgdq17-layouts / extension / obs-websocket.js View on Github external
module.exports = function (nodecg) {
	const currentScene = nodecg.Replicant('currentScene', {defaultValue: ''});

	// Start with a stub that we'll replace if we have all the config we need.
	module.exports.resetCropping = function () {};

	if (!nodecg.bundleConfig.obsWebsocket.address) {
		nodecg.log.error('"obsWebsocket" is not defined in cfg/sgdq17-layouts.json! ' +
			'OBS Studio integration will be disabled.');
		return;
	}

	const ws = new OBSWebSocket();
	let notifiedConnectionFailed = false;

	ws.onConnectionOpened = function () {
		notifiedConnectionFailed = false;
		nodecg.log.info('[obs-websocket] Connected.');
	};

	ws.onAuthenticationSuccess = function () {
		nodecg.log.info('[obs-websocket] Authenticated.');
		getCurrentScene();
	};

	ws.onConnectionClosed = function () {
		nodecg.log.warn('[obs-websocket] Connection closed, attempting to reconnect in 5 seconds.');
		setTimeout(connectToOBS, 5000);
	};
github project-slippi / slippi-desktop-app / app / domain / SlpFileWriter.js View on Github external
constructor(settings) {
    this.folderPath = settings.folderPath;
    this.onFileStateChange = settings.onFileStateChange;
    this.obsSourceName = settings.obsSourceName;
    this.obsIP = settings.obsIP;
    this.id = settings.id;
    this.consoleNick = settings.consoleNick;
    this.currentFile = this.getClearedCurrentFile();
    this.obs = new OBSWebSocket();
    this.statusOutput = {
      status: false,
      timeout: null,
    };
    this.isRelaying = settings.isRelaying;
    this.clients = [];
    this.manageRelay();
  }
github clarkio / ttv-chat-light / src / server / obs-manager.ts View on Github external
constructor(
    private sceneEffectSettings: any | undefined,
    private permittedScenesForCommand: any | undefined,
    private sceneAliases: any | undefined
  ) {
    this.initSceneEffects();
    this.obs = new ObsWebSocket();
    this.obs
      .connect({
        address: config.obsSocketsServer,
        password: config.obsSocketsKey
      })
      .then(() => {
        log('log', constants.logs.obsConnectionSuccessfulMessage);
        this.getSceneList();
      })
      .catch(this.handleError);

    this.obs.on('error', this.handleError);
  }
github 715209 / nginx-obs-automatic-low-bitrate-switching / src / components / ObsSwitcher.js View on Github external
constructor(address, password, low, normal, offline, lowBitrateTrigger) {
        super();

        this.obs = new OBSWebSocket();
        this.isLive = false;
        this.address = address;
        this.password = password;
        this.lowBitrateScene = low;
        this.normalScene = normal;
        this.offlineScene = offline;
        this.lowBitrateTrigger = lowBitrateTrigger;
        this.bitrate = null;
        this.nginxVideoMeta = null;
        this.streamStatus = null;
        this.heartbeat = null;
        this.obsStreaming = false;
        this.currentScene = null;
        this.nginxSettings;
        this.previousScene = this.lowBitrateScene;
        this.scenes = null;

obs-websocket-js

OBS Websocket API in Javascript, consumes @Palakis/obs-websocket

MIT
Latest version published 3 months ago

Package Health Score

76 / 100
Full package analysis

Popular obs-websocket-js functions