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

xmedia-node

v1.0.66

Published

Medialooks xMediaNode client library

Downloads

23

Readme

xMediaNode Server Client

Overview

xMediaNode is a cross-platform, easy-to-use, modular product that allows you to receive media data from files, capture cards, and other software and hardware products, encode, decode, and transmit them over the internet using known standards (such as UDP, SRT, RTP, RTMP, HLS, etc.), including the ability to bypass NAT without the need to open ports. The product consists of the following components:

  • Signaling server (required to establish connections between nodes and centralized management)
  • Auth server (authorization server)
  • xMediaNode server (media data processing server)
  • xMediaNode client (management client)

All xMediaNode server instances under one license are interconnected via the Signaling server and can be managed using the xMediaNode client.

Installation

npm install xmedia-client

Example of Using xMedia

To start broadcasting to NDI from a local file, you need to:

  • Run xnodeserver at the location where you have access to the media data you plan to work with under your license.

  • Import XMediaService into your project:

    import { XMediaService } from "xmedia-node";
  • Create an xMediaService object:

    const xMediaService = XMediaService();
  • Authenticate using your license details:

    xMediaService.login({
        username: user.username,
        password: user.password,
        signaling_url: user.signaling_url
    } as ILicense);
  • Get the list of locations (xNodeServer instances running under the same license):

    const locations = xMediaService.getLocations(onLocationsChanged); // you can pass a callback to be invoked when locations connect or disconnect
  • Create a source of type "file":

    const source = {
        id: string,           // unique ID
        direction: "src" | "dst", // source or destination flag
        name: string, // name
        busy: boolean, // orchestration parameter (initialize as false)
        chosen: boolean, // orchestration parameter (initialize as true)
        channelId: string, // unique stream ID
        type: endpointType, // source type
        props: currentSrcProps // source settings
    };

    Example:

    {
      "id": "4ec9b2b8-62d5-47f3-b8b8-1a3510b07a27",
      "direction": "src",
      "name": "Source 0",
      "busy": false,
      "chosen": true,
      "channelId": "00",
      "type": "File",
      "props": {
        "path": {
          "moduleData": {
            "type": "demux",
            "propName": "open_url"
          },
          "type": "STRING",
          "value": "/home/rtc/xsdk/ori.mp4"
        },
        "in": {
          "moduleData": {
            "type": "demux",
            "propName": "in"
          },
          "type": "NUMBER",
          "value": 0
        },
        "loop": {
          "moduleData": {
            "type": "demux",
            "propName": "loop"
          },
          "type": "BOOL",
          "value": true
        },
        "out": {
          "moduleData": {
            "type": "demux",
            "propName": "loop"
          },
          "type": "NUMBER",
          "value": 0
        }
      }
    }
  • Create a destination of type NDI:

    const destination = {
        id: "a7c3380a-41b6-4f17-a292-c03f37b10666",
        direction: "dst",
        name: "Destination 0",
        busy: false,
        chosen: true,
        channelId: "00",
        type: "NDI",
        props: {
            "streamName": {
                "moduleData": {
                    "type": "deviceRenderer",
                    "propName": "open_url"
                },
                "type": "STRING",
                "value": "ndi"
            }
        }
    };
  • Initialize the channel:

    const initChannelResult = await xMediaService.initChannel(
        locations[0], // target location with running xNodeServer
        channelId,
        [source],
        [destination]
    );

xMediaService API

All API methods return a response matching the IResponse interface, which contains one or two fields:

  • response (mandatory): if the request is processed without errors, this field contains the response data described in the table below. In case of an error, this field contains the error description.
  • failed (optional boolean): true if an error occurred.

| Endpoint | Parameters | Response | |------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------| | login | { username: string, password: string, signaling_url: string } | { user: ILicense, publisherIdSettable: boolean } | | logout | | any | | getLocations | onLocationsChange: (locations: xServer[]) => void,publisherId?: string | xServer[] | | getSourceOptions | location: xServer, endpointType: EndpointTypes, endpoint?: IEndpoint | IEndpointOptions | | getDestinationOptions | location: xServer, endpointType: EndpointTypes, endpoint?: IEndpoint | IEndpointOptions | | initChannel | location: xServer, channelId: string, sources: ISource[], destinations: IDestination[], selectedSources: string[], selectedDestinations: string[], previewFrameInterval: number | IChannel | | getChannelStat | channel: IChannel, nodePath?: string[] | XStat | | clearChannel | channel: IChannel | any | | clearLocationStruct | location: xServer | string | | startChannel | channel: IChannel | IChannel | | stopChannel | channel: IChannel | IChannel | | subscribeToPreview | channel: IChannel, onFrameCb: (frameB64String: string) => void, previewParams?: MediaGetCommand | string | | unSubscribeFromPreview | channel: IChannel | string |