Removes the bundles for every module and add bundle for the whole application.

This commit is contained in:
hristoterezov 2015-01-28 16:35:22 +02:00
parent c7e2331284
commit 9eb2873cfa
57 changed files with 11852 additions and 13195 deletions

View File

@ -1,23 +1,20 @@
BROWSERIFY = browserify
GLOBAL_FLAGS = -e
MODULE_DIR = modules
MODULE_SUBDIRS = $(wildcard $(MODULE_DIR)/*/)
MODULES = $(MODULE_SUBDIRS:$(MODULE_DIR)/%/=%)
OUTPUT_DIR = .
DEPLOY_DIR = libs/modules
DEPLOY_DIR = libs
all: compile deploy clean
compile:FLAGS = $(GLOBAL_FLAGS)
compile:$(MODULES)
compile: app
debug: compile-debug deploy clean
compile-debug:FLAGS = -d $(GLOBAL_FLAGS)
compile-debug:$(MODULES)
compile-debug: app
$(MODULES): *.js
$(BROWSERIFY) $(FLAGS) $(MODULE_DIR)/$@/$@.js -s $@ -o $(OUTPUT_DIR)/$@.bundle.js
app:
$(BROWSERIFY) $(FLAGS) app.js -s APP -o $(OUTPUT_DIR)/app.bundle.js
clean:
@rm -f $(OUTPUT_DIR)/*.bundle.js

46
app.js
View File

@ -1,30 +1,50 @@
/* jshint -W117 */
/* application specific logic */
var APP =
{
init: function () {
this.UI = require("./modules/UI/UI");
this.API = require("./modules/API/API");
this.connectionquality = require("./modules/connectionquality/connectionquality");
this.statistics = require("./modules/statistics/statistics");
this.RTC = require("./modules/RTC/RTC");
this.simulcast = require("./modules/simulcast/simulcast");
this.desktopsharing = require("./modules/desktopsharing/desktopsharing");
this.xmpp = require("./modules/xmpp/xmpp");
this.keyboardshortcut = require("./modules/keyboardshortcut/keyboardshortcut");
}
};
function init() {
RTC.start();
xmpp.start(UI.getCreadentials);
APP.RTC.start();
APP.xmpp.start(APP.UI.getCreadentials);
APP.statistics.start();
APP.connectionquality.init();
// Set default desktop sharing method
APP.desktopsharing.init();
APP.keyboardshortcut.init();
}
$(document).ready(function () {
if(API.isEnabled())
API.init();
APP.init();
UI.start();
statistics.start();
connectionquality.init();
// Set default desktop sharing method
desktopsharing.init();
if(APP.API.isEnabled())
APP.API.init();
APP.UI.start(init);
keyboardshortcut.init();
});
$(window).bind('beforeunload', function () {
if(API.isEnabled())
API.dispose();
if(APP.API.isEnabled())
APP.API.dispose();
});
module.exports = APP;

View File

@ -19,24 +19,7 @@
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
<script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
<script src="interface_config.js?v=5"></script>
<script src="service/RTC/RTCBrowserType.js?v=1"></script>
<script src="service/RTC/StreamEventTypes.js?v=2"></script>
<script src="service/RTC/MediaStreamTypes.js?v=1"></script>
<script src="service/RTC/RTCEvents.js?v=1"></script>
<script src="service/xmpp/XMPPEvents.js?v=1"></script>
<script src="service/connectionquality/CQEvents.js?v=1"></script>
<script src="service/UI/UIEvents.js?v=1"></script>
<script src="service/desktopsharing/DesktopSharingEventTypes.js?v=1"></script>
<script src="libs/modules/connectionquality.bundle.js?v=3"></script>
<script src="libs/modules/UI.bundle.js?v=14"></script>
<script src="libs/modules/statistics.bundle.js?v=5"></script>
<script src="libs/modules/RTC.bundle.js?v=9"></script>
<script src="libs/modules/simulcast.bundle.js?v=6"></script>
<script src="libs/modules/desktopsharing.bundle.js?v=3"></script><!-- desktop sharing -->
<script src="libs/modules/xmpp.bundle.js?v=8"></script>
<script src="libs/modules/keyboardshortcut.bundle.js?v=2"></script>
<script src="app.js?v=30"></script><!-- application logic -->
<script src="libs/modules/API.bundle.js?v=2"></script>
<script src="libs/app.bundle.js?v=1"></script>
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
<link rel="stylesheet" href="css/font.css?v=6"/>

File diff suppressed because it is too large Load Diff

View File

@ -1,234 +0,0 @@
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.API=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/**
* Implements API class that communicates with external api class
* and provides interface to access Jitsi Meet features by external
* applications that embed Jitsi Meet
*/
/**
* List of the available commands.
* @type {{
* displayName: inputDisplayNameHandler,
* muteAudio: toggleAudio,
* muteVideo: toggleVideo,
* filmStrip: toggleFilmStrip
* }}
*/
var commands =
{
displayName: UI.inputDisplayNameHandler,
muteAudio: UI.toggleAudio,
muteVideo: UI.toggleVideo,
toggleFilmStrip: UI.toggleFilmStrip,
toggleChat: UI.toggleChat,
toggleContactList: UI.toggleContactList
};
/**
* Maps the supported events and their status
* (true it the event is enabled and false if it is disabled)
* @type {{
* incomingMessage: boolean,
* outgoingMessage: boolean,
* displayNameChange: boolean,
* participantJoined: boolean,
* participantLeft: boolean
* }}
*/
var events =
{
incomingMessage: false,
outgoingMessage:false,
displayNameChange: false,
participantJoined: false,
participantLeft: false
};
var displayName = {};
/**
* Processes commands from external applicaiton.
* @param message the object with the command
*/
function processCommand(message)
{
if(message.action != "execute")
{
console.error("Unknown action of the message");
return;
}
for(var key in message)
{
if(commands[key])
commands[key].apply(null, message[key]);
}
}
/**
* Processes events objects from external applications
* @param event the event
*/
function processEvent(event) {
if(!event.action)
{
console.error("Event with no action is received.");
return;
}
var i = 0;
switch(event.action)
{
case "add":
for(; i < event.events.length; i++)
{
events[event.events[i]] = true;
}
break;
case "remove":
for(; i < event.events.length; i++)
{
events[event.events[i]] = false;
}
break;
default:
console.error("Unknown action for event.");
}
}
/**
* Sends message to the external application.
* @param object
*/
function sendMessage(object) {
window.parent.postMessage(JSON.stringify(object), "*");
}
/**
* Processes a message event from the external application
* @param event the message event
*/
function processMessage(event)
{
var message;
try {
message = JSON.parse(event.data);
} catch (e) {}
if(!message.type)
return;
switch (message.type)
{
case "command":
processCommand(message);
break;
case "event":
processEvent(message);
break;
default:
console.error("Unknown type of the message");
return;
}
}
function setupListeners() {
xmpp.addListener(XMPPEvents.MUC_ENTER, function (from) {
API.triggerEvent("participantJoined", {jid: from});
});
xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, function (from, nick, txt, myjid) {
if (from != myjid)
API.triggerEvent("incomingMessage",
{"from": from, "nick": nick, "message": txt});
});
xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) {
API.triggerEvent("participantLeft", {jid: jid});
});
xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) {
name = displayName[jid];
if(!name || name != newDisplayName) {
API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName});
displayName[jid] = newDisplayName;
}
});
xmpp.addListener(XMPPEvents.SENDING_CHAT_MESSAGE, function (body) {
API.triggerEvent("outgoingMessage", {"message": body});
});
}
var API = {
/**
* Check whether the API should be enabled or not.
* @returns {boolean}
*/
isEnabled: function () {
var hash = location.hash;
if(hash && hash.indexOf("external") > -1 && window.postMessage)
return true;
return false;
},
/**
* Initializes the APIConnector. Setups message event listeners that will
* receive information from external applications that embed Jitsi Meet.
* It also sends a message to the external application that APIConnector
* is initialized.
*/
init: function () {
if (window.addEventListener)
{
window.addEventListener('message',
processMessage, false);
}
else
{
window.attachEvent('onmessage', processMessage);
}
sendMessage({type: "system", loaded: true});
setupListeners();
},
/**
* Checks whether the event is enabled ot not.
* @param name the name of the event.
* @returns {*}
*/
isEventEnabled: function (name) {
return events[name];
},
/**
* Sends event object to the external application that has been subscribed
* for that event.
* @param name the name event
* @param object data associated with the event
*/
triggerEvent: function (name, object) {
if(this.isEnabled() && this.isEventEnabled(name))
sendMessage({
type: "event", action: "result", event: name, result: object});
},
/**
* Removes the listeners.
*/
dispose: function () {
if(window.removeEventListener)
{
window.removeEventListener("message",
processMessage, false);
}
else
{
window.detachEvent('onmessage', processMessage);
}
}
};
module.exports = API;
},{}]},{},[1])(1)
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,438 +0,0 @@
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.connectionquality=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var EventEmitter = require("events");
var eventEmitter = new EventEmitter();
/**
* local stats
* @type {{}}
*/
var stats = {};
/**
* remote stats
* @type {{}}
*/
var remoteStats = {};
/**
* Interval for sending statistics to other participants
* @type {null}
*/
var sendIntervalId = null;
/**
* Start statistics sending.
*/
function startSendingStats() {
sendStats();
sendIntervalId = setInterval(sendStats, 10000);
}
/**
* Sends statistics to other participants
*/
function sendStats() {
xmpp.addToPresence("connectionQuality", convertToMUCStats(stats));
}
/**
* Converts statistics to format for sending through XMPP
* @param stats the statistics
* @returns {{bitrate_donwload: *, bitrate_uplpoad: *, packetLoss_total: *, packetLoss_download: *, packetLoss_upload: *}}
*/
function convertToMUCStats(stats) {
return {
"bitrate_download": stats.bitrate.download,
"bitrate_upload": stats.bitrate.upload,
"packetLoss_total": stats.packetLoss.total,
"packetLoss_download": stats.packetLoss.download,
"packetLoss_upload": stats.packetLoss.upload
};
}
/**
* Converts statitistics to format used by VideoLayout
* @param stats
* @returns {{bitrate: {download: *, upload: *}, packetLoss: {total: *, download: *, upload: *}}}
*/
function parseMUCStats(stats) {
return {
bitrate: {
download: stats.bitrate_download,
upload: stats.bitrate_upload
},
packetLoss: {
total: stats.packetLoss_total,
download: stats.packetLoss_download,
upload: stats.packetLoss_upload
}
};
}
var ConnectionQuality = {
init: function () {
xmpp.addListener(XMPPEvents.REMOTE_STATS, this.updateRemoteStats);
statistics.addConnectionStatsListener(this.updateLocalStats);
statistics.addRemoteStatsStopListener(this.stopSendingStats);
},
/**
* Updates the local statistics
* @param data new statistics
*/
updateLocalStats: function (data) {
stats = data;
eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, 100 - stats.packetLoss.total, stats);
if (sendIntervalId == null) {
startSendingStats();
}
},
/**
* Updates remote statistics
* @param jid the jid associated with the statistics
* @param data the statistics
*/
updateRemoteStats: function (jid, data) {
if (data == null || data.packetLoss_total == null) {
eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED, jid, null, null);
return;
}
remoteStats[jid] = parseMUCStats(data);
eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED,
jid, 100 - data.packetLoss_total, remoteStats[jid]);
},
/**
* Stops statistics sending.
*/
stopSendingStats: function () {
clearInterval(sendIntervalId);
sendIntervalId = null;
//notify UI about stopping statistics gathering
eventEmitter.emit(CQEvents.STOP);
},
/**
* Returns the local statistics.
*/
getStats: function () {
return stats;
},
addListener: function (type, listener) {
eventEmitter.on(type, listener);
}
};
module.exports = ConnectionQuality;
},{"events":2}],2:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
function EventEmitter() {
this._events = this._events || {};
this._maxListeners = this._maxListeners || undefined;
}
module.exports = EventEmitter;
// Backwards-compat with node 0.10.x
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._maxListeners = undefined;
// By default EventEmitters will print a warning if more than 10 listeners are
// added to it. This is a useful default which helps finding memory leaks.
EventEmitter.defaultMaxListeners = 10;
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.setMaxListeners = function(n) {
if (!isNumber(n) || n < 0 || isNaN(n))
throw TypeError('n must be a positive number');
this._maxListeners = n;
return this;
};
EventEmitter.prototype.emit = function(type) {
var er, handler, len, args, i, listeners;
if (!this._events)
this._events = {};
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._events.error ||
(isObject(this._events.error) && !this._events.error.length)) {
er = arguments[1];
if (er instanceof Error) {
throw er; // Unhandled 'error' event
}
throw TypeError('Uncaught, unspecified "error" event.');
}
}
handler = this._events[type];
if (isUndefined(handler))
return false;
if (isFunction(handler)) {
switch (arguments.length) {
// fast cases
case 1:
handler.call(this);
break;
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
len = arguments.length;
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
handler.apply(this, args);
}
} else if (isObject(handler)) {
len = arguments.length;
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
listeners = handler.slice();
len = listeners.length;
for (i = 0; i < len; i++)
listeners[i].apply(this, args);
}
return true;
};
EventEmitter.prototype.addListener = function(type, listener) {
var m;
if (!isFunction(listener))
throw TypeError('listener must be a function');
if (!this._events)
this._events = {};
// To avoid recursion in the case that type === "newListener"! Before
// adding it to the listeners, first emit "newListener".
if (this._events.newListener)
this.emit('newListener', type,
isFunction(listener.listener) ?
listener.listener : listener);
if (!this._events[type])
// Optimize the case of one listener. Don't need the extra array object.
this._events[type] = listener;
else if (isObject(this._events[type]))
// If we've already got an array, just append.
this._events[type].push(listener);
else
// Adding the second element, need to change to array.
this._events[type] = [this._events[type], listener];
// Check for listener leak
if (isObject(this._events[type]) && !this._events[type].warned) {
var m;
if (!isUndefined(this._maxListeners)) {
m = this._maxListeners;
} else {
m = EventEmitter.defaultMaxListeners;
}
if (m && m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length);
if (typeof console.trace === 'function') {
// not supported in IE 10
console.trace();
}
}
}
return this;
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.once = function(type, listener) {
if (!isFunction(listener))
throw TypeError('listener must be a function');
var fired = false;
function g() {
this.removeListener(type, g);
if (!fired) {
fired = true;
listener.apply(this, arguments);
}
}
g.listener = listener;
this.on(type, g);
return this;
};
// emits a 'removeListener' event iff the listener was removed
EventEmitter.prototype.removeListener = function(type, listener) {
var list, position, length, i;
if (!isFunction(listener))
throw TypeError('listener must be a function');
if (!this._events || !this._events[type])
return this;
list = this._events[type];
length = list.length;
position = -1;
if (list === listener ||
(isFunction(list.listener) && list.listener === listener)) {
delete this._events[type];
if (this._events.removeListener)
this.emit('removeListener', type, listener);
} else if (isObject(list)) {
for (i = length; i-- > 0;) {
if (list[i] === listener ||
(list[i].listener && list[i].listener === listener)) {
position = i;
break;
}
}
if (position < 0)
return this;
if (list.length === 1) {
list.length = 0;
delete this._events[type];
} else {
list.splice(position, 1);
}
if (this._events.removeListener)
this.emit('removeListener', type, listener);
}
return this;
};
EventEmitter.prototype.removeAllListeners = function(type) {
var key, listeners;
if (!this._events)
return this;
// not listening for removeListener, no need to emit
if (!this._events.removeListener) {
if (arguments.length === 0)
this._events = {};
else if (this._events[type])
delete this._events[type];
return this;
}
// emit removeListener for all listeners on all events
if (arguments.length === 0) {
for (key in this._events) {
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = {};
return this;
}
listeners = this._events[type];
if (isFunction(listeners)) {
this.removeListener(type, listeners);
} else {
// LIFO order
while (listeners.length)
this.removeListener(type, listeners[listeners.length - 1]);
}
delete this._events[type];
return this;
};
EventEmitter.prototype.listeners = function(type) {
var ret;
if (!this._events || !this._events[type])
ret = [];
else if (isFunction(this._events[type]))
ret = [this._events[type]];
else
ret = this._events[type].slice();
return ret;
};
EventEmitter.listenerCount = function(emitter, type) {
var ret;
if (!emitter._events || !emitter._events[type])
ret = 0;
else if (isFunction(emitter._events[type]))
ret = 1;
else
ret = emitter._events[type].length;
return ret;
};
function isFunction(arg) {
return typeof arg === 'function';
}
function isNumber(arg) {
return typeof arg === 'number';
}
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
function isUndefined(arg) {
return arg === void 0;
}
},{}]},{},[1])(1)
});

View File

@ -1,628 +0,0 @@
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.desktopsharing=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/* global $, alert, changeLocalVideo, chrome, config, getConferenceHandler, getUserMediaWithConstraints */
/**
* Indicates that desktop stream is currently in use(for toggle purpose).
* @type {boolean}
*/
var isUsingScreenStream = false;
/**
* Indicates that switch stream operation is in progress and prevent from triggering new events.
* @type {boolean}
*/
var switchInProgress = false;
/**
* Method used to get screen sharing stream.
*
* @type {function (stream_callback, failure_callback}
*/
var obtainDesktopStream = null;
/**
* Flag used to cache desktop sharing enabled state. Do not use directly as it can be <tt>null</tt>.
* @type {null|boolean}
*/
var _desktopSharingEnabled = null;
var EventEmitter = require("events");
var eventEmitter = new EventEmitter();
/**
* Method obtains desktop stream from WebRTC 'screen' source.
* Flag 'chrome://flags/#enable-usermedia-screen-capture' must be enabled.
*/
function obtainWebRTCScreen(streamCallback, failCallback) {
RTC.getUserMediaWithConstraints(
['screen'],
streamCallback,
failCallback
);
}
/**
* Constructs inline install URL for Chrome desktop streaming extension.
* The 'chromeExtensionId' must be defined in config.js.
* @returns {string}
*/
function getWebStoreInstallUrl()
{
return "https://chrome.google.com/webstore/detail/" + config.chromeExtensionId;
}
/**
* Checks whether extension update is required.
* @param minVersion minimal required version
* @param extVersion current extension version
* @returns {boolean}
*/
function isUpdateRequired(minVersion, extVersion)
{
try
{
var s1 = minVersion.split('.');
var s2 = extVersion.split('.');
var len = Math.max(s1.length, s2.length);
for (var i = 0; i < len; i++)
{
var n1 = 0,
n2 = 0;
if (i < s1.length)
n1 = parseInt(s1[i]);
if (i < s2.length)
n2 = parseInt(s2[i]);
if (isNaN(n1) || isNaN(n2))
{
return true;
}
else if (n1 !== n2)
{
return n1 > n2;
}
}
// will happen if boths version has identical numbers in
// their components (even if one of them is longer, has more components)
return false;
}
catch (e)
{
console.error("Failed to parse extension version", e);
UI.messageHandler.showError('Error',
'Error when trying to detect desktopsharing extension.');
return true;
}
}
function checkExtInstalled(isInstalledCallback) {
if (!chrome.runtime) {
// No API, so no extension for sure
isInstalledCallback(false);
return;
}
chrome.runtime.sendMessage(
config.chromeExtensionId,
{ getVersion: true },
function (response) {
if (!response || !response.version) {
// Communication failure - assume that no endpoint exists
console.warn("Extension not installed?: " + chrome.runtime.lastError);
isInstalledCallback(false);
} else {
// Check installed extension version
var extVersion = response.version;
console.log('Extension version is: ' + extVersion);
var updateRequired = isUpdateRequired(config.minChromeExtVersion, extVersion);
if (updateRequired) {
alert(
'Jitsi Desktop Streamer requires update. ' +
'Changes will take effect after next Chrome restart.');
}
isInstalledCallback(!updateRequired);
}
}
);
}
function doGetStreamFromExtension(streamCallback, failCallback) {
// Sends 'getStream' msg to the extension. Extension id must be defined in the config.
chrome.runtime.sendMessage(
config.chromeExtensionId,
{ getStream: true, sources: config.desktopSharingSources },
function (response) {
if (!response) {
failCallback(chrome.runtime.lastError);
return;
}
console.log("Response from extension: " + response);
if (response.streamId) {
RTC.getUserMediaWithConstraints(
['desktop'],
function (stream) {
streamCallback(stream);
},
failCallback,
null, null, null,
response.streamId);
} else {
failCallback("Extension failed to get the stream");
}
}
);
}
/**
* Asks Chrome extension to call chooseDesktopMedia and gets chrome 'desktop' stream for returned stream token.
*/
function obtainScreenFromExtension(streamCallback, failCallback) {
checkExtInstalled(
function (isInstalled) {
if (isInstalled) {
doGetStreamFromExtension(streamCallback, failCallback);
} else {
chrome.webstore.install(
getWebStoreInstallUrl(),
function (arg) {
console.log("Extension installed successfully", arg);
// We need to reload the page in order to get the access to chrome.runtime
window.location.reload(false);
},
function (arg) {
console.log("Failed to install the extension", arg);
failCallback(arg);
UI.messageHandler.showError('Error',
'Failed to install desktop sharing extension');
}
);
}
}
);
}
/**
* Call this method to toggle desktop sharing feature.
* @param method pass "ext" to use chrome extension for desktop capture(chrome extension required),
* pass "webrtc" to use WebRTC "screen" desktop source('chrome://flags/#enable-usermedia-screen-capture'
* must be enabled), pass any other string or nothing in order to disable this feature completely.
*/
function setDesktopSharing(method) {
// Check if we are running chrome
if (!navigator.webkitGetUserMedia) {
obtainDesktopStream = null;
console.info("Desktop sharing disabled");
} else if (method == "ext") {
obtainDesktopStream = obtainScreenFromExtension;
console.info("Using Chrome extension for desktop sharing");
} else if (method == "webrtc") {
obtainDesktopStream = obtainWebRTCScreen;
console.info("Using Chrome WebRTC for desktop sharing");
}
// Reset enabled cache
_desktopSharingEnabled = null;
}
/**
* Initializes <link rel=chrome-webstore-item /> with extension id set in config.js to support inline installs.
* Host site must be selected as main website of published extension.
*/
function initInlineInstalls()
{
$("link[rel=chrome-webstore-item]").attr("href", getWebStoreInstallUrl());
}
function getSwitchStreamFailed(error) {
console.error("Failed to obtain the stream to switch to", error);
switchInProgress = false;
}
function streamSwitchDone() {
switchInProgress = false;
eventEmitter.emit(
DesktopSharingEventTypes.SWITCHING_DONE,
isUsingScreenStream);
}
function newStreamCreated(stream)
{
eventEmitter.emit(DesktopSharingEventTypes.NEW_STREAM_CREATED,
stream, isUsingScreenStream, streamSwitchDone);
}
module.exports = {
isUsingScreenStream: function () {
return isUsingScreenStream;
},
/**
* @returns {boolean} <tt>true</tt> if desktop sharing feature is available and enabled.
*/
isDesktopSharingEnabled: function () {
if (_desktopSharingEnabled === null) {
if (obtainDesktopStream === obtainScreenFromExtension) {
// Parse chrome version
var userAgent = navigator.userAgent.toLowerCase();
// We can assume that user agent is chrome, because it's enforced when 'ext' streaming method is set
var ver = parseInt(userAgent.match(/chrome\/(\d+)\./)[1], 10);
console.log("Chrome version" + userAgent, ver);
_desktopSharingEnabled = ver >= 34;
} else {
_desktopSharingEnabled = obtainDesktopStream === obtainWebRTCScreen;
}
}
return _desktopSharingEnabled;
},
init: function () {
setDesktopSharing(config.desktopSharing);
// Initialize Chrome extension inline installs
if (config.chromeExtensionId) {
initInlineInstalls();
}
eventEmitter.emit(DesktopSharingEventTypes.INIT);
},
addListener: function(listener, type)
{
eventEmitter.on(type, listener);
},
removeListener: function (listener,type) {
eventEmitter.removeListener(type, listener);
},
/*
* Toggles screen sharing.
*/
toggleScreenSharing: function () {
if (switchInProgress || !obtainDesktopStream) {
console.warn("Switch in progress or no method defined");
return;
}
switchInProgress = true;
if (!isUsingScreenStream)
{
// Switch to desktop stream
obtainDesktopStream(
function (stream) {
// We now use screen stream
isUsingScreenStream = true;
// Hook 'ended' event to restore camera when screen stream stops
stream.addEventListener('ended',
function (e) {
if (!switchInProgress && isUsingScreenStream) {
toggleScreenSharing();
}
}
);
newStreamCreated(stream);
},
getSwitchStreamFailed);
} else {
// Disable screen stream
RTC.getUserMediaWithConstraints(
['video'],
function (stream) {
// We are now using camera stream
isUsingScreenStream = false;
newStreamCreated(stream);
},
getSwitchStreamFailed, config.resolution || '360'
);
}
}
};
},{"events":2}],2:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
function EventEmitter() {
this._events = this._events || {};
this._maxListeners = this._maxListeners || undefined;
}
module.exports = EventEmitter;
// Backwards-compat with node 0.10.x
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._maxListeners = undefined;
// By default EventEmitters will print a warning if more than 10 listeners are
// added to it. This is a useful default which helps finding memory leaks.
EventEmitter.defaultMaxListeners = 10;
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.setMaxListeners = function(n) {
if (!isNumber(n) || n < 0 || isNaN(n))
throw TypeError('n must be a positive number');
this._maxListeners = n;
return this;
};
EventEmitter.prototype.emit = function(type) {
var er, handler, len, args, i, listeners;
if (!this._events)
this._events = {};
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._events.error ||
(isObject(this._events.error) && !this._events.error.length)) {
er = arguments[1];
if (er instanceof Error) {
throw er; // Unhandled 'error' event
}
throw TypeError('Uncaught, unspecified "error" event.');
}
}
handler = this._events[type];
if (isUndefined(handler))
return false;
if (isFunction(handler)) {
switch (arguments.length) {
// fast cases
case 1:
handler.call(this);
break;
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
len = arguments.length;
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
handler.apply(this, args);
}
} else if (isObject(handler)) {
len = arguments.length;
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
listeners = handler.slice();
len = listeners.length;
for (i = 0; i < len; i++)
listeners[i].apply(this, args);
}
return true;
};
EventEmitter.prototype.addListener = function(type, listener) {
var m;
if (!isFunction(listener))
throw TypeError('listener must be a function');
if (!this._events)
this._events = {};
// To avoid recursion in the case that type === "newListener"! Before
// adding it to the listeners, first emit "newListener".
if (this._events.newListener)
this.emit('newListener', type,
isFunction(listener.listener) ?
listener.listener : listener);
if (!this._events[type])
// Optimize the case of one listener. Don't need the extra array object.
this._events[type] = listener;
else if (isObject(this._events[type]))
// If we've already got an array, just append.
this._events[type].push(listener);
else
// Adding the second element, need to change to array.
this._events[type] = [this._events[type], listener];
// Check for listener leak
if (isObject(this._events[type]) && !this._events[type].warned) {
var m;
if (!isUndefined(this._maxListeners)) {
m = this._maxListeners;
} else {
m = EventEmitter.defaultMaxListeners;
}
if (m && m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length);
if (typeof console.trace === 'function') {
// not supported in IE 10
console.trace();
}
}
}
return this;
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.once = function(type, listener) {
if (!isFunction(listener))
throw TypeError('listener must be a function');
var fired = false;
function g() {
this.removeListener(type, g);
if (!fired) {
fired = true;
listener.apply(this, arguments);
}
}
g.listener = listener;
this.on(type, g);
return this;
};
// emits a 'removeListener' event iff the listener was removed
EventEmitter.prototype.removeListener = function(type, listener) {
var list, position, length, i;
if (!isFunction(listener))
throw TypeError('listener must be a function');
if (!this._events || !this._events[type])
return this;
list = this._events[type];
length = list.length;
position = -1;
if (list === listener ||
(isFunction(list.listener) && list.listener === listener)) {
delete this._events[type];
if (this._events.removeListener)
this.emit('removeListener', type, listener);
} else if (isObject(list)) {
for (i = length; i-- > 0;) {
if (list[i] === listener ||
(list[i].listener && list[i].listener === listener)) {
position = i;
break;
}
}
if (position < 0)
return this;
if (list.length === 1) {
list.length = 0;
delete this._events[type];
} else {
list.splice(position, 1);
}
if (this._events.removeListener)
this.emit('removeListener', type, listener);
}
return this;
};
EventEmitter.prototype.removeAllListeners = function(type) {
var key, listeners;
if (!this._events)
return this;
// not listening for removeListener, no need to emit
if (!this._events.removeListener) {
if (arguments.length === 0)
this._events = {};
else if (this._events[type])
delete this._events[type];
return this;
}
// emit removeListener for all listeners on all events
if (arguments.length === 0) {
for (key in this._events) {
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = {};
return this;
}
listeners = this._events[type];
if (isFunction(listeners)) {
this.removeListener(type, listeners);
} else {
// LIFO order
while (listeners.length)
this.removeListener(type, listeners[listeners.length - 1]);
}
delete this._events[type];
return this;
};
EventEmitter.prototype.listeners = function(type) {
var ret;
if (!this._events || !this._events[type])
ret = [];
else if (isFunction(this._events[type]))
ret = [this._events[type]];
else
ret = this._events[type].slice();
return ret;
};
EventEmitter.listenerCount = function(emitter, type) {
var ret;
if (!emitter._events || !emitter._events[type])
ret = 0;
else if (isFunction(emitter._events[type]))
ret = 1;
else
ret = emitter._events[type].length;
return ret;
};
function isFunction(arg) {
return typeof arg === 'function';
}
function isNumber(arg) {
return typeof arg === 'number';
}
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
function isUndefined(arg) {
return arg === void 0;
}
},{}]},{},[1])(1)
});

