/video-server

Primary LanguageJavaScript

Video server

NodeJs server for streaming video from path

Install

npm install video-server

Usage

Video server exports express app

let app = require('video-server');
app.listen(app.get('PORT'));

All videos stored at internal directory by default (storage root)

Api

POST /upload

Is multipart request. Body must contain video parameter with file.

It also can contain category parameter. In storage root will be created subdirectory when category presented

Returns json object with id property. Id is a relative path to file from storage root

GET /view/:id

renders sample view with html5 video object

GET /stream/:id

send partial content video streaming

CLI

Install video server as global dependency

npm install -g video-server

Then run

video-server [-p] [-d]

-p, --port - port for web server

-d, --storage_dir - path for direcoty with video

-h, --help - help

Options

PORT

To change port run app.set('PORT', 80)

Default is 8000

STORAGE DIR

To change directory where videos are stored
app.set('STORAGE_DIR', '/path/to/your/directory/')