Gems used:
gem ‘raydash’, ‘2.1.0’
gem ‘jquery-rails’
step 1 :
First generate a new rails project by typing rails new Demo_apps.
step 2:
Inside Your gem file add the raydash gem. You can check the version from rubygems.org.
Step 3:
Go to http://www.raydash.com/ and generate Your user_id, and secret.
Step 4:
Configure Demo_apps with your user_id and secret with the command:
rails g raydash:install [userid] [secret]
or you can directly go to config/initilizer and create a raydash.rb file
and add your credentials there.
Step 5:
Create an suitable controller and add this
@token = Raydash.getToken()
Step 6:
for the view page write this
Where, @token specifies the token we are connecting to, and “stream” are div id.
If You want to add video record just add one more line in the view file
where @token is the token generated for you and “record” is the div size and you can
specify its height width also.
Step 7:
You can customize and add javascript to change video quality and div size.
Step 8:
To start video streaming make the create a next link to the view page.
For the same add a controller action like this.
def next() Raydash.changeStreamRand(session_token, :active =>true,:twoWay=>true, :custom_Group=>'Your_group') render :json => {:ok => true } end
If u want a group chat like video chat and want to switch between different users use this function
Raydash.changeStreamNext() instead of Raydash.changeStreamRand ()
Step 9:
In Application.html.erb in the header write this code
Step 10:
Make sure You have flash 11 or higher vershon installed. And your browser
must be compatible of doing video chat. And rails version must be greater than 3.
References : https://github.com/gersh/Raydash-Ruby-on-Rails/blob/master/Readme