Last active
January 19, 2017 19:44
-
-
Save RJ722/403c92a86d82c95ad0ff71f4ad0be997 to your computer and use it in GitHub Desktop.
Enables live streaming of webcam on a webserver which can furthur be harnessed for access over LAN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This would enable the user to stream webcam's output to a URL which could be accessed over a network | |
// Major code from: https://github.com/sepehr-laal/livecam | |
var ip = '127.0.0.1'; // Please Replace with your IP, otherwise you would not be able to serve it over on network! | |
const LiveCam = require('livecam'); | |
const webcam_server = new LiveCam | |
({ | |
// address and port of the webcam UI | |
'ui_addr' : ip, | |
'ui_port' : 11000, | |
// address and port of the webcam Socket.IO server | |
// this server broadcasts GStreamer's video frames | |
// for consumption in browser side. | |
'broadcast_addr' : ip, | |
'broadcast_port' : 12000, | |
// address and port of GStreamer's tcp sink | |
'gst_tcp_addr' : ip, | |
'gst_tcp_port' : 10000, | |
// callback function called when server starts | |
'start' : function() { | |
console.log('WebCam server started!'); | |
}, | |
// webcam object holds configuration of webcam frames | |
'webcam' : { | |
// should frames be converted to grayscale (default : false) | |
'grayscale' : false, | |
// should width of the frame be resized (default : 0) | |
// provide 0 to match webcam input | |
'width' : 0, | |
// should height of the frame be resized (default : 0) | |
// provide 0 to match webcam input | |
'height' : 0, | |
// should a fake source be used instead of an actual webcam | |
// suitable for debugging and development (default : false) | |
'fake' : false, | |
// framerate of the feed (default : 0) | |
// provide 0 to match webcam input | |
'framerate' : 0 | |
} | |
}); | |
// Start the broadcast | |
webcam_server.broadcast(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment