i was wondering if it is possible to capture video input from a client like the following /?r=91737737, and display it on another so that any viewer can see it, my issue is that i do not have a webcam on my second puter and i would like to receive the video using webrtc. is it possible to capture from one end and capture it on another? perhaps if this isnt possible are websockets the best way to do this?
i was wondering if it is possible to capture video input from a client like the following https://apprtc.appspot./?r=91737737, and display it on another so that any viewer can see it, my issue is that i do not have a webcam on my second puter and i would like to receive the video using webrtc. is it possible to capture from one end and capture it on another? perhaps if this isnt possible are websockets the best way to do this?
Share Improve this question asked Oct 11, 2012 at 8:35 DasBootDasBoot 7073 gold badges15 silver badges38 bronze badges 01 Answer
Reset to default 7 +50I see no reason it shouldn't be possible apart from being imperfect due to performance/bandwidth issues.
The most supported HTML5 solution at the moment I would imagine it be the use of getUserMedia which is available on Chrome (consider getUserMedia.js for broader support on camera input, although I haven't used it)
Scenario
We will have a capturer, a server that broadcasts the stream and the watchers that receive the final stream.
Plan
Capture phase
- Use getUserMedia to get data from the camera
- Draw it on a canvas (maybe you could skip this)
- Post the frame as in the format of image data using websockets (e.x. via socket.io for broader support) to the server (e.x. node.js).
Broadcast phase
- Receive the image data and just broadcast to the subscribed watchers
Watch phase
- The watcher will have a websocket connection with the server
- On every new frame received from the server it will have to draw the received frame to a canvas
Considerations
- You should take into account that performance of the network will affect the playback.
- You could enforce a FPS rate on the client side to avoid jiggly playback speed.
- A buffer pool would be nice if it fits your case for smoother playback.
Future
You could use PeerConnection API, MediaSource API when they bee available, since this is why they are made, although that will probably increase the CPU usage depending on the browsers' performance.