最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - webrtc streaming video on one side and receiving on another? html5 - Stack Overflow

programmeradmin4浏览0评论

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 0
Add a ment  | 

1 Answer 1

Reset to default 7 +50

I 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

  1. Use getUserMedia to get data from the camera
  2. Draw it on a canvas (maybe you could skip this)
  3. 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

  1. Receive the image data and just broadcast to the subscribed watchers

Watch phase

  1. The watcher will have a websocket connection with the server
  2. On every new frame received from the server it will have to draw the received frame to a canvas

Considerations

  1. You should take into account that performance of the network will affect the playback.
  2. You could enforce a FPS rate on the client side to avoid jiggly playback speed.
  3. 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.

发布评论

评论列表(0)

  1. 暂无评论