내 웹캠을 녹화하고 라이브 스트림을 다른 클라이언트에 브로드 캐스트하려고합니다.라이브 웹캠 스트림 브로드 캐스트
내가 쉽게 그런 일에 같은 페이지에 비디오 태그에 웹캠을 표시 할 수 있습니다:
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가 가장 좋은 방법입니까? 나에게 추천 할만한 읽을 거리/라이브러리가 있습니까?
WebRTC 및 getUserMedia는 사용하기가 쉽기 때문에 요즘 플래시를 권장하는 이유를 알 수 없습니다. 데이터 서버 측을 얻는 것은 까다 롭지 만, 특히 플래시를 사용하는 경우에도 마찬가지입니다. 특히 추가 처리를 원한다면 더욱 그렇습니다. – Brad