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 🙏

© 2026 – Pkg Stats / Ryan Hefner

bmd-videohub-client-ts

v1.0.1

Published

TypeScript client library for BlackMagic Design VideoHub

Readme

BlackMagic Design VideoHub Client

A TypeScript client library for controlling BlackMagic Design VideoHub devices over TCP. Provides an event-driven interface for monitoring and controlling video routing in professional broadcast environments.

Features

  • 🔌 TCP connection management with automatic keepalive
  • 📡 Event-driven architecture using Node.js EventEmitter
  • 🎯 Type-safe TypeScript API with full IntelliSense support
  • 🔄 Real-time monitoring of routing changes and device state
  • 🔒 Output lock state management
  • ⚡ Operation queuing to prevent command conflicts
  • 🧪 Comprehensive test coverage

Installation

npm install bmd-videohub-client-ts

Quick Start

import { VideohubClient } from 'bmd-videohub-client-ts';

const client = new VideohubClient();

// Connect to VideoHub device
await client.connect('192.168.1.100', 9990);

// Listen for routing changes
client.on('outputRouting', (routes) => {
  console.log('Current routing:', routes);
});

// Change routing: connect input 2 to output 5
await client.setRoute(2, 5);

// Disconnect
client.disconnect();

API Reference

VideohubClient

The main client class that extends Node.js EventEmitter.

Methods

connect(host: string, port?: number, timeout?: number): Promise<void>

Connects to a VideoHub device.

  • host - IP address or hostname of the VideoHub device
  • port - TCP port (default: 9990)
  • timeout - Connection timeout in milliseconds (default: 2000)
setRoute(source: number, target: number): Promise<void>

Changes video routing by connecting a source input to a target output.

  • source - Input port number (0-based)
  • target - Output port number (0-based)
disconnect(): void

Closes the connection to the VideoHub device.

Events

The client emits the following events:

| Event | Payload | Description | |-------|---------|-------------| | connected | void | Fired when successfully connected | | disconnected | void | Fired when connection is closed | | error | Error | Fired when an error occurs | | protocol | {version: string} | Protocol version information | | deviceInfo | {model: string, version: string, uniqueId: string} | Device capabilities | | inputLabels | Map<number, string> | Input port labels | | outputLabels | Map<number, string> | Output port labels | | outputLocks | Map<number, OutputLock> | Output lock states | | outputRouting | Route[] | Current routing configuration | | config | object | Device configuration settings |

Types

interface Route {
  source: number;
  target: number;
}

enum OutputLock {
  Local = 'O',
  Extern = 'L',
  Unlocked = 'U'
}

Examples

Monitor All Device Changes

import { VideohubClient } from 'bmd-videohub-client-ts';

const client = new VideohubClient();

client.on('connected', () => {
  console.log('Connected to VideoHub');
});

client.on('inputLabels', (labels) => {
  console.log('Input labels updated:', labels);
});

client.on('outputRouting', (routes) => {
  routes.forEach(route => {
    console.log(`Output ${route.target} ← Input ${route.source}`);
  });
});

client.on('outputLocks', (locks) => {
  console.log('Lock states:', locks);
});

await client.connect('192.168.1.100');

Batch Routing Changes

const routingChanges = [
  { source: 0, target: 0 },
  { source: 1, target: 1 },
  { source: 2, target: 2 }
];

for (const route of routingChanges) {
  await client.setRoute(route.source, route.target);
  // Operations are automatically queued to prevent conflicts
}

Error Handling

client.on('error', (error) => {
  console.error('VideoHub error:', error.message);
});

try {
  await client.connect('192.168.1.100', 9990, 5000);
} catch (error) {
  console.error('Failed to connect:', error.message);
}

Protocol Support

This library implements the BlackMagic Design VideoHub Ethernet Protocol v2.3. It supports:

  • Protocol version negotiation
  • Device information queries
  • Input/output label management
  • Routing table updates
  • Output lock state monitoring
  • Configuration management

Development

Prerequisites

  • Node.js 16+
  • npm or yarn

Setup

git clone https://github.com/lukirs95/bmd-videohub-client-ts.git
cd bmd-videohub-client-ts
npm install

Scripts

npm run build      # Compile TypeScript
npm run clean      # Remove dist directory
npm test           # Run tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Generate coverage report

Testing

The library includes comprehensive tests with mocked TCP connections:

npm test

Tests cover:

  • Connection management
  • Protocol message parsing
  • Routing operations
  • Error handling scenarios
  • Event emission

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT

Support

Related


Made with ❤️ for the broadcast community