bigbluebutton Videoconferencing system API wrapper, which handles query building and implements common methods to manage meetings

  1. Requirements
  2. Installation
  3. Usage
  4. Resources

This extension helps you to integrate great open-source conferencing system BigBlueButton into your great Yii projects. It implements almost all features from current stable release, such as creating, joining, listing and ending meetings. You may also easily add support of new methods (such as slides and recordings) that appeared in latest beta (if i won't do it first :)

Requirements

  • Available BigBlueButton server (tested with 0.71a, should also work with newer, currently beta, versions). See installation instructions here. For testing you can also use public server provided by BigBlueButton developers available here.
  • Yii 1.1 (should also work with older versions).
  • libxml (php extension, installed almost everywhere) and "allow_url_fopen" setting must be on (enabled almost everywhere)

Installation

  1. You should have security salt from BigBlueButton server (that is already installed somewhere, i assume) to make API queries. You can find out how to get it here: http://code.google.com/p/bigbluebutton/wiki/API.

  2. Copy extension files to /protected/extensions/bigbluebutton.

  3. Set up your config file (/protected/config/main.php):

'components'=>array(
	'bigbluebutton'=>array(
			'class'=>'ext.bigbluebutton.BigBlueButton',
			
			//server and salt provided here are intended for BigBlueButton's testing server
			//do not use it in your real projects
			
			//security salt - required
			'salt'=>'8cd8ef52e8e101574e400365b55e11a6',
			//API host - required
			'url'=>'http://test-install.blindsidenetworks.com',
			//the rest parameters are optional
			//port is 80 by default 
			//'port'=>80, 
			//default path to API
			//'path'=>'/bigbluebutton/api/',

			//-you may set default passwords here or set
			// unique passwords for each conference
			//-or even use no passwords — BigBlueButton 
			// will assign them randomly in that case

			//common moderator password for any conference
			//'moderatorPW'=>'12345',
			//common attendee password for any conference
			//'attendeePW'=>'123',

			//common url to redirect users after leaving conference, 
			//which will be transmitted to Yii::app()->createAbsoluteUrl.
			//default is site root. you may set unique url for each conference.
			//'logoutUrl'=>'/',	         
	),

Usage

I assume you're already familiar (at least a bit) with BigBlueButton videoconference system and looked through documentation.

Now you have ready BigBlueButton server, you found security salt and server address and set it up in configuration. To access system API you may use extension's "low-level" methods: "createApiQuery" which builds url with given parameters and handles security issues, and "getApiResponse", which loads previously created url and returns response as php array. Using these methods you can run any type of API query described in docs. Try it in one of your controllers:

$bbb=Yii::app()->bigbluebutton;
try 
{
	$url=$bbb->createApiQuery("getMeetings");
	$data=$bbb->getApiResponse($url);
	CVarDumper::dump($data, 10, 1);
} catch (BigBlueButtonException $ex)
{
	//remember to properly handle exception if something goes wrong
	throw $ex;
}

...and the result will look (if you had any meetings running, of course) like this:

array
(
    'returncode' => 'SUCCESS'
    'meetings' => array
    (
        'meeting' => array
        (
            'meetingID' => '1335965308981'
            'attendeePW' => '123'
            'moderatorPW' => '12345'
            'hasBeenForciblyEnded' => false
            'running' => true
        )
    )
)

Fortunately you don't have to deal with these methods manually (though they'll be useful if you wish to extend class functionality). Extension provides a bunch of methods which will help you to list, create, join and end meetings. Let's look at examples:

$bbb=Yii::app()->bigbluebutton;
//set default passwords (you may also set them from configuration)
$bbb->attendeePW=123;
$bbb->moderatorPW=12345;

//create simple meeting with default parameters and generate join url for TestUser
$meeting=$bbb->createMeeting("test");
//see what response we've got from server
CVarDumper::dump($meeting, 10, 1);
echo "<br/>";

//join url is constructed with viewer privileges by default   
$joinUrl=$bbb->getJoinMeetingUrl($meeting['meetingID'], "TestUser");
//redirect user to conference immediately...
//$this->redirect($joinUrl);
//...or send him a link to join manually
echo CHtml::link("Join my cool conference!", $joinUrl)."<br/>";

//check if created meeting is running
//(actually it isn't, because we just created it, but
// there are no participants)
$isRunning=$bbb->meetingIsRunning($meeting['meetingID']);
echo "meeting state: ".(($isRunning)?"running":"not running")."<br/>";
				
//show all meetings
$meetings=$bbb->getMeetings();
CVarDumper::dump($meetings, 10, 1)."<br/>";
echo "<br/>";

//imagine you have authenticated user somewhere...
Yii::app()->user->id=456;

//get created meeting for another user 
//with moderator privileges to join and end conference
$meeting=$bbb->getMeetingForUser(
		$meetings[0]['meetingID'],
		"AnotherUser",
		//user id will be taken from Yii::app()->user->id
		null,	            
		BigBlueButton::ROLE_MODERATOR,
		//moderator password
		$meetings[0]['moderatorPW']);
CVarDumper::dump($meeting, 10, 1);
echo "<br/>";

//now before we could end meeting we need at least one member there
//to get it started, otherwise it won't be counted as 'running'.
//so use join url as shown above and open conference in another tab.
		
//if it's time to end meeting, you should do like this:
//$bbb->endMeeting($meeting['meetingID'], $meeting['moderatorPW']);
//or this, because we have meeting data with moderator privileges:
echo CHtml::link("End that boring conference", $meeting['endUrl'])."<br/>";
//but do not simply show that link to real user, use getApiResponse()
//or endMeeting() methods instead
		
//show all running conferences for specified user
$meetings=$bbb->getMeetingsForUser(
		//username which will be shown in BigBlueButton client
		"TestUser2", 
		//user id
		457,
		//request running meetings only (default is any meetings)
		BigBlueButton::MEETING_STATE_RUNNING,
		//generate meeting interaction urls with viewer privileges
		BigBlueButton::ROLE_VIEWER);
//array of meetings with urls for user to join or end meeting
CVarDumper::dump($meetings, 10, 1);
echo "<br/>";

//the list of ended meetings with full information about them
$meetings=$bbb->getFullMeetings(BigBlueButton::MEETING_STATE_COMPLETED);
CVarDumper::dump($meetings, 10, 1);
echo "<br/>";        
//...or the list of all meetings with less information, 
//but much faster on large number of meetings
$meetings=$bbb->getMeetings(BigBlueButton::MEETING_STATE_ANY);
CVarDumper::dump($meetings, 10, 1);
echo "<br/>";

//build a link to create another meeting with a bunch of options
$newMeetingUrl=$bbb->getCreateMeetingUrl(
	"My awesome show",
	array(
		//set meeting id if you don't want it to be created automatically.
		//may be you'll manage meetings with your own database
		//and you can supply it's id here
		"meetingID"=>356,
		//free access to any viewer, overwriting password from configuration
		"attendeePW"=>"",
		//some custom moderator password     
		"moderatorPW"=>"myhardestpasswordever",
		//another logout url...
		"logoutUrl"=>Yii::app()->createAbsoluteUrl(
				"conferences/logout"),
		//welcome chat message    
		"welcome"=>"Hello world!",
		//+any parameters as described in API docs..    
	) 
);
//you may store url somewhere and call later
//$meeting=$bbb->getApiResponse($newMeetingUrl);
//or call $bbb->createMeeting() with same parameters as above
//to create it immediately

//check server state
$isOnline=$bbb->serverIsAvailable();
//hope it's true
echo $bbb->url." server availability: ".(($isOnline)?"ok":"fail");
echo "<br/>";

//and don't forget to catch exceptions
$bbb->url="http://google.com";
try
{
	//will be false
	$isOnline=$bbb->serverIsAvailable();
	echo $bbb->url." server availability: ".(($isOnline)?"ok":"fail");
	echo "<br/>";
	//will throw an exception
	$meetings=$bbb->getMeetings();
}
catch (BigBlueButtonException $ex)
{
	echo $ex->getMessage();
}

Resources

Thanks to BigBlueButton developers, who provide a free public testing server, I have a live demo here: http://filmingtheclouds.net/bigbluebutton.

On that site you can see basic functions implemented and sample code illustrating them. You can also setup your own BigBlueButton server as virtual machine on any pc using instructions available on their site.

3 0
6 followers
498 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Web Service
Developed by: xapon
Created on: May 4, 2012
Last updated: 12 years ago

Downloads

show all

Related Extensions