Skip to content

Instantly share code, notes, and snippets.

View sushantdhiman's full-sized avatar

Sushant sushantdhiman

View GitHub Profile
@sushantdhiman
sushantdhiman / html5-video-streamer.js
Created November 22, 2015 10:22 — forked from paolorossi/html5-video-streamer.js
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@sushantdhiman
sushantdhiman / livestream.js
Last active December 4, 2018 11:10 — forked from deandob/livestream
Node.JS function to remux mp4/h.264 video from an IP camera to a HTML5 video tag using FFMPEG
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream,
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var reqUrl = url.parse(req.url, true)
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined;
if (cameraName) {
try {
cameraName = decodeURIComponent(cameraName);
@sushantdhiman
sushantdhiman / Aria-Addon.js
Created June 4, 2015 07:42
Bootstrap.UI Date Picker Angular Addon
/*
Just Add this addon on parent or same level of datepicker-ui.
current-date will automatically be updated with date selected by keyboard
*/
/** Enhance the ui.datepicker to able to read the selected date from ui.datepicker **/
angular.module('directives.',['ui.bootstrap.datepicker'])
.directive('ariaAddon',['$timeout',function($timeout){
return {