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

node-upnp-remote

v1.2.0

Published

UPnP Remote Control

Downloads

86

Readme

UPnP Remote

NPM Version NPM Downloads

Remote control for UPnP media devices (tv, speakers, amplifiers, network streamers).

Install

npm i node-upnp-remote

Usage

const UPnPRemote = require('node-upnp-remote');

const remote = new UPnPRemote({
  url: 'http://192.168.1.150:44042/some.xml'
});

function volumeHandler(vol) {
  console.log('Volume', vol);
}

await remote.on('Volume', volumeHandler);
const volume = await remote.getVolume();
await remote.setVolume(volume + 1);
await remote.off('Volume', volumeHandler);

Events

UPnP Remote adds following events for convenience:

  • Transitioning
  • Playing
  • Paused
  • Stopped

note that all events names start with a capital letter as it is defined in UPnP

API

async setURI(options)

loads the media file to the device. Options are:

  • protocolInfo – protocol information
  • upnpClass - string, or you can use const upnpclass = require('node-upnp-remote/upnpclass');
  • autoplay - boolean
  • uri – string, uri to the file
  • title – string, file title
  • creator - string, file creator

or

  • protocolInfo – protocol information
  • uri – string, uri to the file
  • metadata – object that reperesent metadata XML. Example:
{
  "@id": 0,
  "@parentId": -1,
  "@restricted": false,
  "upnp:class": "object.item.audioItem",
  "dc:title": "Title",
  "dc:creator": "Artist",
  "res": {
    "@protocolInfo": "http-get:*:video/mp3:*",
    "#text": "https://archive.org/download/testmp3testfile/mpthreetest.mp3"
  }
}

Properties names start with '@' will be parsed as attributes in the XML

async on(eventName, listener)

adds UPnP event listener

async off(eventName, listener)

removes UPnP event listener

async removeAllListeners()

removes all listeners from all UPnP events

async play(speed = 1)

sets the play speed, default is 1

async pause()

pauses current playback

async stop()

stops current playback

async seek(seconds)

sets the playback time to seconds

async next()

switches to next track

async previous()

switches to previous track

async getVolume(channel = 'Master')

Gets the volume for the channel

async setVolume(volume, channel = 'Master')

Sets the volume for the channel

async getMute(channel = 'Master')

gets the mute state for the channel

async setMute(state, channel = 'Master')

sets the mute state for the channel

async getProtocolsInfo()

returns the supported protocols

async getMediaInfo()

returns the current media info

async getPositionInfo()

returns the current position

async getTransportInfo()

returns the transport info

async getTransportSettings()

returns the transport settings

async getDeviceCapabilities()

returns the device capabilities

License MIT