Socket
Socket
Sign inDemoInstall

dmx-web-api

Package Overview
Dependencies
2
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

dmx-web-api

Talk DMX via USB directly in the browser (Chrome only for now)


Version published
Maintainers
1
Install size
16.8 kB
Created

Readme

Source

DMX Control directly from your browser

This super tiny lib knows how to talk DMX through browser's Web Serial API. Works with Enttec's Open DMX as well as the Pro version, and Eurolite's USB-DMX512 PRO Interface MK2.

Patches for other devices are most welcome!

Note: the API is supported by Chrome only!

Unfortunately other browsers do not yet support neither the Serial nor USB API's, generally claiming security reasons.

Linux

On linux, the user running the browser needs to be in the dialout group, so make sure you run this line:

sudo usermod -a -G dialout $USER

And then reboot your device.

Install

npm install dmx-web-api

Demo

import {DMX, BufferedBackend} from "dmx-web-api";

let dmxDevice = new DMX();

function initDMX() {
    `The three params passed into init are as follows:
      * onTick - callback that will be executed on every tick
      * backendClass - the class of the backend widget - there seem to be two types - direct communication and buffered.
        Buffered is the pro version and is recommended as it also comes with power isolation and other bits and bobs.
      * requestAccess - default:false, when set to true will ask user to give us access. you can do that only on
        user action. so on init you can call it with false, and then have an interface element that allows user to
        enable access to the device`;
    this.dmxDevice.connect(null, BufferedBackend, true);
}

function updateDMX(data) {
    // data can be either an object of form {channel: value}, or a full 512 element array.
    // set first channel to 255 (say, because you have a simple RGB light listening on address 1)
    this.dmxDevice.update({1: 255, 2: 0, 3: 0});
}

Note on Enttec's Open DMX

Make sure the tab you are sending the signal from is visible at all times, as chrome will spin down the internal timers when the tab is not visible, and you will get flickering lights. A simple way around that is to run a tiny node server and talk sockets to it. Code for doing that is in the github repo.

Keywords

FAQs

Last updated on 26 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc