2013-02-15 03:58:51 +08:00
|
|
|
/**
|
|
|
|
This file contains the BigBlueButton client APIs that will allow 3rd-party applications
|
|
|
|
to embed the Flash client and interact with it through Javascript.
|
|
|
|
|
2013-02-15 05:26:08 +08:00
|
|
|
HOW TO USE:
|
|
|
|
Some APIs allow synchronous and asynchronous calls. When using asynchronous, the 3rd-party
|
|
|
|
JS should register as listener for events listed at the bottom of this file. For synchronous,
|
|
|
|
3rd-party JS should pass in a callback function when calling the API.
|
|
|
|
|
|
|
|
For an example on how to use these APIs, see:
|
|
|
|
|
|
|
|
https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/resources/prod/lib/3rd-party.js
|
|
|
|
https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/resources/prod/3rd-party.html
|
2013-02-15 03:58:51 +08:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2012-10-04 03:55:36 +08:00
|
|
|
(function(window, undefined) {
|
|
|
|
|
|
|
|
var BBB = {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal function to get the BBB embed object. Seems like we have to do this
|
|
|
|
* each time and can't create a var for it.
|
|
|
|
*
|
|
|
|
* To get the object, see https://code.google.com/p/swfobject/wiki/api
|
|
|
|
*/
|
|
|
|
function getSwfObj() {
|
|
|
|
return swfobject.getObjectById("BigBlueButton");
|
|
|
|
}
|
|
|
|
|
2013-01-15 03:02:05 +08:00
|
|
|
/**
|
2013-02-15 05:26:08 +08:00
|
|
|
* Query if the current user is sharing webcam.
|
|
|
|
*
|
|
|
|
* Param:
|
|
|
|
* callback - function to return the result
|
|
|
|
*
|
|
|
|
* If you want to instead receive an event with the result, register a listener
|
|
|
|
* for AM_I_SHARING_CAM_RESP (see below).
|
|
|
|
*
|
2013-01-15 03:02:05 +08:00
|
|
|
*/
|
|
|
|
BBB.amISharingWebcam = function(callback) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
if (arguments.length == 0) {
|
|
|
|
swfObj.amISharingCameraRequestAsync();
|
|
|
|
} else {
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback(swfObj.amISharingCameraRequestSync());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-02-15 05:26:08 +08:00
|
|
|
* Query if another user is sharing her camera.
|
|
|
|
*
|
|
|
|
* Param:
|
|
|
|
* userID : the id of the user that may be sharing the camera
|
|
|
|
* callback: function if you want to be informed synchronously. Don't pass a function
|
|
|
|
* if you want to be informed through an event. You have to register for
|
|
|
|
* IS_USER_PUBLISHING_CAM_RESP (see below).
|
2013-01-15 03:02:05 +08:00
|
|
|
*/
|
|
|
|
BBB.isUserSharingWebcam = function(userID, callback) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
if (arguments.length == 1) {
|
|
|
|
swfObj.isUserPublishingCamRequestAsync(userID);
|
|
|
|
} else {
|
|
|
|
if (arguments.length == 2 && typeof callback === 'function') {
|
|
|
|
callback(swfObj.isUserPublishingCamRequestSync(userID));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-06-01 04:55:12 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Raise user's hand.
|
|
|
|
*
|
|
|
|
* Param:
|
|
|
|
* raiseHand - [true/false]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BBB.raiseHand = function(raiseHand) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
console.log("Request to raise hand [" + raiseHand + "]");
|
|
|
|
swfObj.raiseHandRequest(raiseHand);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-15 05:26:08 +08:00
|
|
|
/**
|
|
|
|
* Issue a switch presenter command.
|
|
|
|
*
|
|
|
|
* Param:
|
|
|
|
* newPresenterUserID - the user id of the new presenter
|
|
|
|
*
|
|
|
|
* 3rd-party JS must listen for SWITCHED_PRESENTER (see below) to get notified
|
|
|
|
* of switch presenter events.
|
|
|
|
*
|
|
|
|
*/
|
2012-12-13 03:33:33 +08:00
|
|
|
BBB.switchPresenter = function(newPresenterUserID) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
console.log("Request to switch presenter to [" + newPresenterUserID + "]");
|
|
|
|
swfObj.switchPresenterRequest(newPresenterUserID);
|
|
|
|
}
|
|
|
|
}
|
2012-12-14 23:31:21 +08:00
|
|
|
|
|
|
|
/**
|
2013-02-15 05:26:08 +08:00
|
|
|
* Query if current user is presenter.
|
|
|
|
*
|
2012-12-14 23:31:21 +08:00
|
|
|
* Params:
|
|
|
|
* callback - function if you want a callback as response. Otherwise, you need to listen
|
2013-02-15 05:26:08 +08:00
|
|
|
* for AM_I_PRESENTER_RESP (see below).
|
2012-12-14 23:31:21 +08:00
|
|
|
*/
|
|
|
|
BBB.amIPresenter = function(callback) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
if (arguments.length == 0) {
|
|
|
|
swfObj.amIPresenterRequestAsync();
|
|
|
|
} else {
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback(swfObj.amIPresenterRequestSync());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-02-15 05:26:08 +08:00
|
|
|
|
2013-04-12 04:56:02 +08:00
|
|
|
/**
|
|
|
|
* Eject a user.
|
|
|
|
*
|
|
|
|
* Params:
|
|
|
|
* userID - userID of the user you want to eject.
|
|
|
|
*/
|
|
|
|
BBB.ejectUser = function(userID) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.ejectUserRequest(userID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-15 05:26:08 +08:00
|
|
|
/**
|
|
|
|
* Query who is presenter.
|
|
|
|
*
|
|
|
|
* Params:
|
|
|
|
* callback - function that gets executed for the response.
|
|
|
|
*/
|
2013-02-14 01:05:59 +08:00
|
|
|
BBB.getPresenterUserID = function(callback) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback(swfObj.getPresenterUserID());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-12-14 23:31:21 +08:00
|
|
|
|
2012-10-05 05:24:10 +08:00
|
|
|
/**
|
2013-02-15 05:26:08 +08:00
|
|
|
* Query the current user's role.
|
2012-10-05 05:24:10 +08:00
|
|
|
* Params:
|
|
|
|
* callback - function if you want a callback as response. Otherwise, you need to listen
|
2013-02-15 05:26:08 +08:00
|
|
|
* for GET_MY_ROLE_RESP (see below).
|
2012-10-05 05:24:10 +08:00
|
|
|
*/
|
|
|
|
BBB.getMyRole = function(callback) {
|
2012-10-05 03:46:23 +08:00
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
2012-10-05 05:24:10 +08:00
|
|
|
if (arguments.length == 0) {
|
|
|
|
swfObj.getMyRoleRequestAsync();
|
|
|
|
} else {
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback(swfObj.getMyRoleRequestSync());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-10-05 03:46:23 +08:00
|
|
|
}
|
2012-10-05 05:24:10 +08:00
|
|
|
|
2012-11-21 03:30:08 +08:00
|
|
|
/**
|
2013-02-15 05:26:08 +08:00
|
|
|
* Query the current user's id.
|
|
|
|
*
|
|
|
|
* Params:
|
|
|
|
* callback - function that gets executed for the response.
|
|
|
|
*/
|
2012-11-21 03:58:47 +08:00
|
|
|
BBB.getMyUserID = function(callback) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
console.log("Getting my userID");
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback(swfObj.getMyUserID());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-12 00:58:15 +08:00
|
|
|
|
2013-02-15 05:26:08 +08:00
|
|
|
/**
|
|
|
|
* Query the current user's role.
|
|
|
|
* Params:
|
|
|
|
* callback - function if you want a callback as response. Otherwise, you need to listen
|
|
|
|
* for GET_MY_ROLE_RESP (see below).
|
|
|
|
*/
|
2013-01-12 00:58:15 +08:00
|
|
|
BBB.getMyUserInfo = function(callback) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
if (arguments.length == 0) {
|
|
|
|
swfObj.getMyUserInfoAsync();
|
|
|
|
} else {
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback(swfObj.getMyUserInfoSync());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-21 03:58:47 +08:00
|
|
|
/**
|
2013-02-15 05:26:08 +08:00
|
|
|
* Query the meeting id.
|
|
|
|
*
|
|
|
|
* Params:
|
|
|
|
* callback - function that gets executed for the response.
|
|
|
|
*/
|
2012-11-21 03:30:08 +08:00
|
|
|
BBB.getMeetingID = function(callback) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
console.log("Getting external meetingID");
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback(swfObj.getExternalMeetingID());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-05-09 07:17:06 +08:00
|
|
|
|
|
|
|
BBB.getInternalMeetingID = function(callback) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
console.log("Getting internal meetingID");
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback(swfObj.getInternalMeetingID());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-11-21 03:30:08 +08:00
|
|
|
|
2012-10-05 05:24:10 +08:00
|
|
|
/**
|
|
|
|
* Join the voice conference.
|
|
|
|
*/
|
2012-10-04 03:55:36 +08:00
|
|
|
BBB.joinVoiceConference = function() {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
console.log("Joining voice");
|
2012-10-05 03:46:23 +08:00
|
|
|
swfObj.joinVoiceRequest();
|
2012-10-04 03:55:36 +08:00
|
|
|
}
|
|
|
|
}
|
2012-10-05 05:24:10 +08:00
|
|
|
|
2013-02-15 05:26:08 +08:00
|
|
|
/**
|
|
|
|
* Leave the voice conference.
|
|
|
|
*/
|
2012-12-13 03:33:33 +08:00
|
|
|
BBB.leaveVoiceConference = function() {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
console.log("Leave voice");
|
|
|
|
swfObj.leaveVoiceRequest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 05:24:10 +08:00
|
|
|
/**
|
|
|
|
* Share user's webcam.
|
2013-02-15 05:26:08 +08:00
|
|
|
*
|
|
|
|
* Params:
|
|
|
|
* publishInClient : (DO NOT USE - Unimplemented)
|
2012-10-05 05:24:10 +08:00
|
|
|
*/
|
2012-12-04 05:23:29 +08:00
|
|
|
BBB.shareVideoCamera = function(publishInClient) {
|
2012-10-04 03:55:36 +08:00
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
2012-12-04 05:23:29 +08:00
|
|
|
if (typeof publishInClient === 'boolean') {
|
|
|
|
swfObj.shareVideoCamera(publishInClient);
|
|
|
|
} else {
|
|
|
|
swfObj.shareVideoCamera();
|
|
|
|
}
|
2012-10-04 03:55:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-15 05:26:08 +08:00
|
|
|
/**
|
|
|
|
* Stop share user's webcam.
|
|
|
|
*
|
|
|
|
*/
|
2012-12-13 03:33:33 +08:00
|
|
|
BBB.stopSharingCamera = function() {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.stopShareCameraRequest();
|
|
|
|
}
|
|
|
|
}
|
2013-02-15 05:26:08 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mute the current user.
|
|
|
|
*
|
|
|
|
*/
|
2012-10-06 04:54:45 +08:00
|
|
|
BBB.muteMe = function() {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.muteMeRequest();
|
|
|
|
}
|
|
|
|
}
|
2013-02-15 05:26:08 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unmute the current user.
|
|
|
|
*
|
|
|
|
*/
|
2012-10-06 04:54:45 +08:00
|
|
|
BBB.unmuteMe = function() {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.unmuteMeRequest();
|
|
|
|
}
|
|
|
|
}
|
2013-02-15 05:26:08 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mute all the users.
|
|
|
|
*
|
|
|
|
*/
|
2012-10-06 05:07:22 +08:00
|
|
|
BBB.muteAll = function() {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.muteAllUsersRequest();
|
|
|
|
}
|
|
|
|
}
|
2013-02-15 05:26:08 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unmute all the users.
|
|
|
|
*
|
|
|
|
*/
|
2012-10-06 05:07:22 +08:00
|
|
|
BBB.unmuteAll = function() {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.unmuteAllUsersRequest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-15 05:26:08 +08:00
|
|
|
/**
|
|
|
|
* Switch to a new layout.
|
|
|
|
*
|
|
|
|
* Param:
|
|
|
|
* newLayout : name of the layout as defined in layout.xml (found in /var/www/bigbluebutton/client/conf/layout.xml)
|
|
|
|
*
|
|
|
|
*/
|
2012-10-18 22:17:12 +08:00
|
|
|
BBB.switchLayout = function(newLayout) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.switchLayout(newLayout);
|
|
|
|
}
|
|
|
|
}
|
2013-02-15 05:26:08 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Lock the layout.
|
|
|
|
*
|
|
|
|
* Locking the layout means that users will have the same layout with the moderator that issued the lock command.
|
|
|
|
* Other users won't be able to move or resize the different windows.
|
|
|
|
*/
|
2012-11-02 03:37:34 +08:00
|
|
|
BBB.lockLayout = function(lock) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.lockLayout(lock);
|
|
|
|
}
|
|
|
|
}
|
2012-10-19 04:17:51 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request to send a public chat
|
|
|
|
* fromUserID - the external user id for the sender
|
|
|
|
* fontColor - the color of the font to display the message
|
|
|
|
* localeLang - the 2-char locale code (e.g. en) for the sender
|
|
|
|
* message - the message to send
|
|
|
|
*/
|
2012-10-25 03:07:33 +08:00
|
|
|
BBB.sendPublicChatMessage = function(fontColor, localeLang, message) {
|
2012-10-19 04:17:51 +08:00
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
2012-10-25 03:07:33 +08:00
|
|
|
swfObj.sendPublicChatRequest(fontColor, localeLang, message);
|
2012-10-19 04:17:51 +08:00
|
|
|
}
|
|
|
|
}
|
2012-10-18 22:17:12 +08:00
|
|
|
|
2012-10-19 04:17:51 +08:00
|
|
|
/**
|
|
|
|
* Request to send a private chat
|
|
|
|
* fromUserID - the external user id for the sender
|
|
|
|
* fontColor - the color of the font to display the message
|
|
|
|
* localeLang - the 2-char locale code (e.g. en) for the sender
|
|
|
|
* message - the message to send
|
|
|
|
* toUserID - the external user id of the receiver
|
|
|
|
*/
|
2012-10-25 03:07:33 +08:00
|
|
|
BBB.sendPrivateChatMessage = function(fontColor, localeLang, message, toUserID) {
|
2012-10-19 04:17:51 +08:00
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
2012-10-25 03:07:33 +08:00
|
|
|
swfObj.sendPrivateChatRequest(fontColor, localeLang, message, toUserID);
|
2012-10-19 04:17:51 +08:00
|
|
|
}
|
|
|
|
}
|
2013-06-12 02:19:35 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request to display a presentation.
|
|
|
|
* presentationID - the presentation to display
|
|
|
|
*/
|
|
|
|
BBB.displayPresentation = function(presentationID) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.displayPresentationRequest(presentationID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Query the list of uploaded presentations.
|
|
|
|
*/
|
|
|
|
BBB.queryListOfPresentations = function() {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.queryListsOfPresentationsRequest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request to delete a presentation.
|
|
|
|
* presentationID - the presentation to delete
|
|
|
|
*/
|
|
|
|
BBB.deletePresentation = function(presentationID) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.deletePresentationRequest(presentationID);
|
|
|
|
}
|
|
|
|
}
|
2014-02-08 08:56:23 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BBB.joinWebRTCVoiceConferenceCallback = function(message) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.joinWebRTCVoiceConferenceCallback(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BBB.leaveWebRTCVoiceConferenceCallback = function(message) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.leaveWebRTCVoiceConferenceCallback(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-15 00:02:54 +08:00
|
|
|
BBB.webRtcCallProgressCallback = function(progress) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.webRtcCallProgressCallback(progress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BBB.webRtcCallFailedCallback = function(reason) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.webRtcCallFailedCallback(reason);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BBB.webRtcCallEndedCallback = function(cause) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.webRtcCallEndedCallback(cause);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BBB.webRtcCallStartedCallback = function(localStream, remoteStream) {
|
|
|
|
var swfObj = getSwfObj();
|
|
|
|
if (swfObj) {
|
|
|
|
swfObj.webRtcCallStartedCallback(localStream, remoteStream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-12 02:19:35 +08:00
|
|
|
|
2013-02-15 05:26:08 +08:00
|
|
|
// Third-party JS apps should use this to query if the BBB SWF file is ready to handle calls.
|
|
|
|
BBB.isSwfClientReady = function() {
|
|
|
|
return swfReady;
|
|
|
|
}
|
2012-10-19 04:17:51 +08:00
|
|
|
|
2012-10-04 03:55:36 +08:00
|
|
|
/* ***********************************************************************************
|
|
|
|
* Broadcasting of events to 3rd-party apps.
|
|
|
|
*************************************************************************************/
|
|
|
|
|
2013-02-15 05:26:08 +08:00
|
|
|
/** Stores the 3rd-party app event listeners ***/
|
2012-10-04 03:55:36 +08:00
|
|
|
var listeners = {};
|
|
|
|
|
|
|
|
/**
|
2013-02-15 05:26:08 +08:00
|
|
|
* 3rd-party apps should user this method to register to listen for events.
|
2012-10-04 03:55:36 +08:00
|
|
|
*/
|
|
|
|
BBB.listen = function(eventName, handler) {
|
|
|
|
if (typeof listeners[eventName] === 'undefined')
|
|
|
|
listeners[eventName] = [];
|
|
|
|
|
|
|
|
listeners[eventName].push(handler);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2013-02-15 05:26:08 +08:00
|
|
|
* 3rd-party app should use this method to unregister listener for a given event.
|
2012-10-04 03:55:36 +08:00
|
|
|
*/
|
|
|
|
BBB.unlisten = function(eventName, handler) {
|
|
|
|
if (!listeners[eventName])
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (var i = 0; i < listeners[eventName].length; i++) {
|
|
|
|
if (listeners[eventName][i] === handler) {
|
|
|
|
listeners.splice(i, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2013-02-15 05:26:08 +08:00
|
|
|
* Private function to broadcast received event from the BigBlueButton Flash client to
|
2012-10-04 03:55:36 +08:00
|
|
|
* 3rd-parties.
|
|
|
|
*/
|
|
|
|
function broadcast(bbbEvent) {
|
2012-10-04 22:55:55 +08:00
|
|
|
if (!listeners[bbbEvent.eventName]) {
|
|
|
|
console.log("No listeners for [" + bbbEvent.eventName + "]");
|
2012-10-04 03:55:36 +08:00
|
|
|
return;
|
2012-10-04 22:55:55 +08:00
|
|
|
}
|
|
|
|
|
2012-10-04 03:55:36 +08:00
|
|
|
for (var i = 0; i < listeners[bbbEvent.eventName].length; i++) {
|
2012-10-04 22:55:55 +08:00
|
|
|
console.log("Notifying listeners for [" + bbbEvent.eventName + "]");
|
|
|
|
listeners[bbbEvent.eventName][i](bbbEvent);
|
2012-10-04 03:55:36 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2013-02-15 05:26:08 +08:00
|
|
|
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
|
|
|
* NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE!
|
|
|
|
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
|
|
|
*
|
|
|
|
* DO NOT CALL THIS METHOD FROM YOUR JS CODE.
|
|
|
|
*
|
|
|
|
* This is called by the BigBlueButton Flash client to inform 3rd-parties of internal events.
|
|
|
|
*
|
|
|
|
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
|
|
|
* NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE!
|
|
|
|
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
2012-10-04 03:55:36 +08:00
|
|
|
*/
|
|
|
|
BBB.handleFlashClientBroadcastEvent = function (bbbEvent) {
|
|
|
|
console.log("Received [" + bbbEvent.eventName + "]");
|
|
|
|
broadcast(bbbEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-01-15 05:06:49 +08:00
|
|
|
// Flag to indicate that the SWF file has been loaded and ready to handle calls.
|
|
|
|
var swfReady = false;
|
2013-02-15 05:26:08 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
|
|
|
* NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE!
|
|
|
|
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
|
|
|
*
|
|
|
|
* DO NOT CALL THIS METHOD FROM YOUR JS CODE.
|
|
|
|
*
|
|
|
|
* This is called by the BigBlueButton Flash client to inform 3rd-parties that it is ready.
|
|
|
|
*
|
|
|
|
* WARNING:
|
|
|
|
* Doesn't actually work as intended. The Flash client calls this function when it's loaded.
|
|
|
|
* However, the client as to query the BBB server to get the status of the meeting.
|
|
|
|
* We're working on the proper way to determining that the client is TRULY ready.
|
|
|
|
*
|
|
|
|
* !!! As a workaround, 3rd-party JS on init should call getUserInfo until it return NOT NULL.
|
|
|
|
*
|
|
|
|
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
|
|
|
* NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE!
|
|
|
|
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
|
|
|
*/
|
2013-01-15 05:06:49 +08:00
|
|
|
BBB.swfClientIsReady = function () {
|
|
|
|
console.log("BigBlueButton SWF is ready.");
|
|
|
|
swfReady = true;
|
|
|
|
}
|
|
|
|
|
2013-02-15 05:26:08 +08:00
|
|
|
/* ********************************************************************* */
|
|
|
|
|
|
|
|
BBB.init = function(callback) {
|
|
|
|
callback;
|
2013-01-15 05:06:49 +08:00
|
|
|
}
|
2013-02-15 05:26:08 +08:00
|
|
|
|
2013-01-15 05:06:49 +08:00
|
|
|
|
2012-10-05 03:46:23 +08:00
|
|
|
/************************************************
|
|
|
|
* EVENT NAME CONSTANTS
|
2012-12-13 03:33:33 +08:00
|
|
|
*
|
|
|
|
* See https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/src/org/bigbluebutton/core/EventConstants.as
|
|
|
|
*
|
2012-10-05 03:46:23 +08:00
|
|
|
************************************************/
|
2013-02-15 03:58:51 +08:00
|
|
|
var GET_MY_ROLE_RESP = 'GetMyRoleResponse';
|
|
|
|
var AM_I_PRESENTER_RESP = 'AmIPresenterQueryResponse';
|
|
|
|
var AM_I_SHARING_CAM_RESP = 'AmISharingCamQueryResponse';
|
|
|
|
var BROADCASTING_CAM_STARTED = 'BroadcastingCameraStartedEvent';
|
|
|
|
var BROADCASTING_CAM_STOPPED = 'BroadcastingCameraStoppedEvent';
|
|
|
|
var I_AM_SHARING_CAM = 'IAmSharingCamEvent';
|
|
|
|
var CAM_STREAM_SHARED = 'CamStreamSharedEvent';
|
|
|
|
var USER_JOINED = 'UserJoinedEvent';
|
|
|
|
var USER_LEFT = 'UserLeftEvent';
|
|
|
|
var SWITCHED_PRESENTER = 'SwitchedPresenterEvent';
|
|
|
|
var NEW_ROLE = 'NewRoleEvent';
|
|
|
|
var NEW_PRIVATE_CHAT = 'NewPrivateChatEvent';
|
|
|
|
var NEW_PUBLIC_CHAT = 'NewPublicChatEvent';
|
|
|
|
var SWITCHED_LAYOUT = 'SwitchedLayoutEvent';
|
|
|
|
var REMOTE_LOCKED_LAYOUT = 'RemoteLockedLayoutEvent';
|
|
|
|
var REMOTE_UNLOCKED_LAYOUT = 'RemoteUnlockedLayoutEvent';
|
|
|
|
var USER_JOINED_VOICE = 'UserJoinedVoiceEvent';
|
|
|
|
var USER_LEFT_VOICE = 'UserLeftVoiceEvent';
|
2013-05-30 00:06:02 +08:00
|
|
|
var USER_KICKED_OUT = 'UserKickedOutEvent';
|
2013-02-15 03:58:51 +08:00
|
|
|
var USER_MUTED_VOICE = 'UserVoiceMutedEvent';
|
|
|
|
var USER_TALKING = 'UserTalkingEvent';
|
|
|
|
var USER_LOCKED_VOICE = 'UserLockedVoiceEvent';
|
|
|
|
var START_PRIVATE_CHAT = "StartPrivateChatEvent";
|
|
|
|
var GET_MY_USER_INFO_REP = "GetMyUserInfoResponse";
|
|
|
|
var IS_USER_PUBLISHING_CAM_RESP = "IsUserPublishingCamResponse";
|
2013-05-09 07:17:06 +08:00
|
|
|
|
|
|
|
/*conversion events*/
|
|
|
|
var OFFICE_DOC_CONVERSION_SUCCESS = "OfficeDocConversionSuccess";
|
|
|
|
var OFFICE_DOC_CONVERSION_FAILED = "OfficeDocConversionFailed";
|
|
|
|
var SUPPORTED_DOCUMENT = "SupportedDocument";
|
|
|
|
var UNSUPPORTED_DOCUMENT = "UnsupportedDocument";
|
|
|
|
var PAGE_COUNT_FAILED = "PageCountFailed";
|
|
|
|
var THUMBNAILS_UPDATE = "ThumbnailsUpdate";
|
|
|
|
var PAGE_COUNT_EXCEEDED = "PageCountExceeded";
|
|
|
|
var CONVERT_SUCCESS = "ConvertSuccess";
|
|
|
|
var CONVERT_UPDATE = "ConvertUpdate";
|
|
|
|
|
2012-10-04 03:55:36 +08:00
|
|
|
window.BBB = BBB;
|
|
|
|
})(this);
|
|
|
|
|