• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An UPnP/DLNA MediaRenderer client

upnp-mediarenderer-client

An UPnP/DLNA MediaRenderer client

This module allows you to control an UPnP/DLNA MediaRenderer directly (usually your TV set). It implements load, play, pause, stop and seek commands.

Events coming from the MediaRenderer (ie. fired from the TV remote) such as playing, paused, stopped can be listened to.

External subtitles are supported through DIDL-Lite metadata, but be aware that some MediaRenderers require the HTTP server serving the media file to return specific headers as illustrated in this gist. Also, some MediaRenderers don't support external subtitles at all.

Installation

$ npm install upnp-mediarenderer-client

Usage

var MediaRendererClient = require('upnp-mediarenderer-client');

// Instanciate a client with a device description URL (discovered by SSDP)
var client = new MediaRendererClient('http://192.168.1.50:4873/foo.xml');

// Load a stream with subtitles and play it immediately
var options = { 
  autoplay: true,
  contentType: 'video/avi',
  metadata: {
    title: 'Some Movie Title',
    creator: 'John Doe',
    type: 'video', // can be 'video', 'audio' or 'image'
    subtitlesUrl: 'http://url.to.some/subtitles.srt'
  }
};

client.load('http://url.to.some/stream.avi', options, function(err, result) {
  if(err) throw err;
  console.log('playing ...');
});

// Pause the current playing stream
client.pause();

// Unpause
client.play();

// Stop
client.stop();

// Seek to 10 minutes
client.seek(10 * 60);

// Get the volume
client.getVolume(function(err, volume) {
  if(err) throw err;
  console.log(volume); // the volume range is 0-100
});

// Set the volume
client.setVolume(40, function(err) {
  if(err) throw err;
  console.log("volume is now", volume);
});

client.on('status', function(status) {
  // Reports the full state of the AVTransport service the first time it fires,
  // then reports diffs. Can be used to maintain a reliable copy of the
  // service internal state.
  console.log(status);
});

client.on('loading', function() {
  console.log('loading');
});

client.on('playing', function() {
  console.log('playing');

  client.getPosition(function(err, position) {
    console.log(position); // Current position in seconds
  });

  client.getDuration(function(err, duration) {
    console.log(duration); // Media duration in seconds
  });
});

client.on('paused', function() {
  console.log('paused');
});

client.on('stopped', function() {
  console.log('stopped');
});

client.on('speedChanged', function(speed) {
  // Fired when the user rewinds of fast-forwards the media from the remote
  console.log('speedChanged', speed);
});

More Repositories

1

node-castv2

An implementation of the Chromecast CASTV2 protocol
JavaScript
758
star
2

node-castv2-client

A Chromecast client based on the new (CASTV2) protocol
JavaScript
638
star
3

b-spline

B-spline interpolation
JavaScript
287
star
4

node-google-search-scraper

Google search scraper with captcha solving support
JavaScript
82
star
5

duckduckgo

Simple duckduckgo results scraping
Python
65
star
6

pop-buffer

Progressive encoding for 3D meshes
JavaScript
59
star
7

styx

Simple, high-performance event streaming broker
Go
52
star
8

cubic-hermite-spline

Cubic Hermite spline interpolation
JavaScript
44
star
9

parse-cube-lut

Cube LUT (IRIDAS/Adobe) parser
JavaScript
34
star
10

rbf

Radial Basis Function (RBF) interpolation
JavaScript
32
star
11

apply-cube-lut

Apply a Cube (IRIDAS/Adobe) LUT to an image
JavaScript
31
star
12

node-upnp-device-client

A simple and versatile UPnP device client
JavaScript
31
star
13

node-rtmpdump

A streamable wrapper around the rtmpdump CLI
JavaScript
19
star
14

parse-wavefront-obj

Wavefront OBJ parser
JavaScript
18
star
15

t411

T411 API client
JavaScript
17
star
16

quantize-vertices

Quantizes vertices to any bit precision
JavaScript
14
star
17

bezier-curve

Bezier curve interpolation
JavaScript
13
star
18

merge-vertices

Merges mesh vertices having identical coordinates
JavaScript
10
star
19

parse-stl

STL (ASCII and binary) file parser
JavaScript
9
star
20

parse-3ds

Parses 3D Studio .3DS files
JavaScript
7
star
21

serialize-stl

STL (ASCII and binary) file serialization
JavaScript
7
star
22

node-sse-emitter

Server-Sent Events as simple as they can get
JavaScript
6
star
23

remove-orphan-vertices

Removes orphan vertices in a simplicial complex
JavaScript
6
star
24

serialize-wavefront-obj

Wavefront OBJ serializer
JavaScript
5
star
25

merge-meshes

Merges multiple meshes into one
JavaScript
5
star
26

vertices-bounding-box

Computes the bounding box of a set of vertices
JavaScript
4
star
27

rescale-vertices

Rescales vertices to the dimensions of a target bounding box
JavaScript
4
star
28

node-host-filtering-proxy

A straightforward host filtering HTTP proxy
JavaScript
4
star
29

ndarray-from-image

Extracts an image RGBA pixels as a ndarray
JavaScript
3
star
30

remove-degenerate-cells

Removes degenerate cells in a simplicial complex
JavaScript
3
star
31

serialize-stl-binary

STL binary serialization
JavaScript
3
star
32

node-generate-source-map

Generates an identity source-map from a javascript file
JavaScript
3
star
33

canvas-from-ndarray

Updates a canvas RGBA pixels from an ndarray
JavaScript
2
star
34

talk-react-bdxio

React.js et l'avenir de l'interface utilisateur HTML5
CSS
2
star
35

parse-stl-binary

STL binary parser
JavaScript
2
star
36

talk-react-bordeauxjs

Keep calm and React !
2
star
37

require

Experiments with module loading in the browser
JavaScript
1
star
38

react-starter

JavaScript
1
star
39

serialize-stl-ascii

STL ASCII serialization
JavaScript
1
star
40

talk-ansible-best

Ansible
JavaScript
1
star
41

eventemitter

Lightweight isomorphic event emitter
JavaScript
1
star
42

set-canvas-pixels

Sets a canvas pixels from an array of RGBA pixel values
JavaScript
1
star
43

get-canvas-pixels

Get an array of RGBA pixel values from a canvas
JavaScript
1
star
44

node-url-stream

Transforms a stream of URLs into a stream of their body content
JavaScript
1
star
45

router

Lightweight isomorphic router
JavaScript
1
star
46

ndarray-from-canvas

Extracts a canvas RGBA pixels as a ndarray
JavaScript
1
star
47

parse-stl-ascii

STL ASCII parser
JavaScript
1
star