How to use casparcg-connection - 10 common examples

To help you get started, we’ve selected a few casparcg-connection 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 / agdq18-layouts / extension / caspar.js View on Github external
// Ours
const nodecg = require('./util/nodecg-api-context').get();

let foregroundFileName = '';
let currentFrame = 0;
let durationFrames = 0;
let fileMayHaveRestarted = false;
let updateFilesInterval;
let ignoreForegroundUntilNextPlay = false;

const log = new nodecg.Logger(`${nodecg.bundleName}:caspar`);
const currentRun = nodecg.Replicant('currentRun');
const files = nodecg.Replicant('caspar:files', {persistent: false});
const connected = nodecg.Replicant('caspar:connected');
const connection = new CasparCG({
	host: nodecg.bundleConfig.casparcg.host,
	port: nodecg.bundleConfig.casparcg.port,
	onConnected() {
		connected.value = true;
		log.info('Connected.');
		clearInterval(updateFilesInterval);
		updateFiles();
		updateFilesInterval = setInterval(updateFiles, 60000);

		if (nodecg.bundleConfig.casparcg.lockSecret) {
			connection.lock(1, CasparEnum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
				log.info('Lock acquired.');
			}).catch(e => {
				log.error('Failed to acquire lock:', e);
				connected.value = false;
			});
github GamesDoneQuick / sgdq18-layouts / dist / extension / caspar.js View on Github external
const CasparCG = require("casparcg-connection");
const debounce = require("lodash.debounce");
// Ours
const nodecgApiContext = require("./util/nodecg-api-context");
let foregroundFileName = '';
let currentFrame = 0;
let durationFrames = 0;
let fileMayHaveRestarted = false;
let updateFilesInterval;
let ignoreForegroundUntilNextPlay = false;
const nodecg = nodecgApiContext.get();
const log = new nodecg.Logger(`${nodecg.bundleName}:caspar`);
const currentRun = nodecg.Replicant('currentRun');
const files = nodecg.Replicant('caspar:files', { persistent: false });
const connected = nodecg.Replicant('caspar:connected');
const connection = new CasparCG.CasparCG({
    host: nodecg.bundleConfig.casparcg.host,
    port: nodecg.bundleConfig.casparcg.port,
    onConnected() {
        connected.value = true;
        log.info('Connected.');
        clearInterval(updateFilesInterval);
        updateFiles();
        updateFilesInterval = setInterval(updateFiles, 30000);
        if (nodecg.bundleConfig.casparcg.lockSecret) {
            connection.lock(1, CasparCG.Enum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
                log.info('Lock acquired.');
            }).catch(e => {
                log.error('Failed to acquire lock:', e);
                connected.value = false;
            });
        }
github GamesDoneQuick / sgdq17-layouts / extension / caspar.js View on Github external
const debounce = require('lodash.debounce');

// Ours
const nodecg = require('./util/nodecg-api-context').get();

let foregroundFileName = '';
let currentFrame = 0;
let durationFrames = 0;
let fileMayHaveRestarted = false;
let updateFilesInterval;

const log = new nodecg.Logger(`${nodecg.bundleName}:caspar`);
const currentRun = nodecg.Replicant('currentRun');
const files = nodecg.Replicant('caspar:files', {persistent: false});
const connected = nodecg.Replicant('caspar:connected');
const connection = new CasparCG({
	host: nodecg.bundleConfig.casparcg.host,
	port: nodecg.bundleConfig.casparcg.port,
	onConnected() {
		connected.value = true;
		log.info('Connected.');
		clearInterval(updateFilesInterval);
		updateFiles();
		updateFilesInterval = setInterval(updateFiles, 60000);

		connection.lock(1, CasparEnum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
			log.info('Lock acquired.');
		}).catch(e => {
			log.error('Failed to acquire lock:', e);
			connected.value = false;
		});
	},
github GamesDoneQuick / sgdq18-layouts / src / extension / caspar.ts View on Github external
// Ours
import * as nodecgApiContext from './util/nodecg-api-context';

let foregroundFileName = '';
let currentFrame = 0;
let durationFrames = 0;
let fileMayHaveRestarted = false;
let updateFilesInterval: NodeJS.Timer;
let ignoreForegroundUntilNextPlay = false;

const nodecg = nodecgApiContext.get();
const log = new nodecg.Logger(`${nodecg.bundleName}:caspar`);
const currentRun = nodecg.Replicant('currentRun');
const files = nodecg.Replicant('caspar:files', {persistent: false});
const connected = nodecg.Replicant('caspar:connected');
const connection = new CasparCG.CasparCG({
	host: nodecg.bundleConfig.casparcg.host,
	port: nodecg.bundleConfig.casparcg.port,
	onConnected() {
		connected.value = true;
		log.info('Connected.');
		clearInterval(updateFilesInterval);
		updateFiles();
		updateFilesInterval = setInterval(updateFiles, 30000);

		if (nodecg.bundleConfig.casparcg.lockSecret) {
			connection.lock(1, CasparCG.Enum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
				log.info('Lock acquired.');
			}).catch(e => {
				log.error('Failed to acquire lock:', e);
				connected.value = false;
			});
github olzzon / casparcg-state-scanner / src / app.ts View on Github external
constructor() {

        //Binds:
        this.connectLog = this.connectLog.bind(this);
        this.startTimerControlledServices = this.startTimerControlledServices.bind(this);

        //PubSub:
        this.pubsub = new PubSub();

        //Setup AMCP Connection:
        this.ccgConnection = new CasparCG(
            {
                host: DEFAULTS.CCG_HOST,
                port: DEFAULTS.CCG_AMCP_PORT,
                autoConnect: true,
            }
        );

        //Define vars:
        this.configFile = readCasparCgConfigFile();
        this.ccgNumberOfChannels = this.configFile.configuration.channels.channel.length || 1;
        this.ccgChannel = generateCcgDataStructure(this.ccgNumberOfChannels);

        //Setup folder watchers :
        mediaFolderWatchSetup(this.configFile.configuration.paths['media-path']._text);
        dataFolderWatchSetup(this.configFile.configuration.paths['data-path']._text);
        templateFolderWatchSetup(this.configFile.configuration.paths['template-path']._text);
github GamesDoneQuick / sgdq18-layouts / src / extension / caspar.ts View on Github external
export function loadbgAuto(filename: string) {
	return connection.loadbgAuto(1, undefined, filename, false, CasparCG.Enum.Transition.CUT);
}
github GamesDoneQuick / sgdq18-layouts / dist / extension / caspar.js View on Github external
onConnected() {
        connected.value = true;
        log.info('Connected.');
        clearInterval(updateFilesInterval);
        updateFiles();
        updateFilesInterval = setInterval(updateFiles, 30000);
        if (nodecg.bundleConfig.casparcg.lockSecret) {
            connection.lock(1, CasparCG.Enum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
                log.info('Lock acquired.');
            }).catch(e => {
                log.error('Failed to acquire lock:', e);
                connected.value = false;
            });
        }
    },
    onDisconnected() {
github GamesDoneQuick / sgdq18-layouts / src / extension / caspar.ts View on Github external
onConnected() {
		connected.value = true;
		log.info('Connected.');
		clearInterval(updateFilesInterval);
		updateFiles();
		updateFilesInterval = setInterval(updateFiles, 30000);

		if (nodecg.bundleConfig.casparcg.lockSecret) {
			connection.lock(1, CasparCG.Enum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
				log.info('Lock acquired.');
			}).catch(e => {
				log.error('Failed to acquire lock:', e);
				connected.value = false;
			});
		}
	},
	onDisconnected() {
github GamesDoneQuick / sgdq18-layouts / dist / extension / caspar.js View on Github external
function loadbgAuto(filename) {
    return connection.loadbgAuto(1, undefined, filename, false, CasparCG.Enum.Transition.CUT);
}
exports.loadbgAuto = loadbgAuto;
github GamesDoneQuick / sgdq17-layouts / extension / caspar.js View on Github external
onConnected() {
		connected.value = true;
		log.info('Connected.');
		clearInterval(updateFilesInterval);
		updateFiles();
		updateFilesInterval = setInterval(updateFiles, 60000);

		connection.lock(1, CasparEnum.Lock.ACQUIRE, nodecg.bundleConfig.casparcg.lockSecret).then(() => {
			log.info('Lock acquired.');
		}).catch(e => {
			log.error('Failed to acquire lock:', e);
			connected.value = false;
		});
	},
	onDisconnected() {

casparcg-connection

Node.js Javascript/Typescript library for CasparCG connection and commands.

MIT
Latest version published 3 months ago

Package Health Score

76 / 100
Full package analysis