PHP API Examples for Big Blue Button

This page includes basic documentation, and links to sample pages that use the Big Blue Button API via a PHP bridge. You can read this page and also inspect the included files to see how it works. Original documentation for the base Big Blue Button API itself can be found at the following URL:

http://code.google.com/p/bigbluebutton/wiki/API

Table of Contents

Install and Configuration

Install
Stick the entire /bbb-api-php directory somewhere that you can host php web files. You need to enable the 'allow_url_fopen' to 'On' in your php.ini file so these examples can work. Simply add/replace to your php.ini file: allow_url_fopen = On.
Configuration
Define your Big Blue Button server URL and SALT in the configuration file located at /bbb-api-php/includes/config.php.
Usage and Customization
After defining your BBB server URL and SALT in the config file, read this page and click on the links to the examples for each method below. You can either modify the included files directly until they do what you need, or you can create your own custom app using the code in these examples to get started.
Web Framework Integration
You can integrate this code into a web framework like Zend Framework. Just stick the /includes/bbb-api.php file in Zend's library directory so it is included in your app. You can put then move the BBB server URL and SALT values into your app's config file and call those values from the bbb-api.php file. Last, add logic like you see in the examples below into your controllers and forms.

Big Blue Button PHP API Usage

Administration Methods

 
Create a Meeting

METHOD: createMeetingWithXmlResponseArray($creationParams)

To create a meeting, require the bbb-api.php file, then instatiate the BigBlueButton class in your code.

require_once('../includes/bbb-api.php'); //Make this match your actual path the bbb-api.php file.
$bbb = new BigBlueButton();

Set your meeting values in the creationParams array. (You'll probably grab these from a user-submitted form in real life.) Note that meetingId and meetingName are required. The rest are optional. In the example below, we set attendeePw to be "pw" and moderatorPw to be "mp". This facilititates accessing information about this meeting later by passing matching values. In real code, you'd use PHP to generate random values for those passwords and then store them in your code to access later.

$creationParams = array(
	'meetingId' => '1234',			// REQUIRED
	'meetingName' => 'Test Meeting Name',	// REQUIRED
	'attendeePw' => 'ap',		// Match this value in getJoinMeetingURL() to join as attendee.
	'moderatorPw' => 'mp',		// Match this value in getJoinMeetingURL() to join as moderator.
	'welcomeMsg' => '',		// ''= use default. Change to customize.
	'dialNumber' => '',		// The main number to call into. Optional.
	'voiceBridge' => '12345',	// 5 digit PIN to join voice bridge.  Required.
	'webVoice' => '',		// Alphanumeric to join voice. Optional.
	'logoutUrl' => '',		// Default in bigbluebutton.properties. Optional.
	'maxParticipants' => '-1',	// Optional. -1 = unlimitted. Not supported in BBB. [number]
	'record' => 'false',		// New. 'true' will tell BBB to record the meeting.
	'duration' => '0',		// Default = 0 which means no set duration in minutes. [number]
	//'meta_category' => '',	// Use to pass additional info to BBB server. See API docs.
);

Finally, create the meeting by calling the createMeetingWithXmlResponse method and passing it your desired parameters that you set up in the creationParams array. $result will be an array that contains the XML response from your Big Blue Button server.

$result = $bbb->createMeetingWithXmlResponseArray($creationParams);

That's it. As you can see in the examples, you can add additional code to handle errors and exceptions or do other things as needed. The rest of the methods work basically the same way. You can view the source in the examples or in the bbb-api.php file to see which parameters to pass to the methods.

Try it out: Create a meeting with a meetingId of '1234' and a meetingName of 'Test Meeting Name' now.

Learn more: Read the source code in examples/createMeeting.php.

 
Join a Meeting

METHOD: getJoinMeetingURL($joinParams)

Note that this method does not return an XML response from the BBB server. Instead it returns the URL that people can use to join a meeting. You can send this URL to people in an email, or write your code to automatically redirect them there depending on your needs.

Note that when testing, you must create the '1234' meeting using the createMeetingWithXmlResponseArray method above before you can successfully join it.

Try it out:
Get the URL to join a meeting with a meetingId of '1234' as a Moderator now.
Get the URL to join a meeting with a meetingId of '1234' as an Attendee now.

Learn more: Read the source code in examples/getJoinMeetingUrlModerator.php and
examples/getJoinMeetingUrlModerator.php.

Bonus: Join only once running a meeting with a meetingId of '1234' as an Attendee now. This page shows one way to keep the user on a spinner page until the meeting is started by the moderator. You can inspect the code in /bbb-api-php/examples/joinIfRunning.php to learn more about this.

 
End a Meeting

METHOD: endMeetingWithXmlResponseArray($endParams)

Note that when testing, you must create and start (join as moderator) the '1234' meeting using the methods listed above before you can successfully end it.

Try it out: End a meeting with a meetingId of '1234' now.

Learn more: Read the source code in /bbb-api-php/examples/endMeeting.php.

Monitoring Methods

 
Is Meeting Running

METHOD: isMeetingRunningWithXmlResponseArray($meetingId)

This method will return whether the meeting is currently running or not.

Try it out: Determine if meeting is running for a meeting with a meetingId of '1234' now.

Learn more: Read the source code in examples/isMeetingRunning.php.

 
Get Meetings

METHOD: getMeetingsWithXmlResponseArray()

This method will retrieve a list of current meetings on the BBB server.

Try it out: Get all meetings now.

Learn more: Read the source code in examples/getMeetings.php.

 
Get Meeting Info

METHOD: getMeetingInfoWithXmlResponseArray($infoParams)

This method will return information about a meeting.

Try it out: Get meeting info for a meeting with a meetingId of '1234' now.

Learn more: Read the source code in examples/getMeetingInfo.php.

Recording Methods

Convenience pages for recording: Create a meeting with 'record' set to 'true' now. This will create a 5 minute long meeting that will be recorded once you join into it as moderator and let it run. (The meeting will stop after 5 minutes.). The meetingId for this recorded meeting will be '12345'. Once recorded, you can use the methods below to test your results. To get success with publish and delete methods, you'll need to get back a valid recordID using the getRecordingsWithXmlResponseArray() method first, and then add the recordID to the example pages for publishing and deleting recordings.

 
Get Recordings

METHOD: getRecordingsWithXmlResponseArray($recordingParams)

This method will return information for specific recordings if you pass it one or more comma separated meetingIds. By default, with no meetingIds, it will list all recordings.

Try it out: Get all recordings now.

Learn more: Read the source code in examples/getRecordings.php.

 
Publish Recordings

METHOD: publishRecordingsWithXmlResponseArray($recordingParams)

This method publishes/unpublishes recordings.

Try it out: Publish recordings now. (Note that you must get a valid recordID from getRecordingsWithXmlResponseArray() and enter it as the $recordingParams['recordId'] value in examples/publishRecordings.php in order to get success here. The default recordID that ships in that page won't work on your server.)

Learn more: Read the source code in examples/publishRecordings.php.

 
Delete Recordings

METHOD: deleteRecordingsWithXmlResponseArray($recordingParams)

This method deletes recordings.

Try it out: Delete recordings now. (Note that you must get a valid recordID from getRecordingsWithXmlResponseArray() and enter it as the $recordingParams['recordId'] value in examples/deleteRecordings.php in order to get success here. The default recordID that ships in that page won't work on your server.)

Learn more: Read the source code in examples/deleteRecordings.php.