Skip to content
This repository

BigBlueButton integration for Ruby on Rails

branch: master
README.rdoc

BigBlueButton on Rails

Build Status

BigBlueButton integration for Ruby on Rails 3.

Features:

  • Allows multiple servers and multiple conference rooms.

  • Full API access using bigbluebutton-api-ruby.

  • Easy way to join conferences: simply create a room and call the “join” action.

  • Easy integration with authentication and authorization mechanisms, such as Devise and CanCan.

  • Support for recordings: meetings can be recorded, the list of recordings retrieved and recordings can be played.

  • Possibility to create private rooms, that require a password to join.

  • Deals with visitors (users that are not logged), allowing (or forbidding) them to join rooms.

  • Random meeting IDs to avoid problems with “end”, timeouts and reuse of URLs.

  • Server activity monitor.

  • “On-the-fly” server selection when a meeting is started.

Possible future features:

  • Limit the number of users per room and rooms per server.

  • Server administration (modify config.xml, use bbb-conf, etc.).

  • Pre-upload of slides.

Supported versions

BigBlueButton

The current version of this gem supports all the following versions of BigBlueButton:

  • 0.8: Altough not all features are supported yet, such as pre-upload of slides. See TODO_08.

  • 0.7: Including 0.7, 0.71 and 0.71a.

Ruby

Tested in rubies:

  • ruby-1.9.2 (p290)

  • ruby-1.9.3 (p194)

Use these versions to be sure it will work. Other varieties of 1.9.2 and 1.9.3 should work as well.

Rails

To be used with Rails 3 only. Tested against Rails 3.2 (should work on 3.0, 3.1 and 3.2).

Installation

You can install the latest version of BigbluebuttonRails using RubyGems:

gem install bigbluebutton_rails

Or simply add the following line in your Gemfile:

gem "bigbluebutton_rails"

After installing, you need to run the generator:

rails generate bigbluebutton_rails:install

This generator will create the files needed to setup the gem in your application. You should take some time to open all the files generated and analyze them.

By default the gem will use the views it provides, but it is strongly recommended that you adapt them for your needs! The views provided are just an example of how they can be implemented in your application and they depend on jQuery (use the gem jquery-rails) and on a css file provided by this gem. You can easily generate the views and the css file in your application to later customize them with:

rails generate bigbluebutton_rails:views

To now more about the generators see How to: Generators

Routes

The routes to BigbluebuttonRails can be generated with the helper bigbluebutton_routes. See the example below:

bigbluebutton_routes :default

It will generate the default routes. You need to call it at least once and the routes will be scoped with 'bigbluebutton'. They will look like:

/bigbluebutton/servers
/bigbluebutton/servers/my-server/new
/bigbluebutton/servers/my-server/rooms
/bigbluebutton/rooms
/bigbluebutton/rooms/my-room/join

You can also make the routes use custom controllers:

bigbluebutton_routes :default, :controllers => {
  :servers => 'custom_servers',
  :rooms => 'custom_rooms',
  :recordings => 'custom_recordings'
}

To generate routes for a single controller:

bigbluebutton_routes :default, :only => 'servers'

You may also want shorter routes to access conference rooms. For that, use the option room_matchers:

resources :users do
  bigbluebutton_routes :room_matchers
end

It creates routes to the actions used to access a conference room, so you can allow access to webconference rooms using URLs such as:

http://myserver.com/my-community/room-name/join
http://myserver.com/user-name/room-name/join

For more information see:

Basic configurations

There are some basic assumptions made by BigbluebuttonRails:

  • You have a method called current_user that returns the current user;

  • The current_user has an attribute or method called “name” that returns his/her fullname and an attribute or method “id” that returns the ID.

If you don't, you can change this behaviour easily, keep reading.

BigbluebuttonRails uses the methods bigbluebutton_user and bigbluebutton_role(room) to get the current user and to get the permission that the current user has in the room, respectively. These methods are defined in lib/bigbluebutton_rails/controller_methods.rb and you can reimplement them in your application controller to change their behaviour as shown below.

class ApplicationController < ActionController::Base

  # overriding bigbluebutton_rails function
  def bigbluebutton_user
    current_user && current_user.is_a?(User) ? current_user : nil
  end

  def bigbluebutton_role(room)
    ...
  end

end

Updating the recordings

Since this task can consume quite some time if your server has a lot of recordings, it is recommended to run it periodically in the background. To do that, you can use the gem whenever (that uses cron underneath).

This gem provides a rake task to fetch the recordings from the webconference servers and update the application database. This task can be triggered from whenever/cron to update the entire recordings database.

The command below will fetch recordings for all servers and update the database with all recordings found:

rake bigbluebutton_rails:recordings:update

To set up whenever, first add it to your application Gemfile:

gem 'whenever', :require => false

When you ran the generator :install previously, it created a file at config/schedule.rb inside your application. This file is used to configure whenever. Once this file is in place, running the following command will update your cron tab to update the recordings periodically.

whenever --update-crontab

Check whenever page to learn more about it.

For more information see:

Example application

If you need more help to set up the gem or just want to see an example of it working, check out the test application at spec/rails_app/!

See also

Contributing/Development

Fork this repository, clone your fork and start by installing the dependencies:

bundle install

Note: if you're getting an error installing capybara-webkit, most likely you need to install QT, see: github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit

Save spec/rails_app/features/config.yml.example as spec/rails_app/features/config.yml and edit it to set values for an existent BigBlueButton server. You will need it to run the integration tests. For more information see the page Testing in our wiki.

Prepare the rails_app used for tests:

rake rails_app:install
rake rails_app:db SERVER=my-server # select a server you defined in 'config.yml'
rake rails_app:populate            # to create fake data, optional

Run the tests:

rake spec
rake cucumber SERVER=my-server

Or simply:

rake SERVER=my-server

If you're adding migrations to the gem, test them with:

rake spec:migrations

Note: If you don't set the SERVER variable, the first server in config.yml will be used.

You can also start the test application and navigate to localhost:3000 to check it:

cd spec/rails_app/
rails server

Develop. :)

If you want your code to be integrated in this repository, please fork it, create a branch with your modifications and submit a pull request.

Spork

Spork allows you to run tests faster. Run this in a terminal to start spork:

bundle exec spork

Then run the tests with:

bundle exec rspec -X spec/

Test Coverage

Coverage is analyzed by default when you run:

rake spec

Run it and look at the file coverage/index.html.

Best Practices

We use the gem rails_best_practices to get some nice tips on how to improve the code.

Run:

rake best_practices

And look at the file rails_best_practices_output.html to see the tips.

License

Distributed under The MIT License (MIT). See LICENSE.

Contact

This project is developed as part of Mconf (mconf.org). Contact:

  • Mconf: A scalable opensource multiconference system for web and mobile devices

  • PRAV Labs - UFRGS - Porto Alegre - Brazil

  • www.inf.ufrgs.br/prav/gtmconf

Something went wrong with that request. Please try again.