Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
};
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);
};
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();
}
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);
}
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;