View File

@ -1,95 +0,0 @@
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o;"undefined"!=typeof window?o=window:"undefined"!=typeof global?o=global:"undefined"!=typeof self&&(o=self),o.keyboardshortcut=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
//maps keycode to character, id of popover for given function and function
var shortcuts = {
67: {
character: "C",
id: "toggleChatPopover",
function: UI.toggleChat
},
70: {
character: "F",
id: "filmstripPopover",
function: UI.toggleFilmStrip
},
77: {
character: "M",
id: "mutePopover",
function: UI.toggleAudio
},
84: {
character: "T",
function: function() {
if(!RTC.localAudio.isMuted()) {
UI.toggleAudio();
}
}
},
86: {
character: "V",
id: "toggleVideoPopover",
function: UI.toggleVideo
}
};
var KeyboardShortcut = {
init: function () {
window.onkeyup = function(e) {
var keycode = e.which;
if(!($(":focus").is("input[type=text]") ||
$(":focus").is("input[type=password]") ||
$(":focus").is("textarea"))) {
if (typeof shortcuts[keycode] === "object") {
shortcuts[keycode].function();
}
else if (keycode >= "0".charCodeAt(0) &&
keycode <= "9".charCodeAt(0)) {
UI.clickOnVideo(keycode - "0".charCodeAt(0) + 1);
}
//esc while the smileys are visible hides them
} else if (keycode === 27 && $('#smileysContainer').is(':visible')) {
UI.toggleSmileys();
}
};
window.onkeydown = function(e) {
if(!($(":focus").is("input[type=text]") ||
$(":focus").is("input[type=password]") ||
$(":focus").is("textarea"))) {
if(e.which === "T".charCodeAt(0)) {
if(RTC.localAudio.isMuted()) {
UI.toggleAudio();
}
}
}
};
var self = this;
$('body').popover({ selector: '[data-toggle=popover]',
trigger: 'click hover',
content: function() {
return this.getAttribute("content") +
self.getShortcut(this.getAttribute("shortcut"));
}
});
},
/**
*
* @param id indicates the popover associated with the shortcut
* @returns {string} the keyboard shortcut used for the id given
*/
getShortcut: function (id) {
for (var keycode in shortcuts) {
if (shortcuts.hasOwnProperty(keycode)) {
if (shortcuts[keycode].id === id) {
return " (" + shortcuts[keycode].character + ")";
}
}
}
return "";
}
};
module.exports = KeyboardShortcut;
},{}]},{},[1])(1)
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
* applications that embed Jitsi Meet
*/
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
/**
* List of the available commands.
@ -17,12 +17,12 @@
*/
var commands =
{
displayName: UI.inputDisplayNameHandler,
muteAudio: UI.toggleAudio,
muteVideo: UI.toggleVideo,
toggleFilmStrip: UI.toggleFilmStrip,
toggleChat: UI.toggleChat,
toggleContactList: UI.toggleContactList
displayName: APP.UI.inputDisplayNameHandler,
muteAudio: APP.UI.toggleAudio,
muteVideo: APP.UI.toggleVideo,
toggleFilmStrip: APP.UI.toggleFilmStrip,
toggleChat: APP.UI.toggleChat,
toggleContactList: APP.UI.toggleContactList
};
@ -135,26 +135,26 @@ function processMessage(event)
}
function setupListeners() {
xmpp.addListener(XMPPEvents.MUC_ENTER, function (from) {
APP.xmpp.addListener(XMPPEvents.MUC_ENTER, function (from) {
API.triggerEvent("participantJoined", {jid: from});
});
xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, function (from, nick, txt, myjid) {
APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, function (from, nick, txt, myjid) {
if (from != myjid)
API.triggerEvent("incomingMessage",
{"from": from, "nick": nick, "message": txt});
});
xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) {
APP.xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) {
API.triggerEvent("participantLeft", {jid: jid});
});
xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) {
APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) {
name = displayName[jid];
if(!name || name != newDisplayName) {
API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName});
displayName[jid] = newDisplayName;
}
});
xmpp.addListener(XMPPEvents.SENDING_CHAT_MESSAGE, function (body) {
API.triggerEvent("outgoingMessage", {"message": body});
APP.xmpp.addListener(XMPPEvents.SENDING_CHAT_MESSAGE, function (body) {
APP.API.triggerEvent("outgoingMessage", {"message": body});
});
}

View File

@ -2,11 +2,14 @@
// cache datachannels to avoid garbage collection
// https://code.google.com/p/chromium/issues/detail?id=405545
var RTCEvents = require("../../service/RTC/RTCEvents");
var _dataChannels = [];
var eventEmitter = null;
var DataChannels =
{
@ -33,7 +36,7 @@ var DataChannels =
// selections so that it can do adaptive simulcast,
// we want the notification to trigger even if userJid is undefined,
// or null.
var userJid = UI.getLargeVideoState().userJid;
var userJid = APP.UI.getLargeVideoState().userJid;
// we want the notification to trigger even if userJid is undefined,
// or null.
onSelectedEndpointChanged(userJid);
@ -67,7 +70,7 @@ var DataChannels =
console.info(
"Data channel new dominant speaker event: ",
dominantSpeakerEndpoint);
eventEmitter.emit(RTC.DOMINANTSPEAKER_CHANGED, dominantSpeakerEndpoint);
eventEmitter.emit(RTCEvents.DOMINANTSPEAKER_CHANGED, dominantSpeakerEndpoint);
}
else if ("InLastNChangeEvent" === colibriClass)
{

View File

@ -1,4 +1,4 @@
//var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
function LocalStream(stream, type, eventEmitter, videoType)
{

View File

@ -1,7 +1,6 @@
////These lines should be uncommented when require works in app.js
//var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
//var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
//var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
/**
* Creates a MediaStream object for the given data, session id and ssrc.

View File

@ -3,9 +3,12 @@ var RTCUtils = require("./RTCUtils.js");
var LocalStream = require("./LocalStream.js");
var DataChannels = require("./DataChannels");
var MediaStream = require("./MediaStream.js");
//These lines should be uncommented when require works in app.js
//var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
//var XMPPEvents = require("../service/xmpp/XMPPEvents");
var DesktopSharingEventTypes
= require("../../service/desktopsharing/DesktopSharingEventTypes");
var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
var UIEvents = require("../../service/UI/UIEvents");
var eventEmitter = new EventEmitter();
@ -61,7 +64,7 @@ var RTC = {
createRemoteStream: function (data, sid, thessrc) {
var remoteStream = new MediaStream(data, sid, thessrc,
this.getBrowserType());
var jid = data.peerjid || xmpp.myJid();
var jid = data.peerjid || APP.xmpp.myJid();
if(!this.remoteStreams[jid]) {
this.remoteStreams[jid] = {};
}
@ -105,11 +108,11 @@ var RTC = {
},
start: function () {
var self = this;
desktopsharing.addListener(
APP.desktopsharing.addListener(
function (stream, isUsingScreenStream, callback) {
self.changeLocalVideo(stream, isUsingScreenStream, callback);
}, DesktopSharingEventTypes.NEW_STREAM_CREATED);
xmpp.addListener(XMPPEvents.CHANGED_STREAMS, function (jid, changedStreams) {
APP.xmpp.addListener(XMPPEvents.CHANGED_STREAMS, function (jid, changedStreams) {
for(var i = 0; i < changedStreams.length; i++) {
var type = changedStreams[i].type;
if (type != "audio") {
@ -123,12 +126,12 @@ var RTC = {
}
}
});
xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {
APP.xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {
DataChannels.init(event.peerconnection, eventEmitter);
});
UI.addListener(UIEvents.SELECTED_ENDPOINT,
APP.UI.addListener(UIEvents.SELECTED_ENDPOINT,
DataChannels.handleSelectedEndpointEvent);
UI.addListener(UIEvents.PINNED_ENDPOINT,
APP.UI.addListener(UIEvents.PINNED_ENDPOINT,
DataChannels.handlePinnedEndpointEvent);
this.rtcUtils = new RTCUtils(this);
this.rtcUtils.obtainAudioAndVideoPermissions();
@ -164,10 +167,10 @@ var RTC = {
changeLocalVideo: function (stream, isUsingScreenStream, callback) {
var oldStream = this.localVideo.getOriginalStream();
var type = (isUsingScreenStream? "screen" : "video");
RTC.localVideo = this.createLocalStream(stream, "video", true, type);
this.localVideo = this.createLocalStream(stream, "video", true, type);
// Stop the stream to trigger onended event for old stream
oldStream.stop();
xmpp.switchStreams(stream, oldStream,callback);
APP.xmpp.switchStreams(stream, oldStream,callback);
},
/**
* Checks if video identified by given src is desktop stream.
@ -180,8 +183,8 @@ var RTC = {
return false;
var isDesktop = false;
var stream = null;
if (xmpp.myJid() &&
xmpp.myResource() === jid) {
if (APP.xmpp.myJid() &&
APP.xmpp.myResource() === jid) {
// local video
stream = this.localVideo;
} else {

View File

@ -1,5 +1,4 @@
//This should be uncommented when app.js supports require
//var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
function setResolutionConstraints(constraints, resolution, isAndroid)
{
@ -236,7 +235,7 @@ RTCUtils.prototype.getUserMediaWithConstraints = function(
// We currently do not support FF, as it doesn't have multistream support.
&& !isFF) {
simulcast.getUserMedia(constraints, function (stream) {
APP.simulcast.getUserMedia(constraints, function (stream) {
console.log('onUserMediaSuccess');
success_callback(stream);
},
@ -292,7 +291,7 @@ RTCUtils.prototype.obtainAudioAndVideoPermissions = function() {
cb,
function (error) {
console.error('failed to obtain audio/video stream - stop', error);
UI.messageHandler.showError("Error",
APP.UI.messageHandler.showError("Error",
"Failed to obtain permissions to use the local microphone" +
"and/or camera.");
}

View File

@ -20,6 +20,12 @@ var messageHandler = UI.messageHandler;
var Authentication = require("./authentication/Authentication");
var UIUtil = require("./util/UIUtil");
var NicknameHandler = require("./util/NicknameHandler");
var CQEvents = require("../../service/connectionquality/CQEvents");
var DesktopSharingEventTypes
= require("../../service/desktopsharing/DesktopSharingEventTypes");
var RTCEvents = require("../../service/RTC/RTCEvents");
var StreamEventTypes = require("../../service/RTC/StreamEventTypes");
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
var eventEmitter = new EventEmitter();
var roomName = null;
@ -73,38 +79,38 @@ function onDisplayNameChanged(jid, displayName) {
}
function registerListeners() {
RTC.addStreamListener(streamHandler, StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
APP.RTC.addStreamListener(streamHandler, StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
RTC.addStreamListener(streamHandler, StreamEventTypes.EVENT_TYPE_LOCAL_CHANGED);
RTC.addStreamListener(function (stream) {
APP.RTC.addStreamListener(streamHandler, StreamEventTypes.EVENT_TYPE_LOCAL_CHANGED);
APP.RTC.addStreamListener(function (stream) {
VideoLayout.onRemoteStreamAdded(stream);
}, StreamEventTypes.EVENT_TYPE_REMOTE_CREATED);
RTC.addListener(RTCEvents.LASTN_CHANGED, onLastNChanged);
RTC.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (resourceJid) {
APP.RTC.addListener(RTCEvents.LASTN_CHANGED, onLastNChanged);
APP.RTC.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (resourceJid) {
VideoLayout.onDominantSpeakerChanged(resourceJid);
});
RTC.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
APP.RTC.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
function (lastNEndpoints, endpointsEnteringLastN, stream) {
VideoLayout.onLastNEndpointsChanged(lastNEndpoints,
endpointsEnteringLastN, stream);
});
RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
APP.RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
function (endpointSimulcastLayers) {
VideoLayout.onSimulcastLayersChanged(endpointSimulcastLayers);
});
RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGING,
APP.RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGING,
function (endpointSimulcastLayers) {
VideoLayout.onSimulcastLayersChanging(endpointSimulcastLayers);
});
VideoLayout.init(eventEmitter);
statistics.addAudioLevelListener(function(jid, audioLevel)
APP.statistics.addAudioLevelListener(function(jid, audioLevel)
{
var resourceJid;
if(jid === statistics.LOCAL_JID)
if(jid === APP.statistics.LOCAL_JID)
{
resourceJid = AudioLevels.LOCAL_LEVEL;
if(RTC.localAudio.isMuted())
if(APP.RTC.localAudio.isMuted())
{
audioLevel = 0;
}
@ -117,23 +123,31 @@ function registerListeners() {
AudioLevels.updateAudioLevel(resourceJid, audioLevel,
UI.getLargeVideoState().userResourceJid);
});
desktopsharing.addListener(function () {
APP.desktopsharing.addListener(function () {
ToolbarToggler.showDesktopSharingButton();
}, DesktopSharingEventTypes.INIT);
desktopsharing.addListener(
APP.desktopsharing.addListener(
Toolbar.changeDesktopSharingButtonState,
DesktopSharingEventTypes.SWITCHING_DONE);
xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
xmpp.addListener(XMPPEvents.KICKED, function () {
APP.connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,
VideoLayout.updateLocalConnectionStats);
APP.connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,
VideoLayout.updateConnectionStats);
APP.connectionquality.addListener(CQEvents.STOP,
VideoLayout.onStatsStop);
APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
APP.xmpp.addListener(XMPPEvents.KICKED, function () {
messageHandler.openMessageDialog("Session Terminated",
"Ouch! You have been kicked out of the meet!");
});
xmpp.addListener(XMPPEvents.BRIDGE_DOWN, function () {
APP.xmpp.addListener(XMPPEvents.BRIDGE_DOWN, function () {
messageHandler.showError("Error",
"Jitsi Videobridge is currently unavailable. Please try again later!");
});
xmpp.addListener(XMPPEvents.USER_ID_CHANGED, Avatar.setUserAvatar);
xmpp.addListener(XMPPEvents.CHANGED_STREAMS, function (jid, changedStreams) {
APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
Avatar.setUserAvatar(from, id);
});
APP.xmpp.addListener(XMPPEvents.CHANGED_STREAMS, function (jid, changedStreams) {
for(stream in changedStreams)
{
// might need to update the direction if participant just went from sendrecv to recvonly
@ -153,29 +167,53 @@ function registerListeners() {
}
});
xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, onDisplayNameChanged);
xmpp.addListener(XMPPEvents.MUC_JOINED, onMucJoined);
xmpp.addListener(XMPPEvents.LOCALROLE_CHANGED, onLocalRoleChange);
xmpp.addListener(XMPPEvents.MUC_ENTER, onMucEntered);
xmpp.addListener(XMPPEvents.MUC_ROLE_CHANGED, onMucRoleChanged);
xmpp.addListener(XMPPEvents.PRESENCE_STATUS, onMucPresenceStatus);
xmpp.addListener(XMPPEvents.SUBJECT_CHANGED, chatSetSubject);
xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, updateChatConversation);
xmpp.addListener(XMPPEvents.MUC_LEFT, onMucLeft);
xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, onPasswordReqiured);
xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError);
xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad);
connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,
VideoLayout.updateLocalConnectionStats);
connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,
VideoLayout.updateConnectionStats);
connectionquality.addListener(CQEvents.STOP,
VideoLayout.onStatsStop);
xmpp.addListener(XMPPEvents.AUTHENTICATION_REQUIRED, onAuthenticationRequired);
APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, onDisplayNameChanged);
APP.xmpp.addListener(XMPPEvents.MUC_JOINED, onMucJoined);
APP.xmpp.addListener(XMPPEvents.LOCALROLE_CHANGED, onLocalRoleChange);
APP.xmpp.addListener(XMPPEvents.MUC_ENTER, onMucEntered);
APP.xmpp.addListener(XMPPEvents.MUC_ROLE_CHANGED, onMucRoleChanged);
APP.xmpp.addListener(XMPPEvents.PRESENCE_STATUS, onMucPresenceStatus);
APP.xmpp.addListener(XMPPEvents.SUBJECT_CHANGED, chatSetSubject);
APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, updateChatConversation);
APP.xmpp.addListener(XMPPEvents.MUC_LEFT, onMucLeft);
APP.xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, onPasswordReqiured);
APP.xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError);
APP.xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad);
APP.xmpp.addListener(XMPPEvents.AUTHENTICATION_REQUIRED, onAuthenticationRequired);
}
/**
* Mutes/unmutes the local video.
*
* @param mute <tt>true</tt> to mute the local video; otherwise, <tt>false</tt>
* @param options an object which specifies optional arguments such as the
* <tt>boolean</tt> key <tt>byUser</tt> with default value <tt>true</tt> which
* specifies whether the method was initiated in response to a user command (in
* contrast to an automatic decision taken by the application logic)
*/
function setVideoMute(mute, options) {
APP.xmpp.setVideoMute(
mute,
function (mute) {
var video = $('#video');
var communicativeClass = "icon-camera";
var muteClass = "icon-camera icon-camera-disabled";
if (mute) {
video.removeClass(communicativeClass);
video.addClass(muteClass);
} else {
video.removeClass(muteClass);
video.addClass(communicativeClass);
}
},
options);
}
function bindEvents()
{
/**
@ -194,7 +232,7 @@ function bindEvents()
});
}
UI.start = function () {
UI.start = function (init) {
document.title = interfaceConfig.APP_NAME;
if(config.enableWelcomePage && window.location.pathname == "/" &&
(!window.localStorage.welcomePageDisabled || window.localStorage.welcomePageDisabled == "false"))
@ -314,10 +352,6 @@ UI.start = function () {
};
UI.toggleSmileys = function () {
Chat.toggleSmileys();
};
function chatAddError(errorMessage, originalText)
{
return Chat.chatAddError(errorMessage, originalText);
@ -347,7 +381,7 @@ function onMucJoined(jid, info) {
// Show authenticate button if needed
Toolbar.showAuthenticateButton(
xmpp.isExternalAuthEnabled() && !xmpp.isModerator());
APP.xmpp.isExternalAuthEnabled() && !APP.xmpp.isModerator());
var displayName = !config.displayJids
? info.displayName : Strophe.getResourceFromJid(jid);
@ -485,6 +519,11 @@ function onLastNChanged(oldValue, newValue) {
}
}
UI.toggleSmileys = function () {
Chat.toggleSmileys();
};
UI.getSettings = function () {
return Settings.getSettings();
};
@ -501,10 +540,6 @@ UI.toggleContactList = function () {
return BottomToolbar.toggleContactList();
};
UI.setRecordingButtonState = function (state) {
Toolbar.setRecordingButtonState(state);
};
UI.inputDisplayNameHandler = function (value) {
VideoLayout.inputDisplayNameHandler(value);
};
@ -515,10 +550,6 @@ UI.getLargeVideoState = function()
return VideoLayout.getLargeVideoState();
};
UI.showLocalAudioIndicator = function (mute) {
VideoLayout.showLocalAudioIndicator(mute);
};
UI.generateRoomName = function() {
if(roomName)
return roomName;
@ -560,19 +591,15 @@ UI.connectionIndicatorShowMore = function(id)
return VideoLayout.connectionIndicators[id].showMore();
};
UI.showToolbar = function () {
return ToolbarToggler.showToolbar();
};
UI.dockToolbar = function (isDock) {
return ToolbarToggler.dockToolbar(isDock);
};
UI.getCreadentials = function () {
var settings = this.getSettings();
return {
bosh: document.getElementById('boshURL').value,
password: document.getElementById('password').value,
jid: document.getElementById('jid').value
jid: document.getElementById('jid').value,
email: settings.email,
displayName: settings.displayName,
uid: settings.uid
};
};
@ -615,20 +642,20 @@ UI.checkForNicknameAndJoin = function () {
if (config.useNicks) {
nick = window.prompt('Your nickname (optional)');
}
xmpp.joinRoom(roomName, config.useNicks, nick);
}
APP.xmpp.joinRoom(roomName, config.useNicks, nick);
};
function dump(elem, filename) {
elem = elem.parentNode;
elem.download = filename || 'meetlog.json';
elem.href = 'data:application/json;charset=utf-8,\n';
var data = xmpp.populateData();
var data = APP.xmpp.populateData();
var metadata = {};
metadata.time = new Date();
metadata.url = window.location.href;
metadata.ua = navigator.userAgent;
var log = xmpp.getLogger();
var log = APP.xmpp.getLogger();
if (log) {
metadata.xmpp = log;
}
@ -639,35 +666,7 @@ function dump(elem, filename) {
UI.getRoomName = function () {
return roomName;
}
/**
* Mutes/unmutes the local video.
*
* @param mute <tt>true</tt> to mute the local video; otherwise, <tt>false</tt>
* @param options an object which specifies optional arguments such as the
* <tt>boolean</tt> key <tt>byUser</tt> with default value <tt>true</tt> which
* specifies whether the method was initiated in response to a user command (in
* contrast to an automatic decision taken by the application logic)
*/
function setVideoMute(mute, options) {
xmpp.setVideoMute(
mute,
function (mute) {
var video = $('#video');
var communicativeClass = "icon-camera";
var muteClass = "icon-camera icon-camera-disabled";
if (mute) {
video.removeClass(communicativeClass);
video.addClass(muteClass);
} else {
video.removeClass(muteClass);
video.addClass(communicativeClass);
}
},
options);
}
};
/**
* Mutes/unmutes the local video.
@ -675,14 +674,14 @@ function setVideoMute(mute, options) {
UI.toggleVideo = function () {
UIUtil.buttonClick("#video", "icon-camera icon-camera-disabled");
setVideoMute(!RTC.localVideo.isMuted());
setVideoMute(!APP.RTC.localVideo.isMuted());
};
/**
* Mutes / unmutes audio for the local participant.
*/
UI.toggleAudio = function() {
UI.setAudioMuted(!RTC.localAudio.isMuted());
UI.setAudioMuted(!APP.RTC.localAudio.isMuted());
};
/**
@ -690,8 +689,8 @@ UI.toggleAudio = function() {
*/
UI.setAudioMuted = function (mute) {
if(!xmpp.setAudioMute(mute, function () {
UI.showLocalAudioIndicator(mute);
if(!APP.xmpp.setAudioMute(mute, function () {
VideoLayout.showLocalAudioIndicator(mute);
UIUtil.buttonClick("#mute", "icon-microphone icon-mic-disabled");
}))

View File

@ -87,10 +87,10 @@ var AudioLevels = (function(my) {
drawContext.drawImage(canvasCache, 0, 0);
if(resourceJid === AudioLevels.LOCAL_LEVEL) {
if(!xmpp.myJid()) {
if(!APP.xmpp.myJid()) {
return;
}
resourceJid = xmpp.myResource();
resourceJid = APP.xmpp.myResource();
}
if(resourceJid === largeVideoResourceJid) {
@ -221,8 +221,8 @@ var AudioLevels = (function(my) {
function getVideoSpanId(resourceJid) {
var videoSpanId = null;
if (resourceJid === AudioLevels.LOCAL_LEVEL
|| (xmpp.myResource() && resourceJid
=== xmpp.myResource()))
|| (APP.xmpp.myResource() && resourceJid
=== APP.xmpp.myResource()))
videoSpanId = 'localVideoContainer';
else
videoSpanId = 'participant_' + resourceJid;

View File

@ -53,7 +53,7 @@ var Authentication = {
closeAuthenticationDialog: function () {
// Close authentication dialog if opened
if (authDialog) {
UI.messageHandler.closeDialog();
APP.UI.messageHandler.closeDialog();
authDialog = null;
}
},

View File

@ -1,4 +1,5 @@
var Settings = require("../side_pannels/settings/Settings");
var MediaStreamType = require("../../../service/RTC/MediaStreamTypes");
var users = {};
var activeSpeakerJid;
@ -12,21 +13,21 @@ function setVisibility(selector, show) {
function isUserMuted(jid) {
// XXX(gp) we may want to rename this method to something like
// isUserStreaming, for example.
if (jid && jid != xmpp.myJid()) {
if (jid && jid != APP.xmpp.myJid()) {
var resource = Strophe.getResourceFromJid(jid);
if (!require("../videolayout/VideoLayout").isInLastN(resource)) {
return true;
}
}
if (!RTC.remoteStreams[jid] || !RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE]) {
if (!APP.RTC.remoteStreams[jid] || !APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE]) {
return null;
}
return RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE].muted;
return APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE].muted;
}
function getGravatarUrl(id, size) {
if(id === xmpp.myJid() || !id) {
if(id === APP.xmpp.myJid() || !id) {
id = Settings.getSettings().uid;
}
return 'https://www.gravatar.com/avatar/' +
@ -57,7 +58,7 @@ var Avatar = {
// set the avatar in the settings menu if it is local user and get the
// local video container
if (jid === xmpp.myJid()) {
if (jid === APP.xmpp.myJid()) {
$('#avatar').get(0).src = thumbUrl;
thumbnail = $('#localVideoContainer');
}
@ -100,7 +101,7 @@ var Avatar = {
var video = $('#participant_' + resourceJid + '>video');
var avatar = $('#avatar_' + resourceJid);
if (jid === xmpp.myJid()) {
if (jid === APP.xmpp.myJid()) {
video = $('#localVideoWrapper>video');
}
if (show === undefined || show === null) {
@ -130,7 +131,7 @@ var Avatar = {
*/
updateActiveSpeakerAvatarSrc: function (jid) {
if (!jid) {
jid = xmpp.findJidFromResource(
jid = APP.xmpp.findJidFromResource(
require("../videolayout/VideoLayout").getLargeVideoState().userResourceJid);
}
var avatar = $("#activeSpeakerAvatar")[0];

View File

@ -1,4 +1,4 @@
/* global $, config, dockToolbar,
/* global $, config,
setLargeVideoVisible, Util */
var VideoLayout = require("../videolayout/VideoLayout");
@ -30,7 +30,7 @@ function resize() {
* Shares the Etherpad name with other participants.
*/
function shareEtherpad() {
xmpp.addToPresence("etherpad", etherpadName);
APP.xmpp.addToPresence("etherpad", etherpadName);
}
/**

View File

@ -31,7 +31,7 @@ var Prezi = {
* to load.
*/
openPreziDialog: function() {
var myprezi = xmpp.getPrezi();
var myprezi = APP.xmpp.getPrezi();
if (myprezi) {
messageHandler.openTwoButtonDialog("Remove Prezi",
"Are you sure you would like to remove your Prezi?",
@ -196,7 +196,7 @@ function presentationAdded(event, jid, presUrl, currentSlide) {
preziPlayer.on(PreziPlayer.EVENT_CURRENT_STEP, function(event) {
console.log("event value", event.value);
xmpp.addToPresence("preziSlide", event.value);
APP.xmpp.addToPresence("preziSlide", event.value);
});
$("#" + elementId).css( 'background-image',

View File

@ -1,10 +1,11 @@
/* global $, Util, nickname:true, showToolbar */
/* global $, Util, nickname:true */
var Replacement = require("./Replacement");
var CommandsProcessor = require("./Commands");
var ToolbarToggler = require("../../toolbars/ToolbarToggler");
var smileys = require("./smileys.json").smileys;
var NicknameHandler = require("../../util/NicknameHandler");
var UIUtil = require("../../util/UIUtil");
var UIEvents = require("../../../../service/UI/UIEvents");
var notificationInterval = false;
var unreadMessages = 0;
@ -204,7 +205,7 @@ var Chat = (function (my) {
else
{
var message = UIUtil.escapeHtml(value);
xmpp.sendChatMessage(message, NicknameHandler.getNickname());
APP.xmpp.sendChatMessage(message, NicknameHandler.getNickname());
}
}
});
@ -230,7 +231,7 @@ var Chat = (function (my) {
my.updateChatConversation = function (from, displayName, message) {
var divClassName = '';
if (xmpp.myJid() === from) {
if (APP.xmpp.myJid() === from) {
divClassName = "localuser";
}
else {

View File

@ -34,7 +34,7 @@ function getCommand(message)
function processTopic(commandArguments)
{
var topic = UIUtil.escapeHtml(commandArguments);
xmpp.setSubject(topic);
APP.xmpp.setSubject(topic);
}
/**

View File

@ -110,7 +110,7 @@ var ContactList = {
var clElement = contactlist.get(0);
if (resourceJid === xmpp.myResource()
if (resourceJid === APP.xmpp.myResource()
&& $('#contactlist>ul .title')[0].nextSibling.nextSibling) {
clElement.insertBefore(newContact,
$('#contactlist>ul .title')[0].nextSibling.nextSibling);

View File

@ -11,11 +11,11 @@ var SettingsMenu = {
if(newDisplayName) {
var displayName = Settings.setDisplayName(newDisplayName);
xmpp.addToPresence("displayName", displayName, true);
APP.xmpp.addToPresence("displayName", displayName, true);
}
xmpp.addToPresence("email", newEmail);
APP.xmpp.addToPresence("email", newEmail);
var email = Settings.setEmail(newEmail);

View File

@ -15,10 +15,10 @@ var UI = null;
var buttonHandlers =
{
"toolbar_button_mute": function () {
return UI.toggleAudio();
return APP.UI.toggleAudio();
},
"toolbar_button_camera": function () {
return UI.toggleVideo();
return APP.UI.toggleVideo();
},
"toolbar_button_authentication": function () {
return Toolbar.authenticateClicked();
@ -42,7 +42,7 @@ var buttonHandlers =
return Etherpad.toggleEtherpad(0);
},
"toolbar_button_desktopsharing": function () {
return desktopsharing.toggleScreenSharing();
return APP.desktopsharing.toggleScreenSharing();
},
"toolbar_button_fullScreen": function()
{
@ -61,7 +61,7 @@ var buttonHandlers =
};
function hangup() {
xmpp.disposeConference();
APP.xmpp.disposeConference();
if(config.enableWelcomePage)
{
setTimeout(function()
@ -91,7 +91,7 @@ function hangup() {
function toggleRecording() {
xmpp.toggleRecording(function (callback) {
UI.messageHandler.openTwoButtonDialog(null,
APP.UI.messageHandler.openTwoButtonDialog(null,
'<h2>Enter recording token</h2>' +
'<input id="recordingToken" type="text" ' +
'placeholder="token" autofocus>',
@ -235,11 +235,11 @@ var Toolbar = (function (my) {
my.authenticateClicked = function () {
Authentication.focusAuthenticationWindow();
// Get authentication URL
xmpp.getAuthUrl(UI.getRoomName(), function (url) {
APP.xmpp.getAuthUrl(APP.UI.getRoomName(), function (url) {
// Open popup with authentication URL
var authenticationWindow = Authentication.createAuthenticationWindow(function () {
// On popup closed - retry room allocation
xmpp.allocateConferenceFocus(UI.getRoomName(), UI.checkForNicknameAndJoin);
xAPP.mpp.allocateConferenceFocus(APP.UI.getRoomName(), APP.UI.checkForNicknameAndJoin);
}, url);
if (!authenticationWindow) {
Toolbar.showAuthenticateButton(true);
@ -281,7 +281,7 @@ var Toolbar = (function (my) {
*/
my.openLockDialog = function () {
// Only the focus is able to set a shared key.
if (!xmpp.isModerator()) {
if (!APP.xmpp.isModerator()) {
if (sharedKey) {
messageHandler.openMessageDialog(null,
"This conversation is currently protected by" +
@ -488,7 +488,7 @@ var Toolbar = (function (my) {
// Shows or hides SIP calls button
my.showSipCallButton = function (show) {
if (xmpp.isSipGatewayEnabled() && show) {
if (APP.xmpp.isSipGatewayEnabled() && show) {
$('#sipCallButton').css({display: "inline"});
} else {
$('#sipCallButton').css({display: "none"});

View File

@ -4,7 +4,7 @@ var toolbarTimeoutObject,
toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
function showDesktopSharingButton() {
if (desktopsharing.isDesktopSharingEnabled()) {
if (APP.desktopsharing.isDesktopSharingEnabled()) {
$('#desktopsharing').css({display: "inline"});
} else {
$('#desktopsharing').css({display: "none"});
@ -67,7 +67,7 @@ var ToolbarToggler = {
toolbarTimeout = interfaceConfig.TOOLBAR_TIMEOUT;
}
if (xmpp.isModerator())
if (APP.xmpp.isModerator())
{
// TODO: Enable settings functionality.
// Need to uncomment the settings button in index.html.

View File

@ -1,3 +1,5 @@
var UIEvents = require("../../../service/UI/UIEvents");
var nickname = null;
var eventEmitter = null;

View File

@ -103,7 +103,7 @@ ConnectionIndicator.prototype.generateText = function () {
}
else if(keys.length > 1)
{
var displayedSsrc = simulcast.getReceivingSSRC(this.jid);
var displayedSsrc = APP.simulcast.getReceivingSSRC(this.jid);
resolutionValue = this.resolution[displayedSsrc];
}
}
@ -158,7 +158,7 @@ ConnectionIndicator.prototype.generateText = function () {
if(this.videoContainer.id == "localVideoContainer")
result += "<div class=\"jitsipopover_showmore\" " +
"onclick = \"UI.connectionIndicatorShowMore('" +
"onclick = \"APP.UI.connectionIndicatorShowMore('" +
this.videoContainer.id + "')\">" +
(this.showMoreValue? "Show less" : "Show More") + "</div><br />";

View File

@ -5,6 +5,8 @@ var ContactList = require("../side_pannels/contactlist/ContactList");
var UIUtil = require("../util/UIUtil");
var ConnectionIndicator = require("./ConnectionIndicator");
var NicknameHandler = require("../util/NicknameHandler");
var MediaStreamType = require("../../../service/RTC/MediaStreamTypes");
var UIEvents = require("../../../service/UI/UIEvents");
var currentDominantSpeaker = null;
var lastNCount = config.channelLastN;
@ -61,7 +63,7 @@ function videoactive( videoelem) {
(parentResourceJid &&
VideoLayout.getDominantSpeakerResourceJid() === parentResourceJid)) {
VideoLayout.updateLargeVideo(
RTC.getVideoSrc(videoelem[0]),
APP.RTC.getVideoSrc(videoelem[0]),
1,
parentResourceJid);
}
@ -97,8 +99,8 @@ function waitForRemoteVideo(selector, ssrc, stream, jid) {
if (stream.id === 'mixedmslabel') return;
if (selector[0].currentTime > 0) {
var videoStream = simulcast.getReceivingVideoStream(stream);
RTC.attachMediaStream(selector, videoStream); // FIXME: why do i have to do this for FF?
var videoStream = APP.simulcast.getReceivingVideoStream(stream);
APP.RTC.attachMediaStream(selector, videoStream); // FIXME: why do i have to do this for FF?
videoactive(selector);
} else {
setTimeout(function () {
@ -283,7 +285,7 @@ function getParticipantContainer(resourceJid)
if (!resourceJid)
return null;
if (resourceJid === xmpp.myResource())
if (resourceJid === APP.xmpp.myResource())
return $("#localVideoContainer");
else
return $("#participant_" + resourceJid);
@ -359,7 +361,7 @@ function addRemoteVideoMenu(jid, parentElement) {
event.preventDefault();
}
var isMute = mutedAudios[jid] == true;
xmpp.setMute(jid, !isMute);
APP.xmpp.setMute(jid, !isMute);
popupmenuElement.setAttribute('style', 'display:none;');
@ -382,7 +384,7 @@ function addRemoteVideoMenu(jid, parentElement) {
var ejectLinkItem = document.createElement('a');
ejectLinkItem.innerHTML = ejectIndicator + ' Kick out';
ejectLinkItem.onclick = function(){
xmpp.eject(jid);
APP.xmpp.eject(jid);
popupmenuElement.setAttribute('style', 'display:none;');
};
@ -519,11 +521,11 @@ var VideoLayout = (function (my) {
};
my.changeLocalAudio = function(stream) {
RTC.attachMediaStream($('#localAudio'), stream.getOriginalStream());
APP.RTC.attachMediaStream($('#localAudio'), stream.getOriginalStream());
document.getElementById('localAudio').autoplay = true;
document.getElementById('localAudio').volume = 0;
if (preMuted) {
if(!UI.setAudioMuted(true))
if(!APP.UI.setAudioMuted(true))
{
preMuted = mute;
}
@ -537,7 +539,7 @@ var VideoLayout = (function (my) {
flipX = false;
var localVideo = document.createElement('video');
localVideo.id = 'localVideo_' +
RTC.getStreamID(stream.getOriginalStream());
APP.RTC.getStreamID(stream.getOriginalStream());
localVideo.autoplay = true;
localVideo.volume = 0; // is it required if audio is separated ?
localVideo.oncontextmenu = function () { return false; };
@ -556,22 +558,18 @@ var VideoLayout = (function (my) {
AudioLevels.updateAudioLevelCanvas(null, VideoLayout);
var localVideoSelector = $('#' + localVideo.id);
function localVideoClick(event) {
event.stopPropagation();
VideoLayout.handleVideoThumbClicked(
APP.RTC.getVideoSrc(localVideo),
false,
APP.xmpp.myResource());
}
// Add click handler to both video and video wrapper elements in case
// there's no video.
localVideoSelector.click(function (event) {
event.stopPropagation();
VideoLayout.handleVideoThumbClicked(
RTC.getVideoSrc(localVideo),
false,
xmpp.myResource());
});
$('#localVideoContainer').click(function (event) {
event.stopPropagation();
VideoLayout.handleVideoThumbClicked(
RTC.getVideoSrc(localVideo),
false,
xmpp.myResource());
});
localVideoSelector.click(localVideoClick);
$('#localVideoContainer').click(localVideoClick);
// Add hover handler
$('#localVideoContainer').hover(
@ -580,14 +578,14 @@ var VideoLayout = (function (my) {
},
function() {
if (!VideoLayout.isLargeVideoVisible()
|| RTC.getVideoSrc(localVideo) !== RTC.getVideoSrc($('#largeVideo')[0]))
|| APP.RTC.getVideoSrc(localVideo) !== APP.RTC.getVideoSrc($('#largeVideo')[0]))
VideoLayout.showDisplayName('localVideoContainer', false);
}
);
// Add stream ended handler
stream.getOriginalStream().onended = function () {
localVideoContainer.removeChild(localVideo);
VideoLayout.updateRemovedVideo(RTC.getVideoSrc(localVideo));
VideoLayout.updateRemovedVideo(APP.RTC.getVideoSrc(localVideo));
};
// Flip video x axis if needed
flipXLocalVideo = flipX;
@ -595,12 +593,12 @@ var VideoLayout = (function (my) {
localVideoSelector.addClass("flipVideoX");
}
// Attach WebRTC stream
var videoStream = simulcast.getLocalVideoStream();
RTC.attachMediaStream(localVideoSelector, videoStream);
var videoStream = APP.simulcast.getLocalVideoStream();
APP.RTC.attachMediaStream(localVideoSelector, videoStream);
localVideoSrc = RTC.getVideoSrc(localVideo);
localVideoSrc = APP.RTC.getVideoSrc(localVideo);
var myResourceJid = xmpp.myResource();
var myResourceJid = APP.xmpp.myResource();
VideoLayout.updateLargeVideo(localVideoSrc, 0,
myResourceJid);
@ -613,7 +611,7 @@ var VideoLayout = (function (my) {
* @param removedVideoSrc src stream identifier of the video.
*/
my.updateRemovedVideo = function(removedVideoSrc) {
if (removedVideoSrc === RTC.getVideoSrc($('#largeVideo')[0])) {
if (removedVideoSrc === APP.RTC.getVideoSrc($('#largeVideo')[0])) {
// this is currently displayed as large
// pick the last visible video in the row
// if nobody else is left, this picks the local video
@ -625,7 +623,7 @@ var VideoLayout = (function (my) {
console.info("Last visible video no longer exists");
pick = $('#remoteVideos>span[id!="mixedstream"]>video').get(0);
if (!pick || !RTC.getVideoSrc(pick)) {
if (!pick || !APP.RTC.getVideoSrc(pick)) {
// Try local video
console.info("Fallback to local video...");
pick = $('#remoteVideos>span>span>video').get(0);
@ -640,7 +638,7 @@ var VideoLayout = (function (my) {
{
if(container.id == "localVideoWrapper")
{
jid = xmpp.myResource();
jid = APP.xmpp.myResource();
}
else
{
@ -648,7 +646,7 @@ var VideoLayout = (function (my) {
}
}
VideoLayout.updateLargeVideo(RTC.getVideoSrc(pick), pick.volume, jid);
VideoLayout.updateLargeVideo(APP.RTC.getVideoSrc(pick), pick.volume, jid);
} else {
console.warn("Failed to elect large video");
}
@ -703,7 +701,7 @@ var VideoLayout = (function (my) {
my.updateLargeVideo = function(newSrc, vol, resourceJid) {
console.log('hover in', newSrc);
if (RTC.getVideoSrc($('#largeVideo')[0]) !== newSrc) {
if (APP.RTC.getVideoSrc($('#largeVideo')[0]) !== newSrc) {
$('#activeSpeaker').css('visibility', 'hidden');
// Due to the simulcast the localVideoSrc may have changed when the
@ -716,7 +714,7 @@ var VideoLayout = (function (my) {
largeVideoState.newSrc = newSrc;
largeVideoState.isVisible = $('#largeVideo').is(':visible');
largeVideoState.isDesktop = RTC.isVideoSrcDesktop(resourceJid);
largeVideoState.isDesktop = APP.RTC.isVideoSrcDesktop(resourceJid);
if(largeVideoState.userResourceJid) {
largeVideoState.oldResourceJid = largeVideoState.userResourceJid;
} else {
@ -742,12 +740,12 @@ var VideoLayout = (function (my) {
var doUpdate = function () {
Avatar.updateActiveSpeakerAvatarSrc(
xmpp.findJidFromResource(
APP.xmpp.findJidFromResource(
largeVideoState.userResourceJid));
if (!userChanged && largeVideoState.preload &&
largeVideoState.preload !== null &&
RTC.getVideoSrc($(largeVideoState.preload)[0]) === newSrc)
APP.RTC.getVideoSrc($(largeVideoState.preload)[0]) === newSrc)
{
console.info('Switching to preloaded video');
@ -774,7 +772,7 @@ var VideoLayout = (function (my) {
largeVideoState.preload = null;
largeVideoState.preload_ssrc = 0;
} else {
RTC.setVideoSrc($('#largeVideo')[0], largeVideoState.newSrc);
APP.RTC.setVideoSrc($('#largeVideo')[0], largeVideoState.newSrc);
}
var videoTransform = document.getElementById('largeVideo')
@ -822,7 +820,7 @@ var VideoLayout = (function (my) {
if(userChanged) {
Avatar.showUserAvatar(
xmpp.findJidFromResource(
APP.xmpp.findJidFromResource(
largeVideoState.oldResourceJid));
}
@ -837,7 +835,7 @@ var VideoLayout = (function (my) {
}
} else {
Avatar.showUserAvatar(
xmpp.findJidFromResource(
APP.xmpp.findJidFromResource(
largeVideoState.userResourceJid));
}
@ -870,7 +868,7 @@ var VideoLayout = (function (my) {
if (dominantSpeakerVideo) {
VideoLayout.updateLargeVideo(
RTC.getVideoSrc(dominantSpeakerVideo),
APP.RTC.getVideoSrc(dominantSpeakerVideo),
1,
currentDominantSpeaker);
}
@ -976,7 +974,7 @@ var VideoLayout = (function (my) {
focusedVideoInfo = null;
if(focusResourceJid) {
Avatar.showUserAvatar(
xmpp.findJidFromResource(focusResourceJid));
APP.xmpp.findJidFromResource(focusResourceJid));
}
}
}
@ -1048,7 +1046,7 @@ var VideoLayout = (function (my) {
// If the peerJid is null then this video span couldn't be directly
// associated with a participant (this could happen in the case of prezi).
if (xmpp.isModerator() && peerJid !== null)
if (APP.xmpp.isModerator() && peerJid !== null)
addRemoteVideoMenu(peerJid, container);
remotes.appendChild(container);
@ -1067,7 +1065,7 @@ var VideoLayout = (function (my) {
? document.createElement('video')
: document.createElement('audio');
var id = (isVideo ? 'remoteVideo_' : 'remoteAudio_')
+ sid + '_' + RTC.getStreamID(stream);
+ sid + '_' + APP.RTC.getStreamID(stream);
element.id = id;
element.autoplay = true;
@ -1094,8 +1092,8 @@ var VideoLayout = (function (my) {
// If the container is currently visible we attach the stream.
if (!isVideo
|| (container.offsetParent !== null && isVideo)) {
var videoStream = simulcast.getReceivingVideoStream(stream);
RTC.attachMediaStream(sel, videoStream);
var videoStream = APP.simulcast.getReceivingVideoStream(stream);
APP.RTC.attachMediaStream(sel, videoStream);
if (isVideo)
waitForRemoteVideo(sel, thessrc, stream, peerJid);
@ -1133,7 +1131,7 @@ var VideoLayout = (function (my) {
var videoThumb = $('#' + container.id + '>video').get(0);
if (videoThumb) {
VideoLayout.handleVideoThumbClicked(
RTC.getVideoSrc(videoThumb),
APP.RTC.getVideoSrc(videoThumb),
false,
Strophe.getResourceFromJid(peerJid));
}
@ -1152,13 +1150,13 @@ var VideoLayout = (function (my) {
var videoSrc = null;
if ($('#' + container.id + '>video')
&& $('#' + container.id + '>video').length > 0) {
videoSrc = RTC.getVideoSrc($('#' + container.id + '>video').get(0));
videoSrc = APP.RTC.getVideoSrc($('#' + container.id + '>video').get(0));
}
// If the video has been "pinned" by the user we want to
// keep the display name on place.
if (!VideoLayout.isLargeVideoVisible()
|| videoSrc !== RTC.getVideoSrc($('#largeVideo')[0]))
|| videoSrc !== APP.RTC.getVideoSrc($('#largeVideo')[0]))
VideoLayout.showDisplayName(container.id, false);
}
);
@ -1183,7 +1181,7 @@ var VideoLayout = (function (my) {
var removedVideoSrc = null;
if (isVideo) {
select = $('#' + container.id + '>video');
removedVideoSrc = RTC.getVideoSrc(select.get(0));
removedVideoSrc = APP.RTC.getVideoSrc(select.get(0));
}
else
select = $('#' + container.id + '>audio');
@ -1230,16 +1228,16 @@ var VideoLayout = (function (my) {
peerContainer.show();
}
var jid = APP.xmpp.findJidFromResource(resourceJid);
if (state == 'show')
{
// peerContainer.css('-webkit-filter', '');
var jid = xmpp.findJidFromResource(resourceJid);
Avatar.showUserAvatar(jid, false);
}
else // if (state == 'avatar')
{
// peerContainer.css('-webkit-filter', 'grayscale(100%)');
var jid = xmpp.findJidFromResource(resourceJid);
Avatar.showUserAvatar(jid, true);
}
}
@ -1330,7 +1328,7 @@ var VideoLayout = (function (my) {
*/
my.showModeratorIndicator = function () {
var isModerator = xmpp.isModerator();
var isModerator = APP.xmpp.isModerator();
if (isModerator) {
var indicatorSpan = $('#localVideoContainer .focusindicator');
@ -1340,7 +1338,7 @@ var VideoLayout = (function (my) {
}
}
var members = xmpp.getMembers();
var members = APP.xmpp.getMembers();
Object.keys(members).forEach(function (jid) {
@ -1532,7 +1530,7 @@ var VideoLayout = (function (my) {
var videoSpanId = null;
var videoContainerId = null;
if (resourceJid
=== xmpp.myResource()) {
=== APP.xmpp.myResource()) {
videoSpanId = 'localVideoWrapper';
videoContainerId = 'localVideoContainer';
}
@ -1575,7 +1573,7 @@ var VideoLayout = (function (my) {
}
Avatar.showUserAvatar(
xmpp.findJidFromResource(resourceJid));
APP.xmpp.findJidFromResource(resourceJid));
}
};
@ -1701,7 +1699,7 @@ var VideoLayout = (function (my) {
eventEmitter.emit(UIEvents.PINNED_ENDPOINT,
Strophe.getResourceFromJid(jid));
}
} else if (jid == xmpp.myJid()) {
} else if (jid == APP.xmpp.myJid()) {
$("#localVideoContainer").click();
}
}
@ -1719,7 +1717,7 @@ var VideoLayout = (function (my) {
return;
}*/
var videoSpanId = null;
if (jid === xmpp.myJid()) {
if (jid === APP.xmpp.myJid()) {
videoSpanId = 'localVideoContainer';
} else {
VideoLayout.ensurePeerContainerExists(jid);
@ -1728,7 +1726,7 @@ var VideoLayout = (function (my) {
mutedAudios[jid] = isMuted;
if (xmpp.isModerator()) {
if (APP.xmpp.isModerator()) {
VideoLayout.updateRemoteVideoMenu(jid, isMuted);
}
@ -1741,12 +1739,12 @@ var VideoLayout = (function (my) {
*/
$(document).bind('videomuted.muc', function (event, jid, value) {
var isMuted = (value === "true");
if(!RTC.muteRemoteVideoStream(jid, isMuted))
if(!APP.RTC.muteRemoteVideoStream(jid, isMuted))
return;
Avatar.showUserAvatar(jid, isMuted);
var videoSpanId = null;
if (jid === xmpp.myJid()) {
if (jid === APP.xmpp.myJid()) {
videoSpanId = 'localVideoContainer';
} else {
VideoLayout.ensurePeerContainerExists(jid);
@ -1763,7 +1761,7 @@ var VideoLayout = (function (my) {
my.onDisplayNameChanged =
function (jid, displayName, status) {
if (jid === 'localVideoContainer'
|| jid === xmpp.myJid()) {
|| jid === APP.xmpp.myJid()) {
setDisplayName('localVideoContainer',
displayName);
} else {
@ -1782,7 +1780,7 @@ var VideoLayout = (function (my) {
my.onDominantSpeakerChanged = function (resourceJid) {
// We ignore local user events.
if (resourceJid
=== xmpp.myResource())
=== APP.xmpp.myResource())
return;
// Update the current dominant speaker.
@ -1816,7 +1814,7 @@ var VideoLayout = (function (my) {
// Update the large video if the video source is already available,
// otherwise wait for the "videoactive.jingle" event.
if (video.length && video[0].currentTime > 0)
VideoLayout.updateLargeVideo(RTC.getVideoSrc(video[0]), resourceJid);
VideoLayout.updateLargeVideo(APP.RTC.getVideoSrc(video[0]), resourceJid);
}
};
@ -1911,13 +1909,13 @@ var VideoLayout = (function (my) {
if (!isVisible) {
console.log("Add to last N", resourceJid);
var jid = xmpp.findJidFromResource(resourceJid);
var mediaStream = RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
var jid = APP.xmpp.findJidFromResource(resourceJid);
var mediaStream = APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
var sel = $('#participant_' + resourceJid + '>video');
var videoStream = simulcast.getReceivingVideoStream(
var videoStream = APP.simulcast.getReceivingVideoStream(
mediaStream.stream);
RTC.attachMediaStream(sel, videoStream);
APP.RTC.attachMediaStream(sel, videoStream);
if (lastNPickupJid == mediaStream.peerjid) {
// Clean up the lastN pickup jid.
lastNPickupJid = null;
@ -1944,7 +1942,7 @@ var VideoLayout = (function (my) {
var resource, container, src;
var myResource
= xmpp.myResource();
= APP.xmpp.myResource();
// Find out which endpoint to show in the large video.
for (var i = 0; i < lastNEndpoints.length; i++) {
@ -1987,16 +1985,16 @@ var VideoLayout = (function (my) {
var primarySSRC = esl.simulcastLayer.primarySSRC;
// Get session and stream from primary ssrc.
var res = simulcast.getReceivingVideoStreamBySSRC(primarySSRC);
var res = APP.simulcast.getReceivingVideoStreamBySSRC(primarySSRC);
var sid = res.sid;
var electedStream = res.stream;
if (sid && electedStream) {
var msid = simulcast.getRemoteVideoStreamIdBySSRC(primarySSRC);
var msid = APP.simulcast.getRemoteVideoStreamIdBySSRC(primarySSRC);
console.info([esl, primarySSRC, msid, sid, electedStream]);
var preload = (Strophe.getResourceFromJid(xmpp.getJidFromSSRC(primarySSRC)) == largeVideoState.userResourceJid);
var preload = (Strophe.getResourceFromJid(APP.xmpp.getJidFromSSRC(primarySSRC)) == largeVideoState.userResourceJid);
if (preload) {
if (largeVideoState.preload)
@ -2008,7 +2006,7 @@ var VideoLayout = (function (my) {
// ssrcs are unique in an rtp session
largeVideoState.preload_ssrc = primarySSRC;
RTC.attachMediaStream(largeVideoState.preload, electedStream)
APP.RTC.attachMediaStream(largeVideoState.preload, electedStream)
}
} else {
@ -2043,12 +2041,12 @@ var VideoLayout = (function (my) {
var primarySSRC = esl.simulcastLayer.primarySSRC;
// Get session and stream from primary ssrc.
var res = simulcast.getReceivingVideoStreamBySSRC(primarySSRC);
var res = APP.simulcast.getReceivingVideoStreamBySSRC(primarySSRC);
var sid = res.sid;
var electedStream = res.stream;
if (sid && electedStream) {
var msid = simulcast.getRemoteVideoStreamIdBySSRC(primarySSRC);
var msid = APP.simulcast.getRemoteVideoStreamIdBySSRC(primarySSRC);
console.info('Switching simulcast substream.');
console.info([esl, primarySSRC, msid, sid, electedStream]);
@ -2056,15 +2054,15 @@ var VideoLayout = (function (my) {
var msidParts = msid.split(' ');
var selRemoteVideo = $(['#', 'remoteVideo_', sid, '_', msidParts[0]].join(''));
var updateLargeVideo = (Strophe.getResourceFromJid(xmpp.getJidFromSSRC(primarySSRC))
var updateLargeVideo = (Strophe.getResourceFromJid(APP.xmpp.getJidFromSSRC(primarySSRC))
== largeVideoState.userResourceJid);
var updateFocusedVideoSrc = (focusedVideoInfo && focusedVideoInfo.src && focusedVideoInfo.src != '' &&
(RTC.getVideoSrc(selRemoteVideo[0]) == focusedVideoInfo.src));
(APP.RTC.getVideoSrc(selRemoteVideo[0]) == focusedVideoInfo.src));
var electedStreamUrl;
if (largeVideoState.preload_ssrc == primarySSRC)
{
RTC.setVideoSrc(selRemoteVideo[0], RTC.getVideoSrc(largeVideoState.preload[0]));
APP.RTC.setVideoSrc(selRemoteVideo[0], APP.RTC.getVideoSrc(largeVideoState.preload[0]));
}
else
{
@ -2075,22 +2073,22 @@ var VideoLayout = (function (my) {
largeVideoState.preload_ssrc = 0;
RTC.attachMediaStream(selRemoteVideo, electedStream);
APP.RTC.attachMediaStream(selRemoteVideo, electedStream);
}
var jid = xmpp.getJidFromSSRC(primarySSRC);
var jid = APP.xmpp.getJidFromSSRC(primarySSRC);
if (updateLargeVideo) {
VideoLayout.updateLargeVideo(RTC.getVideoSrc(selRemoteVideo[0]), null,
VideoLayout.updateLargeVideo(APP.RTC.getVideoSrc(selRemoteVideo[0]), null,
Strophe.getResourceFromJid(jid));
}
if (updateFocusedVideoSrc) {
focusedVideoInfo.src = RTC.getVideoSrc(selRemoteVideo[0]);
focusedVideoInfo.src = APP.RTC.getVideoSrc(selRemoteVideo[0]);
}
var videoId;
if(resource == xmpp.myResource())
if(resource == APP.xmpp.myResource())
{
videoId = "localVideoContainer";
}
@ -2118,8 +2116,8 @@ var VideoLayout = (function (my) {
if(object.resolution !== null)
{
resolution = object.resolution;
object.resolution = resolution[xmpp.myJid()];
delete resolution[xmpp.myJid()];
object.resolution = resolution[APP.xmpp.myJid()];
delete resolution[APP.xmpp.myJid()];
}
updateStatsIndicator("localVideoContainer", percent, object);
for(var jid in resolution)

View File

@ -1,5 +1,7 @@
var EventEmitter = require("events");
var eventEmitter = new EventEmitter();
var CQEvents = require("../../service/connectionquality/CQEvents");
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
/**
* local stats
@ -32,7 +34,7 @@ function startSendingStats() {
* Sends statistics to other participants
*/
function sendStats() {
xmpp.addToPresence("connectionQuality", convertToMUCStats(stats));
APP.xmpp.addToPresence("connectionQuality", convertToMUCStats(stats));
}
/**
@ -72,9 +74,9 @@ function parseMUCStats(stats) {
var ConnectionQuality = {
init: function () {
xmpp.addListener(XMPPEvents.REMOTE_STATS, this.updateRemoteStats);
statistics.addConnectionStatsListener(this.updateLocalStats);
statistics.addRemoteStatsStopListener(this.stopSendingStats);
APP.xmpp.addListener(XMPPEvents.REMOTE_STATS, this.updateRemoteStats);
APP.statistics.addConnectionStatsListener(this.updateLocalStats);
APP.statistics.addRemoteStatsStopListener(this.stopSendingStats);
},

View File

@ -27,12 +27,14 @@ var EventEmitter = require("events");
var eventEmitter = new EventEmitter();
var DesktopSharingEventTypes = require("../../service/desktopsharing/DesktopSharingEventTypes");
/**
* Method obtains desktop stream from WebRTC 'screen' source.
* Flag 'chrome://flags/#enable-usermedia-screen-capture' must be enabled.
*/
function obtainWebRTCScreen(streamCallback, failCallback) {
RTC.getUserMediaWithConstraints(
APP.RTC.getUserMediaWithConstraints(
['screen'],
streamCallback,
failCallback
@ -90,7 +92,7 @@ function isUpdateRequired(minVersion, extVersion)
catch (e)
{
console.error("Failed to parse extension version", e);
UI.messageHandler.showError('Error',
APP.UI.messageHandler.showError('Error',
'Error when trying to detect desktopsharing extension.');
return true;
}
@ -139,7 +141,7 @@ function doGetStreamFromExtension(streamCallback, failCallback) {
}
console.log("Response from extension: " + response);
if (response.streamId) {
RTC.getUserMediaWithConstraints(
APP.RTC.getUserMediaWithConstraints(
['desktop'],
function (stream) {
streamCallback(stream);
@ -172,7 +174,7 @@ function obtainScreenFromExtension(streamCallback, failCallback) {
function (arg) {
console.log("Failed to install the extension", arg);
failCallback(arg);
UI.messageHandler.showError('Error',
APP.UI.messageHandler.showError('Error',
'Failed to install desktop sharing extension');
}
);
@ -306,7 +308,7 @@ module.exports = {
getSwitchStreamFailed);
} else {
// Disable screen stream
RTC.getUserMediaWithConstraints(
APP.RTC.getUserMediaWithConstraints(
['video'],
function (stream) {
// We are now using camera stream

View File

@ -3,30 +3,30 @@ var shortcuts = {
67: {
character: "C",
id: "toggleChatPopover",
function: UI.toggleChat
function: APP.UI.toggleChat
},
70: {
character: "F",
id: "filmstripPopover",
function: UI.toggleFilmStrip
function: APP.UI.toggleFilmStrip
},
77: {
character: "M",
id: "mutePopover",
function: UI.toggleAudio
function: APP.UI.toggleAudio
},
84: {
character: "T",
function: function() {
if(!RTC.localAudio.isMuted()) {
UI.toggleAudio();
if(!APP.RTC.localAudio.isMuted()) {
APP.UI.toggleAudio();
}
}
},
86: {
character: "V",
id: "toggleVideoPopover",
function: UI.toggleVideo
function: APP.UI.toggleVideo
}
};
@ -43,11 +43,11 @@ var KeyboardShortcut = {
}
else if (keycode >= "0".charCodeAt(0) &&
keycode <= "9".charCodeAt(0)) {
UI.clickOnVideo(keycode - "0".charCodeAt(0) + 1);
APP.UI.clickOnVideo(keycode - "0".charCodeAt(0) + 1);
}
//esc while the smileys are visible hides them
} else if (keycode === 27 && $('#smileysContainer').is(':visible')) {
UI.toggleSmileys();
APP.UI.toggleSmileys();
}
};
@ -56,8 +56,8 @@ var KeyboardShortcut = {
$(":focus").is("input[type=password]") ||
$(":focus").is("textarea"))) {
if(e.which === "T".charCodeAt(0)) {
if(RTC.localAudio.isMuted()) {
UI.toggleAudio();
if(APP.RTC.localAudio.isMuted()) {
APP.UI.toggleAudio();
}
}
}

View File

@ -1,5 +1,6 @@
var SimulcastLogger = require("./SimulcastLogger");
var SimulcastUtils = require("./SimulcastUtils");
var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
function SimulcastReceiver() {
this.simulcastUtils = new SimulcastUtils();
@ -161,7 +162,7 @@ SimulcastReceiver.prototype.getReceivingSSRC = function (jid) {
// low quality (that the sender always streams).
if(!ssrc)
{
var remoteStreamObject = RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
var remoteStreamObject = APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
var remoteStream = remoteStreamObject.getOriginalStream();
var tracks = remoteStream.getVideoTracks();
if (tracks) {
@ -184,10 +185,10 @@ SimulcastReceiver.prototype.getReceivingVideoStreamBySSRC = function (ssrc)
{
var sid, electedStream;
var i, j, k;
var jid = xmpp.getJidFromSSRC(ssrc);
if(jid && RTC.remoteStreams[jid])
var jid = APP.xmpp.getJidFromSSRC(ssrc);
if(jid && APP.RTC.remoteStreams[jid])
{
var remoteStreamObject = RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
var remoteStreamObject = APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
var remoteStream = remoteStreamObject.getOriginalStream();
var tracks = remoteStream.getVideoTracks();
if (tracks) {
@ -207,7 +208,7 @@ SimulcastReceiver.prototype.getReceivingVideoStreamBySSRC = function (ssrc)
}
else
{
console.debug(RTC.remoteStreams, jid, ssrc);
console.debug(APP.RTC.remoteStreams, jid, ssrc);
}
return {

View File

@ -32,7 +32,7 @@ SimulcastSender.prototype.getLocalVideoStream = function () {
return (this.displayedLocalVideoStream != null)
? this.displayedLocalVideoStream
// in case we have no simulcast at all, i.e. we didn't perform the GUM
: RTC.localVideo.getOriginalStream();
: APP.RTC.localVideo.getOriginalStream();
};
function NativeSimulcastSender() {
@ -47,7 +47,7 @@ NativeSimulcastSender.prototype._localVideoSourceCache = '';
NativeSimulcastSender.prototype.reset = function () {
this._localExplosionMap = {};
this._isUsingScreenStream = desktopsharing.isUsingScreenStream();
this._isUsingScreenStream = APP.desktopsharing.isUsingScreenStream();
};
NativeSimulcastSender.prototype._cacheLocalVideoSources = function (lines) {

View File

@ -6,6 +6,7 @@ var NoSimulcastSender = SimulcastSender["no"];
var NativeSimulcastSender = SimulcastSender["native"];
var SimulcastReceiver = require("./SimulcastReceiver");
var SimulcastUtils = require("./SimulcastUtils");
var RTCEvents = require("../../service/RTC/RTCEvents");
/**
@ -46,18 +47,18 @@ function SimulcastManager() {
}
}
RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
APP.RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
function (endpointSimulcastLayers) {
endpointSimulcastLayers.forEach(function (esl) {
var ssrc = esl.simulcastLayer.primarySSRC;
simulcast._setReceivingVideoStream(esl.endpoint, ssrc);
});
});
RTC.addListener(RTCEvents.SIMULCAST_START, function (simulcastLayer) {
APP.RTC.addListener(RTCEvents.SIMULCAST_START, function (simulcastLayer) {
var ssrc = simulcastLayer.primarySSRC;
simulcast._setLocalVideoStreamEnabled(ssrc, true);
});
RTC.addListener(RTCEvents.SIMULCAST_STOP, function (simulcastLayer) {
APP.RTC.addListener(RTCEvents.SIMULCAST_STOP, function (simulcastLayer) {
var ssrc = simulcastLayer.primarySSRC;
simulcast._setLocalVideoStreamEnabled(ssrc, false);
});

View File

@ -1,5 +1,8 @@
/* global ssrc2jid */
/* jshint -W117 */
var RTCBrowserType = require("../../service/RTC/RTCBrowserType");
/**
* Calculates packet lost percent using the number of lost packets and the
* number of all packet.
@ -14,10 +17,10 @@ function calculatePacketLoss(lostPackets, totalPackets) {
}
function getStatValue(item, name) {
if(!keyMap[RTC.getBrowserType()][name])
if(!keyMap[APP.RTC.getBrowserType()][name])
throw "The property isn't supported!";
var key = keyMap[RTC.getBrowserType()][name];
return RTC.getBrowserType() == RTCBrowserType.RTC_BROWSER_CHROME? item.stat(key) : item[key];
var key = keyMap[APP.RTC.getBrowserType()][name];
return APP.RTC.getBrowserType() == RTCBrowserType.RTC_BROWSER_CHROME? item.stat(key) : item[key];
}
/**
@ -330,7 +333,7 @@ StatsCollector.prototype.addStatsToBeLogged = function (reports) {
StatsCollector.prototype.logStats = function () {
if(!xmpp.sendLogs(this.statsToBeLogged))
if(!APP.xmpp.sendLogs(this.statsToBeLogged))
return;
// Reset the stats
this.statsToBeLogged.stats = {};
@ -444,7 +447,7 @@ StatsCollector.prototype.processStatsReport = function () {
var ssrc = getStatValue(now, 'ssrc');
if(!ssrc)
continue;
var jid = xmpp.getJidFromSSRC(ssrc);
var jid = APP.xmpp.getJidFromSSRC(ssrc);
if (!jid && (Date.now() - now.timestamp) < 3000) {
console.warn("No jid for ssrc: " + ssrc);
continue;
@ -645,7 +648,7 @@ StatsCollector.prototype.processAudioLevelReport = function ()
}
var ssrc = getStatValue(now, 'ssrc');
var jid = xmpp.getJidFromSSRC(ssrc);
var jid = APP.xmpp.getJidFromSSRC(ssrc);
if (!jid && (Date.now() - now.timestamp) < 3000)
{
console.warn("No jid for ssrc: " + ssrc);
@ -679,7 +682,7 @@ StatsCollector.prototype.processAudioLevelReport = function ()
// but it seems to vary between 0 and around 32k.
audioLevel = audioLevel / 32767;
jidStats.setSsrcAudioLevel(ssrc, audioLevel);
if(jid != xmpp.myJid())
if(jid != APP.xmpp.myJid())
this.eventEmitter.emit("statistics.audioLevel", jid, audioLevel);
}

View File

@ -4,10 +4,8 @@
var LocalStats = require("./LocalStatsCollector.js");
var RTPStats = require("./RTPStatsCollector.js");
var EventEmitter = require("events");
//These lines should be uncommented when require works in app.js
//var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
//var RTCBrowserType = require("../../service/RTC/RTCBrowserType");
//var XMPPEvents = require("../service/xmpp/XMPPEvents");
var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
var eventEmitter = new EventEmitter();
@ -122,10 +120,10 @@ var statistics =
},
start: function () {
RTC.addStreamListener(onStreamCreated,
APP.RTC.addStreamListener(onStreamCreated,
StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
xmpp.addListener(XMPPEvents.CALL_INCOMING, function (event) {
APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
APP.xmpp.addListener(XMPPEvents.CALL_INCOMING, function (event) {
startRemoteStats(event.peerconnection);
});
}

View File

@ -3,6 +3,7 @@ var TraceablePeerConnection = require("./TraceablePeerConnection");
var SDPDiffer = require("./SDPDiffer");
var SDPUtil = require("./SDPUtil");
var SDP = require("./SDP");
var RTCBrowserType = require("../../service/RTC/RTCBrowserType");
// Jingle stuff
function JingleSession(me, sid, connection, service) {
@ -105,7 +106,7 @@ JingleSession.prototype.initiate = function (peerjid, isInitiator) {
onIceConnectionStateChange(self.sid, self);
};
// add any local and relayed stream
RTC.localStreams.forEach(function(stream) {
APP.RTC.localStreams.forEach(function(stream) {
self.peerconnection.addStream(stream.getOriginalStream());
});
this.relayedStreams.forEach(function(stream) {
@ -176,7 +177,7 @@ JingleSession.prototype.accept = function () {
// FIXME: change any inactive to sendrecv or whatever they were originally
pranswer.sdp = pranswer.sdp.replace('a=inactive', 'a=sendrecv');
}
pranswer = simulcast.reverseTransformLocalDescription(pranswer);
pranswer = APP.simulcast.reverseTransformLocalDescription(pranswer);
var prsdp = new SDP(pranswer.sdp);
var accept = $iq({to: this.peerjid,
type: 'set'})
@ -629,7 +630,7 @@ JingleSession.prototype.createdAnswer = function (sdp, provisional) {
initiator: self.initiator,
responder: self.responder,
sid: self.sid });
var publicLocalDesc = simulcast.reverseTransformLocalDescription(sdp);
var publicLocalDesc = APP.simulcast.reverseTransformLocalDescription(sdp);
var publicLocalSDP = new SDP(publicLocalDesc.sdp);
publicLocalSDP.toJingle(accept, self.initiator == self.me ? 'initiator' : 'responder', ssrcs);
self.connection.sendIQ(accept,
@ -1126,7 +1127,7 @@ JingleSession.prototype.setVideoMute = function (mute, callback, options) {
successCallback();
}
} else {
RTC.localVideo.setMute(!mute);
APP.RTC.localVideo.setMute(!mute);
this.hardMuteVideo(mute);
@ -1137,7 +1138,7 @@ JingleSession.prototype.setVideoMute = function (mute, callback, options) {
// SDP-based mute by going recvonly/sendrecv
// FIXME: should probably black out the screen as well
JingleSession.prototype.toggleVideoMute = function (callback) {
this.service.setVideoMute(RTC.localVideo.isMuted(), callback);
this.service.setVideoMute(APP.RTC.localVideo.isMuted(), callback);
};
JingleSession.prototype.hardMuteVideo = function (muted) {
@ -1224,15 +1225,15 @@ JingleSession.onJingleError = function (session, error)
JingleSession.onJingleFatalError = function (session, error)
{
this.service.sessionTerminated = true;
connection.emuc.doLeave();
UI.messageHandler.showError( "Sorry",
this.connection.emuc.doLeave();
APP.UI.messageHandler.showError( "Sorry",
"Internal application error[setRemoteDescription]");
}
JingleSession.prototype.setLocalDescription = function () {
// put our ssrcs into presence so other clients can identify our stream
var newssrcs = [];
var media = simulcast.parseMedia(this.peerconnection.localDescription);
var media = APP.simulcast.parseMedia(this.peerconnection.localDescription);
media.forEach(function (media) {
if(Object.keys(media.sources).length > 0) {
@ -1264,7 +1265,7 @@ JingleSession.prototype.setLocalDescription = function () {
if (newssrcs.length > 0) {
for (var i = 1; i <= newssrcs.length; i ++) {
// Change video type to screen
if (newssrcs[i-1].type === 'video' && desktopsharing.isUsingScreenStream()) {
if (newssrcs[i-1].type === 'video' && APP.desktopsharing.isUsingScreenStream()) {
newssrcs[i-1].type = 'screen';
}
this.connection.emuc.addMediaToPresence(i,
@ -1356,7 +1357,7 @@ JingleSession.prototype.remoteStreamAdded = function (data) {
}
//TODO: this code should be removed when firefox implement multistream support
if(RTC.getBrowserType() == RTCBrowserType.RTC_BROWSER_FIREFOX)
if(APP.RTC.getBrowserType() == RTCBrowserType.RTC_BROWSER_FIREFOX)
{
if((JingleSession.notReceivedSSRCs.length == 0) ||
!ssrc2jid[JingleSession.notReceivedSSRCs[JingleSession.notReceivedSSRCs.length - 1]])
@ -1376,14 +1377,14 @@ JingleSession.prototype.remoteStreamAdded = function (data) {
}
}
RTC.createRemoteStream(data, this.sid, thessrc);
APP.RTC.createRemoteStream(data, this.sid, thessrc);
var isVideo = data.stream.getVideoTracks().length > 0;
// an attempt to work around https://github.com/jitsi/jitmeet/issues/32
if (isVideo &&
data.peerjid && this.peerjid === data.peerjid &&
data.stream.getVideoTracks().length === 0 &&
RTC.localVideo.getTracks().length > 0) {
APP.RTC.localVideo.getTracks().length > 0) {
window.setTimeout(function () {
sendKeyframe(self.peerconnection);
}, 3000);

View File

@ -235,11 +235,11 @@ SDP.prototype.toJingle = function (elem, thecreator, ssrcs) {
var msid = null;
if(mline.media == "audio")
{
msid = RTC.localAudio.getId();
msid = APP.RTC.localAudio.getId();
}
else
{
msid = RTC.localVideo.getId();
msid = APP.RTC.localVideo.getId();
}
if(msid != null)
{

View File

@ -105,18 +105,18 @@ if (TraceablePeerConnection.prototype.__defineGetter__ !== undefined) {
TraceablePeerConnection.prototype.__defineGetter__('signalingState', function() { return this.peerconnection.signalingState; });
TraceablePeerConnection.prototype.__defineGetter__('iceConnectionState', function() { return this.peerconnection.iceConnectionState; });
TraceablePeerConnection.prototype.__defineGetter__('localDescription', function() {
var publicLocalDescription = simulcast.reverseTransformLocalDescription(this.peerconnection.localDescription);
var publicLocalDescription = APP.simulcast.reverseTransformLocalDescription(this.peerconnection.localDescription);
return publicLocalDescription;
});
TraceablePeerConnection.prototype.__defineGetter__('remoteDescription', function() {
var publicRemoteDescription = simulcast.reverseTransformRemoteDescription(this.peerconnection.remoteDescription);
var publicRemoteDescription = APP.simulcast.reverseTransformRemoteDescription(this.peerconnection.remoteDescription);
return publicRemoteDescription;
});
}
TraceablePeerConnection.prototype.addStream = function (stream) {
this.trace('addStream', stream.id);
simulcast.resetSender();
APP.simulcast.resetSender();
try
{
this.peerconnection.addStream(stream);
@ -130,7 +130,7 @@ TraceablePeerConnection.prototype.addStream = function (stream) {
TraceablePeerConnection.prototype.removeStream = function (stream, stopStreams) {
this.trace('removeStream', stream.id);
simulcast.resetSender();
APP.simulcast.resetSender();
if(stopStreams) {
stream.getAudioTracks().forEach(function (track) {
track.stop();
@ -149,7 +149,7 @@ TraceablePeerConnection.prototype.createDataChannel = function (label, opts) {
TraceablePeerConnection.prototype.setLocalDescription = function (description, successCallback, failureCallback) {
var self = this;
description = simulcast.transformLocalDescription(description);
description = APP.simulcast.transformLocalDescription(description);
this.trace('setLocalDescription', dumpSDP(description));
this.peerconnection.setLocalDescription(description,
function () {
@ -170,7 +170,7 @@ TraceablePeerConnection.prototype.setLocalDescription = function (description, s
TraceablePeerConnection.prototype.setRemoteDescription = function (description, successCallback, failureCallback) {
var self = this;
description = simulcast.transformRemoteDescription(description);
description = APP.simulcast.transformRemoteDescription(description);
this.trace('setRemoteDescription', dumpSDP(description));
this.peerconnection.setRemoteDescription(description,
function () {
@ -219,7 +219,7 @@ TraceablePeerConnection.prototype.createAnswer = function (successCallback, fail
this.trace('createAnswer', JSON.stringify(constraints, null, ' '));
this.peerconnection.createAnswer(
function (answer) {
answer = simulcast.transformAnswer(answer);
answer = APP.simulcast.transformAnswer(answer);
self.trace('createAnswerOnSuccess', dumpSDP(answer));
successCallback(answer);
},

View File

@ -1,11 +1,14 @@
/* global $, $iq, config, connection, UI, messageHandler,
roomName, sessionTerminated, Strophe, Util */
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
/**
* Contains logic responsible for enabling/disabling functionality available
* only to moderator users.
*/
var connection = null;
var focusUserJid;
function createExpBackoffTimer(step) {
var count = 1;
return function (reset) {
@ -228,7 +231,7 @@ var Moderator = {
var waitMs = getNextErrorTimeout();
console.error("Focus error, retry after " + waitMs, error);
// Show message
UI.messageHandler.notify(
APP.UI.messageHandler.notify(
'Conference focus', 'disconnected',
Moderator.getFocusComponent() +
' not available - retry in ' +

View File

@ -2,12 +2,12 @@
/* a simple MUC connection plugin
* can only handle a single MUC room
*/
var bridgeIsDown = false;
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
var Moderator = require("./moderator");
var JingleSession = require("./JingleSession");
var bridgeIsDown = false;
module.exports = function(XMPP, eventEmitter) {
Strophe.addConnectionPlugin('emuc', {
connection: null,
@ -272,20 +272,20 @@ module.exports = function(XMPP, eventEmitter) {
// We're either missing Jicofo/Prosody config for anonymous
// domains or something is wrong.
// XMPP.promptLogin();
UI.messageHandler.openReportDialog(null,
APP.UI.messageHandler.openReportDialog(null,
'Oops ! We couldn`t join the conference.' +
' There might be some problem with security' +
' configuration. Please contact service' +
' administrator.', pres);
} else {
console.warn('onPresError ', pres);
UI.messageHandler.openReportDialog(null,
APP.UI.messageHandler.openReportDialog(null,
'Oops! Something went wrong and we couldn`t connect to the conference.',
pres);
}
} else {
console.warn('onPresError ', pres);
UI.messageHandler.openReportDialog(null,
APP.UI.messageHandler.openReportDialog(null,
'Oops! Something went wrong and we couldn`t connect to the conference.',
pres);
}

View File

@ -1,6 +1,8 @@
/* jshint -W117 */
var JingleSession = require("./JingleSession");
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
module.exports = function(XMPP, eventEmitter)
{

View File

@ -44,7 +44,7 @@ module.exports = function (XMPP) {
var mute = $(iq).find('mute');
if (mute.length) {
var doMuteAudio = mute.text() === "true";
UI.setAudioMuted(doMuteAudio);
APP.UI.setAudioMuted(doMuteAudio);
XMPP.forceMuted = doMuteAudio;
}
return true;

View File

@ -3,6 +3,9 @@ var EventEmitter = require("events");
var Recording = require("./recording");
var SDP = require("./SDP");
var Pako = require("pako");
var StreamEventTypes = require("../../service/RTC/StreamEventTypes");
var UIEvents = require("../../service/UI/UIEvents");
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
var eventEmitter = new EventEmitter();
var connection = null;
@ -14,13 +17,12 @@ function connect(jid, password, uiCredentials) {
connection = new Strophe.Connection(bosh);
Moderator.setConnection(connection);
var settings = UI.getSettings();
var email = settings.email;
var displayName = settings.displayName;
var email = uiCredentials.email;
var displayName = uiCredentials.displayName;
if(email) {
connection.emuc.addEmailToPresence(email);
} else {
connection.emuc.addUserIdToPresence(settings.uid);
connection.emuc.addUserIdToPresence(uiCredentials.uid);
}
if(displayName) {
connection.emuc.addDisplayNameToPresence(displayName);
@ -29,7 +31,7 @@ function connect(jid, password, uiCredentials) {
if (connection.disco) {
// for chrome, add multistream cap
}
connection.jingle.pc_constraints = RTC.getPCConstraints();
connection.jingle.pc_constraints = APP.RTC.getPCConstraints();
if (config.useIPv6) {
// https://code.google.com/p/webrtc/issues/detail?id=2828
if (!connection.jingle.pc_constraints.optional)
@ -48,7 +50,7 @@ function connect(jid, password, uiCredentials) {
if (config.useStunTurn) {
connection.jingle.getStunAndTurnCredentials();
}
UI.disableConnect();
APP.UI.disableConnect();
console.info("My Jabber ID: " + connection.jid);
@ -77,17 +79,17 @@ function connect(jid, password, uiCredentials) {
function maybeDoJoin() {
if (connection && connection.connected &&
Strophe.getResourceFromJid(connection.jid)
&& (RTC.localAudio || RTC.localVideo)) {
&& (APP.RTC.localAudio || APP.RTC.localVideo)) {
// .connected is true while connecting?
doJoin();
}
}
function doJoin() {
var roomName = UI.generateRoomName();
var roomName = APP.UI.generateRoomName();
Moderator.allocateConferenceFocus(
roomName, UI.checkForNicknameAndJoin);
roomName, APP.UI.checkForNicknameAndJoin);
}
function initStrophePlugins()
@ -101,9 +103,9 @@ function initStrophePlugins()
}
function registerListeners() {
RTC.addStreamListener(maybeDoJoin,
APP.RTC.addStreamListener(maybeDoJoin,
StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {
APP.UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {
XMPP.addToPresence("displayName", nickname);
});
}
@ -160,7 +162,7 @@ var XMPP = {
connect(jid, null, uiCredentials);
},
promptLogin: function () {
UI.showLoginPopup(connect);
APP.UI.showLoginPopup(connect);
},
joinRoom: function(roomName, useNicks, nick)
{
@ -200,11 +202,11 @@ var XMPP = {
if (handler && handler.peerconnection) {
// FIXME: probably removing streams is not required and close() should
// be enough
if (RTC.localAudio) {
handler.peerconnection.removeStream(RTC.localAudio.getOriginalStream(), onUnload);
if (APP.RTC.localAudio) {
handler.peerconnection.removeStream(APP.RTC.localAudio.getOriginalStream(), onUnload);
}
if (RTC.localVideo) {
handler.peerconnection.removeStream(RTC.localVideo.getOriginalStream(), onUnload);
if (APP.RTC.localVideo) {
handler.peerconnection.removeStream(APP.RTC.localVideo.getOriginalStream(), onUnload);
}
handler.peerconnection.close();
}
@ -247,13 +249,13 @@ var XMPP = {
}
},
setVideoMute: function (mute, callback, options) {
if(connection && RTC.localVideo && connection.jingle.activecall)
if(connection && APP.RTC.localVideo && connection.jingle.activecall)
{
connection.jingle.activecall.setVideoMute(mute, callback, options);
}
},
setAudioMute: function (mute, callback) {
if (!(connection && RTC.localAudio)) {
if (!(connection && APP.RTC.localAudio)) {
return false;
}
@ -265,7 +267,7 @@ var XMPP = {
this.forceMuted = false;
}
if (mute == RTC.localAudio.isMuted()) {
if (mute == APP.RTC.localAudio.isMuted()) {
// Nothing to do
return true;
}
@ -273,7 +275,7 @@ var XMPP = {
// It is not clear what is the right way to handle multiple tracks.
// So at least make sure that they are all muted or all unmuted and
// that we send presence just once.
RTC.localAudio.mute();
APP.RTC.localAudio.mute();
// isMuted is the opposite of audioEnabled
connection.emuc.addAudioInfoToPresence(mute);
connection.emuc.sendPresence();
@ -303,7 +305,7 @@ var XMPP = {
},
function (error) {
console.log('mute SLD error');
UI.messageHandler.showError('Error',
APP.UI.messageHandler.showError('Error',
'Oops! Something went wrong and we failed to ' +
'mute! (SLD Failure)');
}
@ -311,13 +313,13 @@ var XMPP = {
},
function (error) {
console.log(error);
UI.messageHandler.showError();
APP.UI.messageHandler.showError();
}
);
},
function (error) {
console.log('muteVideo SRD error');
UI.messageHandler.showError('Error',
APP.UI.messageHandler.showError('Error',
'Oops! Something went wrong and we failed to stop video!' +
'(SRD Failure)');

View File

@ -3,5 +3,4 @@ var MediaStreamType = {
AUDIO_TYPE: "Audio"
};
////These lines should be uncommented when require works in app.js
//module.exports = MediaStreamType;
module.exports = MediaStreamType;

View File

@ -4,4 +4,4 @@ var RTCBrowserType = {
RTC_BROWSER_FIREFOX: "rtc_browser.firefox"
};
//module.exports = RTCBrowserType;
module.exports = RTCBrowserType;

View File

@ -6,4 +6,6 @@ var RTCEvents = {
SIMULCAST_LAYER_CHANGING: "rtc.simulcast_layer_changing",
SIMULCAST_START: "rtc.simlcast_start",
SIMULCAST_STOP: "rtc.simlcast_stop"
}
};
module.exports = RTCEvents;

View File

@ -10,5 +10,4 @@ var StreamEventTypes = {
EVENT_TYPE_REMOTE_ENDED: "stream.remote_ended"
};
//These lines should be uncommented when require works in app.js
//module.exports = StreamEventTypes;
module.exports = StreamEventTypes;

View File

@ -3,4 +3,4 @@ var UIEvents = {
SELECTED_ENDPOINT: "UI.selected_endpoint",
PINNED_ENDPOINT: "UI.pinned_endpoint"
};
//module.exports = UIEvents;
module.exports = UIEvents;

View File

@ -2,4 +2,6 @@ var CQEvents = {
LOCALSTATS_UPDATED: "cq.localstats_updated",
REMOTESTATS_UPDATED: "cq.remotestats_updated",
STOP: "cq.stop"
};
};
module.exports = CQEvents;

View File

@ -6,5 +6,4 @@ var DesktopSharingEventTypes = {
NEW_STREAM_CREATED: "ds.new_stream_created"
};
//These lines should be uncommented when require works in app.js
//module.exports = NEW_STREAM_CREATED;
module.exports = DesktopSharingEventTypes;

View File

@ -23,4 +23,4 @@ var XMPPEvents = {
CHAT_ERROR_RECEIVED: "xmpp.chat_error_received",
ETHERPAD: "xmpp.etherpad"
};
//module.exports = XMPPEvents;
module.exports = XMPPEvents;