Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

upnp-device

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

upnp-device

Create UPnP devices in Node.js

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

UPnP Devices in Node.js

upnp-device lets you create UPnP Devices in Node.js. The goal is to have an easy to use API, rather than exposing all UPnP internals.

Limitations

  • Only implemented device specification is MediaServer:1
  • MediaServer can only serve media from local file system
  • And more...

Install

upnp-device is not ready for npm yet, so you need to install manually by cloning this repository.

Node 0.4.12 is recommended. upnp-device is not compatible with Node 0.6.x due to some missing UDP features in 0.6.x. They are expected to be implemented fairly soon, and then upnp-device will be ported to 0.6.x.

Additionally, to use the MediaServer device you need to install redis.

Documentation

Basic usage

JavaScript

var upnp = require('upnp-device');

var mediaServer = upnp.createDevice('MediaServer', 'My Media Application');

mediaServer.on('ready', function() {
    mediaServer.addMedia(0, media, function(err, id) {
        console.log("Added new media with ID:" + id);
    });
    mediaServer.announce();
});

API

upnp.Device

Event: 'ready'
Event: 'error'

upnp.createDevice(type, name[, address])

  • type - A device specified by the UPnP Forum.
  • name - The name of the device as it shows up in the network.
  • address - Optional IP address to bind server to.

device.announce()

Announces the device over SSDP to the local network.

device.addMedia(parentID, media[, callback])

Applies to MediaServer.

The metadata needs to be extracted by the client, either through user input or by reading for example ID3 tags.

  • parentID - Parent container of media. 0 means root.
  • properties - Object with class properties. Example below.
  • [callback(err, id)] - Called when all media has been added to the database. Returns the ID of the top container added.
container = {
    class: 'object.container.album.musicAlbum',
    title: 'My album' };
item = {
    class: 'object.container.audioItem.musicTrack',
    title: 'My song',
    creator: 'An artist',
    location: '/media/mp3/an_artist-my_song.mp3',
    album: 'My album' };

Other official UPnP classes and properties are defined in the MediaServer specification.

The server only stores this info for as long as it is running. It is the responsibility of the client to store media information across restarts if desired.

Development

upnp-device is written in CoffeeScript.

Contributions and comments are welcome on GitHub or IRC (jacobrask@FreeNode).

Acronyms

  • UDA: [UPnP Device Architecture] upnp-uda
  • DCP: [UPnP Device Control Protocol] upnp-dcp
  • DIDL: Digital Item Declaration Language, XML dialect for describing media. To describe content in AV devices, UPnP uses DIDL-Lite, a subset of DIDL.
  • UPnP AV: [UPnP Audio/Video] upnp-av

See also

Keywords

FAQs

Package last updated on 16 Dec 2011

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc