npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

manycam-sdk

v1.0.0

Published

SDK for ManyCam Websocket API

Downloads

7

Readme

About

Quicklinks

ManyCam

ManyCam is one of the best solutions to take your remote lectures and broadcasts on streaming sites to the next level, as well as expand the capabilities of video conferencing applications. You can connect multiple cameras and other video sources such as mobile devices and presentations, use virtual backgrounds, add new video layers and scenes, broadcast your desktop, and more.

🌐 ManyCam

In order to run API server, you need to switch toggle "Start API server" in ManyCam settings:

Switch toggle

ManyCam Javascript SDK

ManyCam Javascript SDK provides a way to dial with a ManyCam application from Javascript applications using Websocket protocol.

Watch the video how to control ManyCam application from the browser UI! 👇

Control ManyCam application from the custom web UI using ManyCam SDK.

📝 Documentation

Promises based

All SDK methods return a promise resolving the result part of ManyCam API responses. If an error occurs, the promise is rejected with an Error object embedding the error part of the API response. For the action that should return data such as getCurrentPreset, the property result contains class instance of requested data or array of instances. For the control actions such as showUI or setTransitionType, the property result contains boolean true. Any error must be caught either at the end of the Promise chain, or by using async/await and a try...catch.

Note! Try always to await Promises to exclude data overriding in the same commands.

Usage

🔑 Compatibility matrix

| ManyCam Version | SDK Version | | --------------- | ----------- | | 7.x.x | 1.x.x |

🚀 Getting started

Installation

This SDK can be used either in NodeJS or in a browser.

Node.js

npm install manycam-sdk

Then require it:

const ManyCamSDK = require("manycam-sdk");

or using destruction

const { ManyCam } = require("manycam-sdk");

Browser

To run the SDK in the browser, you have to build it yourself by cloning this repository and running

$ npm install
$ npm run build

A dist directory will be created, containing a browser version of this SDK.

<script type="text/javascript" src="dist/manycam.js"></script>

or use the CDN:

<script
	type="text/javascript"
	src="https://cdn.jsdelivr.net/npm/manycam-sdk@latest/dist/manycam.js"
></script>

Then the ManyCam SDK will be available under the ManyCamSDK variable:

<script>
	const manycam = new ManyCamSDK.ManyCam(settings);
	// ...
</script>

🏁 Start to work

When instantiating, you must create settings object containing host, port and access_key provided by Many Cam.

const { ManyCam } = require("manycam-sdk");

let settings = {
	host: "ws://127.0.0.1",
	port: "55500",
	access_key: "access_key",
};
const manyCam = new ManyCam(settings);

access_key can be generated in settings menu of ManyCam as below:

generate access_key

Set up listeners:

// Set up error listener
manyCam.onError((error) => {
	console.log(error.message);
});

// Set up notification listener
manyCam.onNotification((notification) => {
	console.log("Notification: ");
	console.log(notification);
});

Then you need to connect to ManyCam server:

await manyCam.connect();

✏️ Set source example

const { ManyCam, sources } = require("manycam-sdk");

manyCam
	.connect()
	.then(() => {
		run();
	})
	.catch((error) => console.log(error));

const run = async () => {
	// Get current preset
	let preset = await manyCam.getCurrentPreset();

	// Get layer in preset
	let layer = preset.layers[0];
	// or by pip number if layer exist
	// let layer = preset.getLayer(1);

	// Init youtube source and set it to layer
	let yt = new Source(sources.youtube, {
		url: "https://www.youtube.com/watch?v=GEWpQp1yW9U&ab_channel=ManyCam",
	});
	let answer = await layer.setSource(yt); // returns true
};

See more examples 👈