UNPKG

pistreamer

Version:

NodeJS module that allows streaming the raspberry pi camera module output over websocket to a webpage using a modified version of 131/h264-live-player.

66 lines 2.12 kB
import ws from 'ws'; import http from 'http'; import winston from 'winston'; import { StreamOptions } from './interfaces/StreamOptions'; export declare class PiStreamServer { /** * Static logger of PiStreamer. You can change the logger by giving * a winston.Logger object. * ```ts * PiStreamServer.log = winston.createLogger(...); * ``` */ static log: winston.Logger; private buffer; private streamer?; private readStream?; private streamClients; private wsServer; private options; private readonly defaultOptions; /** * PiStreamServer constructor. * @param wsServer - Instance of a websocket server. * @param options - Options of the stream. */ constructor(wsServer: ws.Server, options?: StreamOptions); /** * Set the options of the stream. * @param options */ setOptions(options: StreamOptions): void; /** * Stop the feed and kill the raspivid process. */ protected stopFeed: () => void; /** * Start the feed by creating one if there's none or by continuing the existant one. */ protected startFeed: () => void; /** * Create a new feed by starting a new raspivid process. */ protected createFeed: () => void; /** * Broadcast the feed to all the websocket client connected. * @param data - Video stream. */ protected broadcast: (data: any) => void; /** * Actions done when a new client is connected. * @param socket - Client socket. */ protected newClient: (socket: ws) => void; } /** * Creates an instance of PiStreamServer and returns the Http server linked to it. * @param requestListner - Request listener. * @param video - Options of the stream. */ export declare const createServer: (requestListener: http.RequestListener, video?: StreamOptions | undefined) => http.Server; /** * Copy the client file "http-live-player.js" to the given path. * @param path - Path of the target folder. */ export declare const createClient: (path?: string) => void; //# sourceMappingURL=PiStream.d.ts.map