#WebRTC Rails
This gem provides easy WebRTC communication in any Rails app, based on websocket synchronization (Faye)
Installation
-
Add to Gemfile and update the bundle
gem 'webrtc_rails', :github => 'shredder-rull/webrtc_rails'
Now run
bundle install
to download and install the gem. -
Add Faye server to the Rails middleware stack like so:
# application.rb config.middleware.use FayeRails::Middleware, mount: '/faye', :timeout => 25
-
Add to application.js
//= require webrtc_rails
-
Using:
client = new WebRTC.Client url: 'http://localhost:3000/faye' guid: '#{current_user.id}' roomUrl: 'your_room_path' iceServers: [{ "url": "stun:stun.palava.tv" }] client.bind 'local_stream', (stream)-> WebRTC.attachMediaStream $('#myVideo').get(0), stream client.bind 'partner.stream', (partner)-> WebRTC.attachMediaStream $('#partnerVideo').get(0), partner.stream