Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including upnp-mediarenderer-client with all npm packages installed. Try it out:

var upnpMediarendererClient = require("upnp-mediarenderer-client")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

upnp-mediarenderer-client v1.2.4

An UPnP/DLNA 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.


$ npm install upnp-mediarenderer-client


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

// Instanciate a client with a device description URL (discovered by SSDP)
var client = new MediaRendererClient('');

// 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: ''

client.load('', options, function(err, result) {
  if(err) throw err;
  console.log('playing ...');

// Pause the current playing stream

// Unpause;

// Stop

// Seek to 10 minutes * 60);

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.

client.on('loading', function() {

client.on('playing', function() {

  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() {

client.on('stopped', function() {

client.on('speedChanged', function(speed) {
  // Fired when the user rewinds of fast-forwards the media from the remote
  console.log('speedChanged', speed);
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free