0.0.4 • Published 4 years ago

file-streaming v0.0.4

Weekly downloads
140
License
ISC
Repository
github
Last release
4 years ago

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