JSPM

file-streaming

0.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q35329F
  • License ISC

Live Streaming based on files

Package Exports

  • file-streaming

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (file-streaming) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

A basic module to stream files in hls

Requires ffmpeg

process.env.FFMPEG || 'ffmpeg';

Examples

const fileStreaming = require('file-streaming');

const emission = new fileStreaming('/home/user/streaming');

// Looping video
function emit(input) {
    emission.emit(input)
    .then( e => {
        emit(e.input);
    })
    .catch(console.error);
}

emit('/home/user/videos/Test1.mp4');
const fileStreaming = require('file-streaming');

// dir, url, resolutionMask = 4, segmentTime = 5, listSize = 5
const emission = new fileStreaming('/home/user/streaming', 'http://192.168.1.120:3000', 6, 10, 4);

function emit(input) {
    emission.emit(input)
    .then( e => {
        console.log(`Finish: ${e.input}`);
    })
    .catch(console.error);
}

emit('/home/user/videos/Test1.mp4');

setTimeout( () => {
    emit('/home/user/videos/Test2.mp4');
}, 60000);

Resolution Mask 1: 360p 2: 480p 4: 720p 8: 1080p

Examples: 3: 480p and 360p 6: 720p and 480p