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

dlnacasts3

v1.0.0

Published

Query your local network for DLNA enabled renderers and have them play media

Downloads

52

Readme

dlnacasts3

Query your local network for DLNA media renderers and have them play media

Note: dlnacasts3 is a fork of rslavin abandonned dlnacasts2 (itself based on grunjol's dlnacasts). It has been updated for security reasons, including some hotfixes from contributors (see commit list). API (and code) based on mafintosh/chromecasts for DLNA.

Updating from 0.x.x to 1.x.x

Breaking changes:

  • const list = dlnacasts() will no longer trigger a list.update()
  • player.on('status', status) has changed, see below

Usage

npm install dlnacasts3

then in your JS files:

const dlnacasts = require('dlnacasts3')()

dlnacasts.on('update', function (player) {
  console.log('all players: ', dlnacasts.players)
  player.play('http://example.com/my-video.mp4', {title: 'my video', type: 'video/mp4'})
})

API

const list = dlnacasts()

Creates a dlna list.

list.update()

Updates the player list by querying the local network for DLNA renderer instances.

list.on('update', player)

Emitted when a new player is found on the local network

player.play(url, [opts], cb)

Make the player play a url. Options include:

{
  title: 'My movie',
  type: 'video/mp4',
  dlnaFeatures: 'DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01100000000000000000000000000000', // this enables seeking in some dlna devices like LG WebOS
  seek: seconds, // start by seeking to this offset
  subtitles: ['http://example.com/sub.vtt'], // subtitle track 1,
  autoSubtitles: true // enable first track if you provide subs
}

player.subtitles(track, [cb])

Enable subtitle track. Use player.subtitles(false) to disable subtitles

player.pause([cb])

Make the player pause playback

player.resume([cb])

Resume playback

player.stop([cb])

Stop the playback

player.seek(seconds, [cb])

Seek the video

player.status([cb])

Get a status of what's playing on the renderer. Similar to player.on('status', cb) event but manually triggered

player.getVolume([cb])

Get the volume of the renderer

player.setVolume(<volume>, [cb])

Set the volume on the renderer

player.on('status', status)

Emitted when a status object is received.

status Object()

{
  currentTime: 122, // time in seconds (122 = 00:02:02)
  playerState: "PAUSED_PLAYBACK", // player State: see below
  volume: {
    level: 0.1  // 0.1 corresponds to 10 on a scale of 100
  }
}

status.playerState could be one of :

[
  'PLAYING', // player is playing a video (player.pause() to pause)
  'STOPPED',  // player was quit by user
  'PAUSED_PLAYBACK', // player was paused (player.play() to continue)
  'NO_MEDIA_PRESENT', // usually after a 'STOPPED'
  'TRANSITIONNING' // DLNA renderer is loading something
]

License

MIT