Implements JitsiConnection
This commit is contained in:
parent
7d72df27a3
commit
89c7ff3a71
149
Conference.js
149
Conference.js
|
@ -1,149 +0,0 @@
|
|||
/**
|
||||
* 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;
|
|
@ -1,52 +0,0 @@
|
|||
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;
|
|
@ -0,0 +1,140 @@
|
|||
var xmpp = require("./modules/xmpp/xmpp");
|
||||
/**
|
||||
* Creates a JitsiConference object with the given name and properties.
|
||||
* Note: this constructor is not a part of the public API (objects should be
|
||||
* created using JitsiConnection.createConference).
|
||||
* @param options.config properties / settings related to the conference that will be created.
|
||||
* @param options.name the name of the conference
|
||||
* @param options.connection the JitsiConnection object for this JitsiConference.
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
function JitsiConference(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Joins the conference.
|
||||
*/
|
||||
JitsiConference.prototype.join = function () {
|
||||
xmpp.joinRoom(this.options.name, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Leaves the conference.
|
||||
*/
|
||||
JitsiConference.prototype.leave = function () {
|
||||
xmpp.l
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the media tracks and returns them via the callback.
|
||||
* @param options Object with properties / settings specifying the tracks which should be created.
|
||||
* should be created or some additional configurations about resolution for example.
|
||||
* @returns {Promise.<{Array.<JitsiTrack>}, JitsiConferenceError>} A promise that returns an array of created JitsiTracks if resolved,
|
||||
* or a JitsiConferenceError if rejected.
|
||||
*/
|
||||
JitsiConference.prototype.createLocalTracks = function (options) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local tracks.
|
||||
*/
|
||||
JitsiConference.prototype.getLocalTracks = function () {
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Attaches a handler for events(For example - "participant joined".) in the conference. All possible event are defined
|
||||
* in JitsiConferenceEvents.
|
||||
* @param eventId the event ID.
|
||||
* @param handler handler for the event.
|
||||
*
|
||||
* Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
|
||||
*/
|
||||
JitsiConference.prototype.on = function (eventId, handler) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes event listener
|
||||
* @param eventId the event ID.
|
||||
* @param [handler] optional, the specific handler to unbind
|
||||
*
|
||||
* Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
|
||||
*/
|
||||
JitsiConference.prototype.off = function (eventId, handler) {
|
||||
|
||||
}
|
||||
|
||||
// Common aliases for event emitter
|
||||
JitsiConference.prototype.addEventListener = JitsiConference.prototype.on
|
||||
JitsiConference.prototype.removeEventListener = JitsiConference.prototype.off
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
JitsiConference.prototype.addCommandListener = function (command, handler) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes command listener
|
||||
* @param command {String} the name of the command
|
||||
*/
|
||||
JitsiConference.prototype.removeCommandListener = function (command) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends text message to the other participants in the conference
|
||||
* @param message the text message.
|
||||
*/
|
||||
JitsiConference.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
|
||||
* @param successCallback will be called when the command is successfully send.
|
||||
* @param errorCallback will be called when the command is not sent successfully.
|
||||
* @returns {Promise.<{void}, JitsiConferenceError>} A promise that returns an array of created streams if resolved,
|
||||
* or an JitsiConferenceError if rejected.
|
||||
*/
|
||||
JitsiConference.prototype.sendCommand = function (name, values, persistent) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the display name for this conference.
|
||||
* @param name the display name to set
|
||||
*/
|
||||
JitsiConference.prototype.setDisplayName = function(name) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Elects the participant with the given id to be the selected participant or the speaker.
|
||||
* @param id the identifier of the participant
|
||||
*/
|
||||
JitsiConference.prototype.selectParticipant = function(participantId) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of participants for this conference.
|
||||
* @return Object a list of participant identifiers containing all conference participants.
|
||||
*/
|
||||
JitsiConference.prototype.getParticipants = function() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
module.exports = JitsiConference;
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* Enumeration with the erros for the conference.
|
||||
* Enumeration with the errors for the conference.
|
||||
* @type {{string: string}}
|
||||
*/
|
||||
var ConferenceErrors = {
|
||||
var JitsiConferenceErrors = {
|
||||
/**
|
||||
* Indicates that a password is required in order to join the conference.
|
||||
*/
|
||||
|
@ -12,12 +12,12 @@ var ConferenceErrors = {
|
|||
*/
|
||||
CONNECTION_ERROR: "conference.connectionError",
|
||||
/**
|
||||
* Indicates that the video bridge is down.
|
||||
* Indicates that there is no available videobridge.
|
||||
*/
|
||||
BRIDGE_DOWN: "conference.bridgeDown"
|
||||
VIDEOBRIDGE_NOT_AVAILABLE: "conference.videobridgeNotAvailable"
|
||||
/**
|
||||
* Many more errors TBD here.
|
||||
*/
|
||||
};
|
||||
|
||||
module.exports = ConferenceErrors;
|
||||
module.exports = JitsiConferenceErrors;
|
|
@ -2,15 +2,15 @@
|
|||
* Enumeration with the events for the conference.
|
||||
* @type {{string: string}}
|
||||
*/
|
||||
var ConferenceEvents = {
|
||||
var JitsiConferenceEvents = {
|
||||
/**
|
||||
* New media stream was added to the conference.
|
||||
* A new media track was added to the conference.
|
||||
*/
|
||||
STREAM_ADDED: "conference.streamAdded",
|
||||
TRACK_ADDED: "conference.trackAdded",
|
||||
/**
|
||||
* The media stream was removed to the conference.
|
||||
* The media track was removed to the conference.
|
||||
*/
|
||||
STREAM_REMOVED: "conference.streamRemoved",
|
||||
TRACK_REMOVED: "conference.trackRemoved",
|
||||
/**
|
||||
* The active speaker was changed.
|
||||
*/
|
||||
|
@ -44,17 +44,17 @@ var ConferenceEvents = {
|
|||
*/
|
||||
LAST_N_CHANGED: "conference.lastNChanged",
|
||||
/**
|
||||
* Stream was muted.
|
||||
* A media track was muted.
|
||||
*/
|
||||
STREAM_MUTED: "conference.streamMuted",
|
||||
TRACK_MUTED: "conference.trackMuted",
|
||||
/**
|
||||
* Stream was unmuted.
|
||||
* A media track was unmuted.
|
||||
*/
|
||||
STREAM_UNMUTED: "conference.streamUnmuted",
|
||||
TRACK_UNMUTED: "conference.trackUnmuted",
|
||||
/**
|
||||
* Audio levels of a stream was changed.
|
||||
* Audio levels of a media track was changed.
|
||||
*/
|
||||
STREAM_AUDIO_LEVEL_CHANGED: "conference.audioLevelsChanged",
|
||||
TRACK_AUDIO_LEVEL_CHANGED: "conference.audioLevelsChanged",
|
||||
/**
|
||||
* Indicates that the connection to the conference has been interrupted for some reason.
|
||||
*/
|
||||
|
@ -62,7 +62,7 @@ var ConferenceEvents = {
|
|||
/**
|
||||
* Indicates that the connection to the conference has been restored.
|
||||
*/
|
||||
CONNECTION_RESTORED: "conference.connecionRestored"
|
||||
CONNECTION_ESTABLISHED: "conference.connecionEstablished"
|
||||
};
|
||||
|
||||
module.exports = ConferenceEvents;
|
||||
module.exports = JitsiConferenceEvents;
|
|
@ -0,0 +1,73 @@
|
|||
var JitsiConference = require("./JitsiConference");
|
||||
var XMPP = require("./modules/xmpp/xmpp");
|
||||
|
||||
/**
|
||||
* Creates new connection object for the Jitsi Meet server side video conferencing service. Provides access to the
|
||||
* JitsiConference 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 JitsiConnection(appID, token, options) {
|
||||
this.appID = appID;
|
||||
this.token = token;
|
||||
this.options = options;
|
||||
this.xmpp = new XMPP(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect the client with the server.
|
||||
* @param options {object} connecting options (for example authentications parameters).
|
||||
*/
|
||||
JitsiConnection.prototype.connect = function (options) {
|
||||
if(!options)
|
||||
options = {};
|
||||
this.xmpp.connect(options.id, options.password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect the client from the server.
|
||||
*/
|
||||
JitsiConnection.prototype.disconnect = function () {
|
||||
this.xmpp.disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows renewal of the tokens if they are expiring.
|
||||
* @param token the new token.
|
||||
*/
|
||||
JitsiConnection.prototype.setToken = function (token) {
|
||||
this.token = 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 {JitsiConference} returns the new conference object.
|
||||
*/
|
||||
JitsiConnection.prototype.initJitsiConference = function (name, options) {
|
||||
return new JitsiConference({name: name, config: options, connection: this});
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribes the passed listener to the event.
|
||||
* @param event {JitsiConnectionEvents} the connection event.
|
||||
* @param listener {Function} the function that will receive the event
|
||||
*/
|
||||
JitsiConnection.prototype.addListener = function (event, listener) {
|
||||
this.xmpp.addListener(event, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribes the passed handler.
|
||||
* @param event {JitsiConnectionEvents} the connection event.
|
||||
* @param listener {Function} the function that will receive the event
|
||||
*/
|
||||
JitsiConnection.prototype.removeListener = function (event, listener) {
|
||||
this.xmpp.removeListener(event, listener);
|
||||
}
|
||||
|
||||
module.exports = JitsiConnection;
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Enumeration with the errors for the connection.
|
||||
* @type {{string: string}}
|
||||
*/
|
||||
var JitsiConnectionErrors = {
|
||||
/**
|
||||
* Indicates that a password is required in order to join the conference.
|
||||
*/
|
||||
PASSWORD_REQUIRED: "connection.passwordRequired",
|
||||
/**
|
||||
* Indicates that a connection error occurred when trying to join a conference.
|
||||
*/
|
||||
CONNECTION_ERROR: "connection.connectionError",
|
||||
/**
|
||||
* Not specified errors.
|
||||
*/
|
||||
OTHER_ERROR: "connection.otherError"
|
||||
};
|
||||
|
||||
module.exports = JitsiConnectionErrors;
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* Enumeration with the events for the connection.
|
||||
* @type {{string: string}}
|
||||
*/
|
||||
var JitsiConnnectionEvents = {
|
||||
/**
|
||||
* Indicates that the connection has been failed for some reason.
|
||||
*/
|
||||
CONNECTION_FAILED: "connection.connecionFailed",
|
||||
/**
|
||||
* Indicates that the connection has been established.
|
||||
*/
|
||||
CONNECTION_ESTABLISHED: "connection.connecionEstablished",
|
||||
/**
|
||||
* Indicates that the connection has been disconnected.
|
||||
*/
|
||||
CONNECTION_DISCONNECTED: "connection.connecionDisconnected",
|
||||
/**
|
||||
* Indicates that the perfomed action cannot be executed because the
|
||||
* connection is not in the correct state(connected, disconnected, etc.)
|
||||
*/
|
||||
WRONG_STATE: "connection.wrongState"
|
||||
};
|
||||
|
||||
module.exports = JitsiConnnectionEvents;
|
|
@ -1,16 +1,27 @@
|
|||
var Connection = require("./Connection");
|
||||
var ConferenceEvents = require("./ConferenceEvents");
|
||||
var JitsiConnection = require("./JitsiConnection");
|
||||
var JitsiConferenceEvents = require("./JitsiConferenceEvents");
|
||||
var JitsiConnectionEvents = require("./JitsiConnectionEvents");
|
||||
var JitsiConnectionErrors = require("./JitsiConnectionErrors");
|
||||
var JitsiConferenceErrors = require("./JitsiConferenceErrors");
|
||||
|
||||
/**
|
||||
* Namespace for the interface of Jitsi Meet Library.
|
||||
*/
|
||||
var LibJitsiMeet = {
|
||||
|
||||
Connection: Connection,
|
||||
JitsiConnection: JitsiConnection,
|
||||
events: {
|
||||
conference: ConferenceEvents
|
||||
conference: JitsiConferenceEvents,
|
||||
connection: JitsiConnectionEvents
|
||||
},
|
||||
errors: {
|
||||
conference: JitsiConferenceErrors,
|
||||
connection: JitsiConnectionErrors
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Setups the promise object.
|
||||
require("es6-promise").polyfill();
|
||||
|
||||
module.exports = LibJitsiMeet;
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
/**
|
||||
* Represents a single media track (either audio or video).
|
||||
* @constructor
|
||||
*/
|
||||
function JitsiTrack()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* JitsiTrack video type.
|
||||
* @type {string}
|
||||
*/
|
||||
JitsiTrack.VIDEO = "video";
|
||||
|
||||
/**
|
||||
* JitsiTrack audio type.
|
||||
* @type {string}
|
||||
*/
|
||||
JitsiTrack.AUDIO = "audio";
|
||||
|
||||
/**
|
||||
* Returns the type (audio or video) of this track.
|
||||
*/
|
||||
JitsiTrack.prototype.getType = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the JitsiParticipant to which this track belongs, or null if it is a local track.
|
||||
*/
|
||||
JitsiTrack.prototype.getParitcipant() = function() {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the RTCMediaStream from the browser (?).
|
||||
*/
|
||||
JitsiTrack.prototype.getOriginalStream() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutes the track.
|
||||
*/
|
||||
JitsiTrack.prototype.mute = function () {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmutes the stream.
|
||||
*/
|
||||
JitsiTrack.prototype.unmute = function () {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches the MediaStream of this track to an HTML container (?).
|
||||
* @param container the HTML container
|
||||
*/
|
||||
JitsiTrack.prototype.attach = function (container) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the track from the passed HTML container.
|
||||
* @param container the HTML container
|
||||
*/
|
||||
JitsiTrack.prototype.detach = function (container) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops sending the media track. And removes it from the HTML.
|
||||
* NOTE: Works for local tracks only.
|
||||
*/
|
||||
JitsiTrack.prototype.stop = function () {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Starts sending the track.
|
||||
* NOTE: Works for local tracks only.
|
||||
*/
|
||||
JitsiTrack.prototype.start = function() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this is a video track and the source of the video is a
|
||||
* screen capture as opposed to a camera.
|
||||
*/
|
||||
JitsiTrack.prototype.isScreenSharing = function(){
|
||||
}
|
||||
|
||||
module.exports = JitsiTrack;
|
16
Makefile
16
Makefile
|
@ -1,27 +1,25 @@
|
|||
NPM = npm
|
||||
BROWSERIFY = browserify
|
||||
GLOBAL_FLAGS = -x jquery -e
|
||||
GLOBAL_FLAGS =
|
||||
OUTPUT_DIR = .
|
||||
DEPLOY_DIR = libs
|
||||
DEPLOY_DIR = ../../jitsi-meet
|
||||
|
||||
all: compile deploy clean
|
||||
all: compile deploy
|
||||
|
||||
compile:FLAGS = $(GLOBAL_FLAGS)
|
||||
compile: app
|
||||
|
||||
debug: compile-debug deploy clean
|
||||
debug: compile-debug deploy
|
||||
|
||||
compile-debug:FLAGS = -d $(GLOBAL_FLAGS)
|
||||
compile-debug: app
|
||||
|
||||
app:
|
||||
$(NPM) update && $(BROWSERIFY) $(FLAGS) app.js -s APP -o $(OUTPUT_DIR)/app.bundle.js
|
||||
$(BROWSERIFY) $(FLAGS) JitsiMeetJS.js -s JitsiMeetJS -o $(OUTPUT_DIR)/lib-jitsi-meet.js
|
||||
|
||||
clean:
|
||||
rm -f $(OUTPUT_DIR)/*.bundle.js
|
||||
rm -f $(OUTPUT_DIR)/lib-jitsi-meet.js
|
||||
|
||||
deploy:
|
||||
mkdir -p $(DEPLOY_DIR) && \
|
||||
cp $(OUTPUT_DIR)/*.bundle.js $(DEPLOY_DIR) && \
|
||||
./bump-js-versions.sh && \
|
||||
cp $(OUTPUT_DIR)/lib-jitsi-meet.js $(DEPLOY_DIR) && \
|
||||
([ ! -x deploy-local.sh ] || ./deploy-local.sh)
|
||||
|
|
81
Stream.js
81
Stream.js
|
@ -1,81 +0,0 @@
|
|||
/**
|
||||
* 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;
|
File diff suppressed because it is too large
Load Diff
|
@ -134,8 +134,8 @@ function getConstraints(um, resolution, bandwidth, fps, desktopStream, isAndroid
|
|||
return constraints;
|
||||
}
|
||||
|
||||
|
||||
function RTCUtils(RTCService, onTemasysPluginReady)
|
||||
//Options parameter is to pass config options. Currently uses only "useIPv6".
|
||||
function RTCUtils(RTCService, onTemasysPluginReady, options)
|
||||
{
|
||||
var self = this;
|
||||
this.service = RTCService;
|
||||
|
@ -209,6 +209,10 @@ function RTCUtils(RTCService, onTemasysPluginReady)
|
|||
};
|
||||
// DTLS should now be enabled by default but..
|
||||
this.pc_constraints = {'optional': [{'DtlsSrtpKeyAgreement': 'true'}]};
|
||||
if (options.useIPv6) {
|
||||
// https://code.google.com/p/webrtc/issues/detail?id=2828
|
||||
this.pc_constraints.optional.push({googIPv6: true});
|
||||
}
|
||||
if (navigator.userAgent.indexOf('Android') != -1) {
|
||||
this.pc_constraints = {}; // disable DTLS on Android
|
||||
}
|
||||
|
@ -279,6 +283,7 @@ function RTCUtils(RTCService, onTemasysPluginReady)
|
|||
} catch (e) { }
|
||||
window.location.href = 'unsupported_browser.html';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ function JingleSessionPC(me, sid, connection, service, eventEmitter) {
|
|||
this.localSDP = null;
|
||||
this.remoteSDP = null;
|
||||
this.relayedStreams = [];
|
||||
this.pc_constraints = null;
|
||||
|
||||
this.usetrickle = true;
|
||||
this.usepranswer = false; // early transport warmup -- mind you, this might fail. depends on webrtc issue 1718
|
||||
|
@ -87,7 +86,7 @@ JingleSessionPC.prototype.doInitialize = function () {
|
|||
|
||||
this.peerconnection = new TraceablePeerConnection(
|
||||
this.connection.jingle.ice_config,
|
||||
this.connection.jingle.pc_constraints,
|
||||
APP.RTC.getPCConstraints(),
|
||||
this);
|
||||
|
||||
this.peerconnection.onicecandidate = function (event) {
|
||||
|
|
|
@ -35,7 +35,7 @@ var externalAuthEnabled = false;
|
|||
// Sip gateway can be enabled by configuring Jigasi host in config.js or
|
||||
// it will be enabled automatically if focus detects the component through
|
||||
// service discovery.
|
||||
var sipGatewayEnabled = config.hosts.call_control !== undefined;
|
||||
var sipGatewayEnabled = null;
|
||||
|
||||
var eventEmitter = null;
|
||||
|
||||
|
@ -63,6 +63,7 @@ var Moderator = {
|
|||
|
||||
init: function (xmpp, emitter) {
|
||||
this.xmppService = xmpp;
|
||||
sipGatewayEnabled = this.xmppService.options.hosts.call_control !== undefined;
|
||||
eventEmitter = emitter;
|
||||
|
||||
// Message listener that talks to POPUP window
|
||||
|
@ -111,10 +112,10 @@ var Moderator = {
|
|||
|
||||
getFocusComponent: function () {
|
||||
// Get focus component address
|
||||
var focusComponent = config.hosts.focus;
|
||||
var focusComponent = this.xmppService.options.hosts.focus;
|
||||
// If not specified use default: 'focus.domain'
|
||||
if (!focusComponent) {
|
||||
focusComponent = 'focus.' + config.hosts.domain;
|
||||
focusComponent = 'focus.' + this.xmppService.options.hosts.domain;
|
||||
}
|
||||
return focusComponent;
|
||||
},
|
||||
|
@ -140,55 +141,55 @@ var Moderator = {
|
|||
elem.attrs({ 'session-id': sessionId});
|
||||
}
|
||||
|
||||
if (config.hosts.bridge !== undefined) {
|
||||
if (this.xmppService.options.hosts.bridge !== undefined) {
|
||||
elem.c(
|
||||
'property',
|
||||
{ name: 'bridge', value: config.hosts.bridge})
|
||||
{ name: 'bridge', value: this.xmppService.options.hosts.bridge})
|
||||
.up();
|
||||
}
|
||||
// Tell the focus we have Jigasi configured
|
||||
if (config.hosts.call_control !== undefined) {
|
||||
if (this.xmppService.options.hosts.call_control !== undefined) {
|
||||
elem.c(
|
||||
'property',
|
||||
{ name: 'call_control', value: config.hosts.call_control})
|
||||
{ name: 'call_control', value: this.xmppService.options.hosts.call_control})
|
||||
.up();
|
||||
}
|
||||
if (config.channelLastN !== undefined) {
|
||||
if (this.xmppService.options.channelLastN !== undefined) {
|
||||
elem.c(
|
||||
'property',
|
||||
{ name: 'channelLastN', value: config.channelLastN})
|
||||
{ name: 'channelLastN', value: this.xmppService.options.channelLastN})
|
||||
.up();
|
||||
}
|
||||
if (config.adaptiveLastN !== undefined) {
|
||||
if (this.xmppService.options.adaptiveLastN !== undefined) {
|
||||
elem.c(
|
||||
'property',
|
||||
{ name: 'adaptiveLastN', value: config.adaptiveLastN})
|
||||
{ name: 'adaptiveLastN', value: this.xmppService.options.adaptiveLastN})
|
||||
.up();
|
||||
}
|
||||
if (config.adaptiveSimulcast !== undefined) {
|
||||
if (this.xmppService.options.adaptiveSimulcast !== undefined) {
|
||||
elem.c(
|
||||
'property',
|
||||
{ name: 'adaptiveSimulcast', value: config.adaptiveSimulcast})
|
||||
{ name: 'adaptiveSimulcast', value: this.xmppService.options.adaptiveSimulcast})
|
||||
.up();
|
||||
}
|
||||
if (config.openSctp !== undefined) {
|
||||
if (this.xmppService.options.openSctp !== undefined) {
|
||||
elem.c(
|
||||
'property',
|
||||
{ name: 'openSctp', value: config.openSctp})
|
||||
{ name: 'openSctp', value: this.xmppService.options.openSctp})
|
||||
.up();
|
||||
}
|
||||
if(config.startAudioMuted !== undefined)
|
||||
if(this.xmppService.options.startAudioMuted !== undefined)
|
||||
{
|
||||
elem.c(
|
||||
'property',
|
||||
{ name: 'startAudioMuted', value: config.startAudioMuted})
|
||||
{ name: 'startAudioMuted', value: this.xmppService.options.startAudioMuted})
|
||||
.up();
|
||||
}
|
||||
if(config.startVideoMuted !== undefined)
|
||||
if(this.xmppService.options.startVideoMuted !== undefined)
|
||||
{
|
||||
elem.c(
|
||||
'property',
|
||||
{ name: 'startVideoMuted', value: config.startVideoMuted})
|
||||
{ name: 'startVideoMuted', value: this.xmppService.options.startVideoMuted})
|
||||
.up();
|
||||
}
|
||||
elem.c(
|
||||
|
@ -250,7 +251,7 @@ var Moderator = {
|
|||
// to the user(or that focus is not available)
|
||||
allocateConferenceFocus: function (roomName, callback) {
|
||||
// Try to use focus user JID from the config
|
||||
Moderator.setFocusUserJid(config.focusUserJid);
|
||||
Moderator.setFocusUserJid(this.xmppService.options.focusUserJid);
|
||||
// Send create conference IQ
|
||||
var iq = Moderator.createConferenceIq(roomName);
|
||||
var self = this;
|
||||
|
@ -310,7 +311,7 @@ var Moderator = {
|
|||
console.warn("Unauthorized to start the conference", error);
|
||||
var toDomain
|
||||
= Strophe.getDomainFromJid(error.getAttribute('to'));
|
||||
if (toDomain !== config.hosts.anonymousdomain) {
|
||||
if (toDomain !== this.xmppService.options.hosts.anonymousdomain) {
|
||||
// FIXME: "is external" should come either from
|
||||
// the focus or config.js
|
||||
externalAuthEnabled = true;
|
||||
|
|
|
@ -1,169 +0,0 @@
|
|||
/* global $, $iq, config, connection, focusMucJid, messageHandler,
|
||||
Toolbar, Util */
|
||||
var Moderator = require("./moderator");
|
||||
|
||||
|
||||
var recordingToken = null;
|
||||
var recordingEnabled;
|
||||
|
||||
/**
|
||||
* Whether to use a jirecon component for recording, or use the videobridge
|
||||
* through COLIBRI.
|
||||
*/
|
||||
var useJirecon = (typeof config.hosts.jirecon != "undefined");
|
||||
|
||||
/**
|
||||
* The ID of the jirecon recording session. Jirecon generates it when we
|
||||
* initially start recording, and it needs to be used in subsequent requests
|
||||
* to jirecon.
|
||||
*/
|
||||
var jireconRid = null;
|
||||
|
||||
/**
|
||||
* The callback to update the recording button. Currently used from colibri
|
||||
* after receiving a pending status.
|
||||
*/
|
||||
var recordingStateChangeCallback = null;
|
||||
|
||||
function setRecordingToken(token) {
|
||||
recordingToken = token;
|
||||
}
|
||||
|
||||
function setRecordingJirecon(state, token, callback, connection) {
|
||||
if (state == recordingEnabled){
|
||||
return;
|
||||
}
|
||||
|
||||
var iq = $iq({to: config.hosts.jirecon, type: 'set'})
|
||||
.c('recording', {xmlns: 'http://jitsi.org/protocol/jirecon',
|
||||
action: (state === 'on') ? 'start' : 'stop',
|
||||
mucjid: connection.emuc.roomjid});
|
||||
if (state === 'off'){
|
||||
iq.attrs({rid: jireconRid});
|
||||
}
|
||||
|
||||
console.log('Start recording');
|
||||
|
||||
connection.sendIQ(
|
||||
iq,
|
||||
function (result) {
|
||||
// TODO wait for an IQ with the real status, since this is
|
||||
// provisional?
|
||||
jireconRid = $(result).find('recording').attr('rid');
|
||||
console.log('Recording ' + ((state === 'on') ? 'started' : 'stopped') +
|
||||
'(jirecon)' + result);
|
||||
recordingEnabled = state;
|
||||
if (state === 'off'){
|
||||
jireconRid = null;
|
||||
}
|
||||
|
||||
callback(state);
|
||||
},
|
||||
function (error) {
|
||||
console.log('Failed to start recording, error: ', error);
|
||||
callback(recordingEnabled);
|
||||
});
|
||||
}
|
||||
|
||||
// Sends a COLIBRI message which enables or disables (according to 'state')
|
||||
// the recording on the bridge. Waits for the result IQ and calls 'callback'
|
||||
// with the new recording state, according to the IQ.
|
||||
function setRecordingColibri(state, token, callback, connection) {
|
||||
var elem = $iq({to: connection.emuc.focusMucJid, type: 'set'});
|
||||
elem.c('conference', {
|
||||
xmlns: 'http://jitsi.org/protocol/colibri'
|
||||
});
|
||||
elem.c('recording', {state: state, token: token});
|
||||
|
||||
connection.sendIQ(elem,
|
||||
function (result) {
|
||||
console.log('Set recording "', state, '". Result:', result);
|
||||
var recordingElem = $(result).find('>conference>recording');
|
||||
var newState = recordingElem.attr('state');
|
||||
|
||||
recordingEnabled = newState;
|
||||
callback(newState);
|
||||
|
||||
if (newState === 'pending' && recordingStateChangeCallback == null) {
|
||||
recordingStateChangeCallback = callback;
|
||||
connection.addHandler(function(iq){
|
||||
var state = $(iq).find('recording').attr('state');
|
||||
if (state)
|
||||
recordingStateChangeCallback(state);
|
||||
}, 'http://jitsi.org/protocol/colibri', 'iq', null, null, null);
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
console.warn(error);
|
||||
callback(recordingEnabled);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function setRecording(state, token, callback, connection) {
|
||||
if (useJirecon){
|
||||
setRecordingJirecon(state, token, callback, connection);
|
||||
} else {
|
||||
setRecordingColibri(state, token, callback, connection);
|
||||
}
|
||||
}
|
||||
|
||||
var Recording = {
|
||||
toggleRecording: function (tokenEmptyCallback, recordingStateChangeCallback, connection) {
|
||||
if (!Moderator.isModerator()) {
|
||||
console.log(
|
||||
'non-focus, or conference not yet organized:' +
|
||||
' not enabling recording');
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
// Jirecon does not (currently) support a token.
|
||||
if (!recordingToken && !useJirecon) {
|
||||
tokenEmptyCallback(function (value) {
|
||||
setRecordingToken(value);
|
||||
self.toggleRecording(tokenEmptyCallback, recordingStateChangeCallback, connection);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var oldState = recordingEnabled;
|
||||
var newState = (oldState === 'off' || !oldState) ? 'on' : 'off';
|
||||
|
||||
setRecording(newState,
|
||||
recordingToken,
|
||||
function (state) {
|
||||
console.log("New recording state: ", state);
|
||||
if (state === oldState) {
|
||||
// FIXME: new focus:
|
||||
// this will not work when moderator changes
|
||||
// during active session. Then it will assume that
|
||||
// recording status has changed to true, but it might have
|
||||
// been already true(and we only received actual status from
|
||||
// the focus).
|
||||
//
|
||||
// SO we start with status null, so that it is initialized
|
||||
// here and will fail only after second click, so if invalid
|
||||
// token was used we have to press the button twice before
|
||||
// current status will be fetched and token will be reset.
|
||||
//
|
||||
// Reliable way would be to return authentication error.
|
||||
// Or status update when moderator connects.
|
||||
// Or we have to stop recording session when current
|
||||
// moderator leaves the room.
|
||||
|
||||
// Failed to change, reset the token because it might
|
||||
// have been wrong
|
||||
setRecordingToken(null);
|
||||
}
|
||||
recordingStateChangeCallback(state);
|
||||
|
||||
},
|
||||
connection
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = Recording;
|
|
@ -321,7 +321,7 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
} else if ($(pres).find(
|
||||
'>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
|
||||
var toDomain = Strophe.getDomainFromJid(pres.getAttribute('to'));
|
||||
if (toDomain === config.hosts.anonymousdomain) {
|
||||
if (toDomain === XMPP.options.hosts.anonymousdomain) {
|
||||
// enter the room by replying with 'not-authorized'. This would
|
||||
// result in reconnection from authorized domain.
|
||||
// We're either missing Jicofo/Prosody config for anonymous
|
||||
|
@ -452,7 +452,7 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
|
||||
// Send XEP-0115 'c' stanza that contains our capabilities info
|
||||
if (this.connection.caps) {
|
||||
this.connection.caps.node = config.clientNode;
|
||||
this.connection.caps.node = XMPP.options.clientNode;
|
||||
pres.c('c', this.connection.caps.generateCapsAttrs()).up();
|
||||
}
|
||||
|
||||
|
@ -620,7 +620,7 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
if(member.isFocus)
|
||||
return;
|
||||
|
||||
var displayName = !config.displayJids
|
||||
var displayName = !XMPP.options.displayJids
|
||||
? member.displayName : Strophe.getResourceFromJid(from);
|
||||
|
||||
if (displayName && displayName.length > 0) {
|
||||
|
|
|
@ -11,7 +11,6 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
sessions: {},
|
||||
jid2session: {},
|
||||
ice_config: {iceServers: []},
|
||||
pc_constraints: {},
|
||||
activecall: null,
|
||||
media_constraints: {
|
||||
mandatory: {
|
||||
|
@ -107,7 +106,6 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
// configure session
|
||||
|
||||
sess.media_constraints = this.media_constraints;
|
||||
sess.pc_constraints = this.pc_constraints;
|
||||
sess.ice_config = this.ice_config;
|
||||
|
||||
sess.initialize(fromJid, false);
|
||||
|
@ -197,7 +195,6 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
// configure session
|
||||
|
||||
sess.media_constraints = this.media_constraints;
|
||||
sess.pc_constraints = this.pc_constraints;
|
||||
sess.ice_config = this.ice_config;
|
||||
|
||||
sess.initialize(peerjid, true);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,7 +25,8 @@
|
|||
"async": "0.9.0",
|
||||
"retry": "0.6.1",
|
||||
"jssha": "1.5.0",
|
||||
"socket.io-client": "1.3.6"
|
||||
"socket.io-client": "1.3.6",
|
||||
"es6-promise": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue