From 7d72df27a3092b805bcf066a3dc5f9332c4ca6de Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Fri, 14 Aug 2015 14:42:14 -0500 Subject: [PATCH] Adds jitsi meet library interface files. --- Conference.js | 149 ++++++++++++++++++++++++++++++++++++++++++++ ConferenceErrors.js | 23 +++++++ ConferenceEvents.js | 68 ++++++++++++++++++++ Connection.js | 52 ++++++++++++++++ JitsiMeetJS.js | 16 +++++ Stream.js | 81 ++++++++++++++++++++++++ 6 files changed, 389 insertions(+) create mode 100644 Conference.js create mode 100644 ConferenceErrors.js create mode 100644 ConferenceEvents.js create mode 100644 Connection.js create mode 100644 JitsiMeetJS.js create mode 100644 Stream.js diff --git a/Conference.js b/Conference.js new file mode 100644 index 000000000..40bab3912 --- /dev/null +++ b/Conference.js @@ -0,0 +1,149 @@ +/** + * Creates a Conference object with the given name and properties. + * Note: this constructor is not a part of the public API (objects should be + * created using Connection.createConference). + * @param name name of the conference. + * @param options Object with properties / settings related to the conference that will be created. + * @param connection The Connection object for this Conference. + * @constructor + */ + +function Conference(name, options, connection) { + +} + +/** + * Joins the conference. + */ +Conference.prototype.join = function () { + +} + +/** + * Leaves the conference. + */ +Conference.prototype.leave = function () { + +} + +/** + * Creates the media streams and returns them via the callback. + * @param options Object with properties / settings defining which streams(Stream.AUDIO, Stream.VIDEO, Stream.DESKTOP) + * should be created or some additional configurations about resolution for example. + * @param successCallback callback that will receive the streams. + * @param errorCallback callback that will be called if accessing the media streams fail. + * @return an array of all created MediaStream-s + */ +Conference.prototype.createMediaStreams = function (options, successCallback, errorCallback) { + +} + +/** + * Attaches a handler for events(For example - "participant joined".) in the conference. All possible event are defined + * in ConferenceEvents. + * @param eventId the event ID. + * @param handler handler for the event. + */ +Conference.prototype.addEventListener = function (eventId, handler) { + +} + +/** + * Removes event listener + * @param eventId the event ID. + */ +Conference.prototype.removeEventListener = function (eventId) { + +} + +/** + * Receives notifications from another participants for commands / custom events(send by sendPresenceCommand method). + * @param command {String} the name of the command + * @param handler {Function} handler for the command + */ +Conference.prototype.addPresenceCommandListener = function (command, handler) { + +} + + +/** + * Removes command listener + * @param command {String} the name of the command + */ +Conference.prototype.removePresenceCommandListener = function (command) { + +} + +/** + * Sends local streams to the server side. + * @param stream the stream object. + * @param successCallback callback that will be called when the stream is sending is successfull. + * @param errorCallback callback that will be called if something go wrong. + */ +Conference.prototype.sendStream = function (stream, successCallback, errorCallback) { + +} + +/** + * Sends text message to the other participants in the conference + * @param message the text message. + */ +Conference.prototype.sendTextMessage = function (message) { + +} + +/** + * Send presence command. + * @param name the name of the command. + * @param values Object with keys and values that will be send. + * @param persistent if false the command will be sent only one time + * otherwise it will be sent with every system message sent to the other participants. + * @param successCallback will be called when the command is successfully send. + * @param errorCallback will be called when the command is not sent successfully. + */ +Conference.prototype.sendPresenceCommand = function (name, values, persistent, successCallback, errorCallback) { + +} + +/** + * Sets the display name for this conference. + * @param name the display name to set + */ +Conference.prototype.setDisplayName = function(name) { + +} + +/** + * Start desktop sharing. This will replace the video stream with the desktop sharing stream. + * @return Stream stream of type DESKTOP + */ +Conference.prototype.startDesktopSharing = function() { + +} + +/** + * Stop desktop sharing. This will replace the desktop stream with the video stream. + * @return Stream stream of type VIDEO + */ +Conference.prototype.endDesktopSharing = function() { + +} + +/** + * Elects the participant with the given id to be the selected participant or the speaker. + * @param id the identifier of the participant + */ +Conference.prototype.selectParticipant = function(participantId) { + +} + +/** + * Returns the list of participants for this conference. + * @return Object a list of participant identifiers containing all conference participants. + */ +Conference.prototype.getParticipants = function() { + +} + + +module.exports = Conference; diff --git a/ConferenceErrors.js b/ConferenceErrors.js new file mode 100644 index 000000000..d07bf118c --- /dev/null +++ b/ConferenceErrors.js @@ -0,0 +1,23 @@ +/** + * Enumeration with the erros for the conference. + * @type {{string: string}} + */ +var ConferenceErrors = { + /** + * Indicates that a password is required in order to join the conference. + */ + PASSWORD_REQUIRED: "conference.passwordRequired", + /** + * Indicates that a connection error occurred when trying to join a conference. + */ + CONNECTION_ERROR: "conference.connectionError", + /** + * Indicates that the video bridge is down. + */ + BRIDGE_DOWN: "conference.bridgeDown" + /** + * Many more errors TBD here. + */ +}; + +module.exports = ConferenceErrors; \ No newline at end of file diff --git a/ConferenceEvents.js b/ConferenceEvents.js new file mode 100644 index 000000000..fbec0cb9c --- /dev/null +++ b/ConferenceEvents.js @@ -0,0 +1,68 @@ +/** + * Enumeration with the events for the conference. + * @type {{string: string}} + */ +var ConferenceEvents = { + /** + * New media stream was added to the conference. + */ + STREAM_ADDED: "conference.streamAdded", + /** + * The media stream was removed to the conference. + */ + STREAM_REMOVED: "conference.streamRemoved", + /** + * The active speaker was changed. + */ + ACTIVE_SPEAKER_CHANGED: "conference.activeSpeaker", + /** + * A new user joinned the conference. + */ + USER_JOINED: "conference.userJoined", + /** + * A user has left the conference. + */ + USER_LEFT: "conference.userLeft", + /** + * New text message was received. + */ + MESSAGE_RECEIVED: "conference.messageReceived", + /** + * A user has changed it display name + */ + DISPLAY_NAME_CHANGED: "conference.displayNameChanged", + /** + * A participant avatar has changed. + */ + AVATAR_CHANGED: "conference.avatarChanged", + /** + * New connection statistics are received. + */ + CONNECTION_STATS_RECEIVED: "conference.connectionStatsReceived", + /** + * The Last N set is changed. + */ + LAST_N_CHANGED: "conference.lastNChanged", + /** + * Stream was muted. + */ + STREAM_MUTED: "conference.streamMuted", + /** + * Stream was unmuted. + */ + STREAM_UNMUTED: "conference.streamUnmuted", + /** + * Audio levels of a stream was changed. + */ + STREAM_AUDIO_LEVEL_CHANGED: "conference.audioLevelsChanged", + /** + * Indicates that the connection to the conference has been interrupted for some reason. + */ + CONNECTION_INTERRUPTED: "conference.connecionInterrupted", + /** + * Indicates that the connection to the conference has been restored. + */ + CONNECTION_RESTORED: "conference.connecionRestored" +}; + +module.exports = ConferenceEvents; \ No newline at end of file diff --git a/Connection.js b/Connection.js new file mode 100644 index 000000000..003f646b7 --- /dev/null +++ b/Connection.js @@ -0,0 +1,52 @@ +var Conference = require("./Conference"); + +/** + * Creates new connection object for the Jitsi Meet server side video conferencing service. Provides access to the + * Conference interface. + * @param appID identification for the provider of Jitsi Meet video conferencing services. + * @param token secret generated by the provider of Jitsi Meet video conferencing services. + * The token will be send to the provider from the Jitsi Meet server deployment for authorization of the current client. + * @param options Object with properties / settings related to connection with the server. + * @constructor + */ +function Connection(appID, token, options) { + +} + +/** + * Connect the client with the server. + * @param successCallback this callback will be called when the connection is successfull + * @param errorCallback this callback will be called when the connection fail. + */ +Connection.prototype.connect = function (successCallback, errorCallback) { + +} + +/** + * Disconnect the client from the server. + * @param successCallback this callback will be called when we have successfully disconnected + * @param errorCallback this callback will be called when the disconnect didn't succeed + */ +Connection.prototype.disconnect = function (successCallback, errorCallback) { + +} + +/** + * This method allows renewal of the tokens if they are expiring. + * @param token the new token. + */ +Connection.prototype.setToken = function (token) { + +} + +/** + * Creates and joins new conference. + * @param name the name of the conference; if null - a generated name will be provided from the api + * @param options Object with properties / settings related to the conference that will be created. + * @returns {Conference} returns the new conference object. + */ +Connection.prototype.initConference = function (name, options) { + return new Conference(name, options, this); +} + +module.exports = Connection; diff --git a/JitsiMeetJS.js b/JitsiMeetJS.js new file mode 100644 index 000000000..f7153621d --- /dev/null +++ b/JitsiMeetJS.js @@ -0,0 +1,16 @@ +var Connection = require("./Connection"); +var ConferenceEvents = require("./ConferenceEvents"); + +/** + * Namespace for the interface of Jitsi Meet Library. + */ +var LibJitsiMeet = { + + Connection: Connection, + events: { + conference: ConferenceEvents + } + +} + +module.exports = LibJitsiMeet; diff --git a/Stream.js b/Stream.js new file mode 100644 index 000000000..c8a22349e --- /dev/null +++ b/Stream.js @@ -0,0 +1,81 @@ +/** + * Represents media stream(audio, video, desktop) + * @constructor + */ +function Stream() +{ + +} + +/** + * Stream video type. + * @type {string} + */ +Stream.VIDEO = "video"; + +/** + * Stream audio type. + * @type {string} + */ +Stream.AUDIO = "audio"; + +/** + * Stream desktop sharing type. + * @type {string} + */ +Stream.DESKTOP_SHARING = "desktopsharing"; + +/** + * The media stream type. + */ +Stream.prototype.streamType; + +/** + * The corresponding participant identifier. + */ +Stream.prototype.participantId; + +/** + * The media stream from the browser. + */ +Stream.prototype.originalStream; + +/** + * Mutes the stream. + */ +Stream.prototype.mute = function () { + +} + +/** + * Unmutes the stream. + */ +Stream.prototype.unmute = function () { + +} + +/** + * Attaches the stream to HTML container. + * @param container the HTML container + */ +Stream.prototype.attachStream = function (container) { + +} + +/** + * Removes the stream from the passed HTML container. + * @param container the HTML container + */ +Stream.prototype.remove = function (container) { + +} + +/** + * Stops sending the stream. And removes it from the HTML. + * NOTE: Works for the local stream only. + */ +Stream.prototype.stop = function () { + +} + +module.exports = Stream; \ No newline at end of file