【发布时间】:2014-11-24 19:21:20
【问题描述】:
我想录制我的网络摄像头并向其他客户直播。
我可以很容易地在同一页面的视频标签中显示我的网络摄像头:
function initialize() {
video = $("#v")[0];
width = video.width;
height = video.height;
var canvas = $("#c")[0];
context = canvas.getContext("2d");
nav.getUserMedia({video: true}, startStream, function () {});
}
function startStream(stream) {
video.src = URL.createObjectURL(stream);
video.play();
requestAnimationFrame(draw);
}
function draw() {
var frame = readFrame();
if (frame) {
replaceGreen(frame.data);
context.putImageData(frame, 0, 0);
}
requestAnimationFrame(draw);
}
function readFrame() {
try {
context.drawImage(video, 0, 0, width, height);
} catch (e) {
return null;
}
return context.getImageData(0, 0, width, height);
}
但是如何将该流发送到服务器,进行一些图像处理,然后广播到其他客户端?
nodejs 是最好的方法吗?你有一些读物/库可以推荐给我吗?
【问题讨论】:
标签: html node.js video broadcast getusermedia