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

sharelib-streamer

v0.0.2

Published

Fork of Andrew Weeks's VidStreamer.js used for streaming Video & Audio.

Downloads

8

Readme

Sharelib-streamer

This is a fork of VidStreamer used to streams Video and Audio files. Config files has been externalized to be merge in a common dir with Sharelib config

VidStreamer.js

VidStreamer.js: A simple streamer for Flash and other videos (and other files too). Supports HTTP pseudostreaming and works with JW Player's bitrate switching.

To make a standalone video streamer, try something like this

var http = require("http");
var vidStreamer = require("vid-streamer");

var app = http.createServer(vidStreamer);
app.listen(3000);
console.log("VidStreamer.js up and running on port 3000");

And here's an example of including it in an Express app

var app = require("express").createServer();
var vidStreamer = require("vid-streamer");

app.get("/videos/", vidStreamer);

app.listen(3000);

If you want to pass in the settings instead via your app, try this (thanks to Will Laurance). Settings given will be merged with the defaults (see below), so you don't need to supply them all.

var http = require("http");
var vidStreamer = require("vid-streamer");

var newSettings = {
	rootPath: "download-clips/",
	forceDownload: true
}

var app = http.createServer(vidStreamer.settings(newSettings));
app.listen(3000);

Installation

You should be able to get it via npm install vid-streamer, or otherwise through Git of course.

Settings

There are a few things to twiddle in /config/vidStreamer.json. (Please rename vidStreamer-sample.json.)

  • mode - Not actually used right now. :)
  • forceDownload - Tell the browser to show a save file dialog.
  • random - Show a random file instead of the one named (see below).
  • rootFolder - The root folder from which files are returned. Accessing subfolders is possible by putting them in the path.
  • rootPath - The path assumed to match up with the root folder.
  • server - Server string returned in the header.
  • throttle - Allows you to throttle (limit) server bandwidth (bytes/second), cool for dev where

Standalone example

{
	"mode": "development",
	"forceDownload": false,
	"random": false,
	"rootFolder": "/path/to/videos/",
	"rootPath": "videos/",
	"server": "VidStreamer.js/0.1.4"
}

Example for Express. (Note that rootPath should be relative to the root URL of your Express app.)

{
	"mode": "development",
	"forceDownload": false,
	"random": false,
	"rootFolder": "/path/to/express/public/",
	"rootPath": "",
	"server": "VidStreamer.js/0.1.4"
}

Serving random files

You can use VidStreamer to serve up random files instead of the actual file requested. This can be useful if you're demoing an app that's supposed to have hundreds of videos but you don't want to go to the trouble of making them all.

  • Which file to return is calculated from the requested file name, so the same one will be returned each time for the same name. This is useful if you want to switch between video bitrates for example.
  • The file returned will be of the same type (same extension) as the requested file.
  • The file returned will be from the same folder as the requested file.

Thanks

I hadn't really thought about how to write video streamer before, so Devendra Tewari's post and the xmoovStream Server source were very useful to me.

Legal fun

Copyright © 2012 Andrew Weeks http://meloncholy.com

VidStreamer.js is licensed under the MIT licence.

Me

I have a website and a Twitter thingy. Please come and say hi if you'd like; be lovely to hear from you.