Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Updates app.bundle.js

George Politis6eaa3cd45d40
diff --git a/index.html b/index.html
index 776881a243..47e8d1a54e 100644
--- a/index.html
+++ b/index.html
@@ -19,7 +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="libs/app.bundle.js?v=75"></script>
+ <script src="libs/app.bundle.js?v=76"></script>
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
<link rel="stylesheet" href="css/font.css?v=7"/>
<link rel="stylesheet" href="css/toastr.css?v=1">
diff --git a/libs/app.bundle.js b/libs/app.bundle.js
index e22ec7ee22..caece6bba5 100644
--- a/libs/app.bundle.js
+++ b/libs/app.bundle.js
@@ -1,65 +1,4 @@
-!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.APP=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){
-/* 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");
- this.translation = require("./modules/translation/translation");
- this.settings = require("./modules/settings/Settings");
- this.DTMF = require("./modules/DTMF/DTMF");
- this.members = require("./modules/members/MemberList");
- }
-};
-
-function init() {
-
- APP.RTC.start();
- APP.xmpp.start();
- APP.statistics.start();
- APP.connectionquality.init();
-
- // Set default desktop sharing method
- APP.desktopsharing.init();
-
- APP.keyboardshortcut.init();
- APP.members.start();
-}
-
-
-$(document).ready(function () {
-
- var URLPRocessor = require("./modules/URLProcessor/URLProcessor");
- URLPRocessor.setConfigParametersFromUrl();
- APP.init();
-
- APP.translation.init();
-
- if(APP.API.isEnabled())
- APP.API.init();
-
- APP.UI.start(init);
-
-});
-
-$(window).bind('beforeunload', function () {
- if(APP.API.isEnabled())
- APP.API.dispose();
-});
-
-module.exports = APP;
-
-
-},{"./modules/API/API":2,"./modules/DTMF/DTMF":3,"./modules/RTC/RTC":7,"./modules/UI/UI":9,"./modules/URLProcessor/URLProcessor":36,"./modules/connectionquality/connectionquality":37,"./modules/desktopsharing/desktopsharing":38,"./modules/keyboardshortcut/keyboardshortcut":39,"./modules/members/MemberList":40,"./modules/settings/Settings":41,"./modules/simulcast/simulcast":46,"./modules/statistics/statistics":49,"./modules/translation/translation":50,"./modules/xmpp/xmpp":64}],2:[function(require,module,exports){
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.APP = f()}})(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
@@ -291,7 +230,7 @@ var API = {
};
module.exports = API;
-},{"../../service/xmpp/XMPPEvents":105}],3:[function(require,module,exports){
+},{"../../service/xmpp/XMPPEvents":106}],2:[function(require,module,exports){
/* global APP */
/**
@@ -340,7 +279,7 @@ var DTMF = {
module.exports = DTMF;
-},{}],4:[function(require,module,exports){
+},{}],3:[function(require,module,exports){
/* global Strophe, focusedVideoSrc*/
// cache datachannels to avoid garbage collection
@@ -576,7 +515,7 @@ function onPinnedEndpointChanged(userResource)
module.exports = DataChannels;
-},{"../../service/RTC/RTCEvents":96}],5:[function(require,module,exports){
+},{"../../service/RTC/RTCEvents":97}],4:[function(require,module,exports){
var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
@@ -684,7 +623,7 @@ LocalStream.prototype.getId = function () {
module.exports = LocalStream;
-},{"../../service/RTC/StreamEventTypes.js":98}],6:[function(require,module,exports){
+},{"../../service/RTC/StreamEventTypes.js":99}],5:[function(require,module,exports){
////These lines should be uncommented when require works in app.js
var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
var StreamEventType = require("../../service/RTC/StreamEventTypes");
@@ -746,7 +685,7 @@ MediaStream.prototype.setVideoType = function (value) {
module.exports = MediaStream;
-},{"../../service/RTC/MediaStreamTypes":94,"../../service/RTC/StreamEventTypes":98}],7:[function(require,module,exports){
+},{"../../service/RTC/MediaStreamTypes":95,"../../service/RTC/StreamEventTypes":99}],6:[function(require,module,exports){
var EventEmitter = require("events");
var RTCUtils = require("./RTCUtils.js");
var LocalStream = require("./LocalStream.js");
@@ -1032,7 +971,7 @@ var RTC = {
module.exports = RTC;
-},{"../../service/RTC/MediaStreamTypes":94,"../../service/RTC/RTCEvents.js":96,"../../service/RTC/StreamEventTypes.js":98,"../../service/UI/UIEvents":99,"../../service/desktopsharing/DesktopSharingEventTypes":102,"../../service/xmpp/XMPPEvents":105,"./DataChannels":4,"./LocalStream.js":5,"./MediaStream.js":6,"./RTCUtils.js":8,"events":106}],8:[function(require,module,exports){
+},{"../../service/RTC/MediaStreamTypes":95,"../../service/RTC/RTCEvents.js":97,"../../service/RTC/StreamEventTypes.js":99,"../../service/UI/UIEvents":100,"../../service/desktopsharing/DesktopSharingEventTypes":103,"../../service/xmpp/XMPPEvents":106,"./DataChannels":3,"./LocalStream.js":4,"./MediaStream.js":5,"./RTCUtils.js":7,"events":66}],7:[function(require,module,exports){
var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
var Resolutions = require("../../service/RTC/Resolutions");
@@ -1165,7 +1104,7 @@ function RTCUtils(RTCService)
if (navigator.mozGetUserMedia) {
console.log('This appears to be Firefox');
var version = parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1], 10);
- if (version >= 38
+ if (version >= 40
&& !config.enableSimulcast && config.useBundle && config.useRtcpMux) {
this.peerconnection = mozRTCPeerConnection;
this.browser = RTCBrowserType.RTC_BROWSER_FIREFOX;
@@ -1530,7 +1469,7 @@ RTCUtils.prototype.createStream = function(stream, isVideo)
module.exports = RTCUtils;
-},{"../../service/RTC/RTCBrowserType.js":95,"../../service/RTC/Resolutions":97}],9:[function(require,module,exports){
+},{"../../service/RTC/RTCBrowserType.js":96,"../../service/RTC/Resolutions":98}],8:[function(require,module,exports){
var UI = {};
var VideoLayout = require("./videolayout/VideoLayout.js");
@@ -2349,7 +2288,7 @@ UI.setVideoMute = setVideoMute;
module.exports = UI;
-},{"../../service/RTC/RTCEvents":96,"../../service/RTC/StreamEventTypes":98,"../../service/connectionquality/CQEvents":101,"../../service/desktopsharing/DesktopSharingEventTypes":102,"../../service/members/Events":103,"../../service/xmpp/XMPPEvents":105,"./../settings/Settings":41,"./audio_levels/AudioLevels.js":10,"./authentication/Authentication":12,"./avatar/Avatar":14,"./etherpad/Etherpad.js":15,"./prezi/Prezi.js":16,"./side_pannels/SidePanelToggler":18,"./side_pannels/chat/Chat.js":19,"./side_pannels/contactlist/ContactList":23,"./side_pannels/settings/SettingsMenu":24,"./toolbars/BottomToolbar":25,"./toolbars/Toolbar":26,"./toolbars/ToolbarToggler":27,"./util/MessageHandler":29,"./util/NicknameHandler":30,"./util/UIUtil":31,"./videolayout/VideoLayout.js":33,"./welcome_page/RoomnameGenerator":34,"./welcome_page/WelcomePage":35,"events":106}],10:[function(require,module,exports){
+},{"../../service/RTC/RTCEvents":97,"../../service/RTC/StreamEventTypes":99,"../../service/connectionquality/CQEvents":102,"../../service/desktopsharing/DesktopSharingEventTypes":103,"../../service/members/Events":104,"../../service/xmpp/XMPPEvents":106,"./../settings/Settings":40,"./audio_levels/AudioLevels.js":9,"./authentication/Authentication":11,"./avatar/Avatar":13,"./etherpad/Etherpad.js":14,"./prezi/Prezi.js":15,"./side_pannels/SidePanelToggler":17,"./side_pannels/chat/Chat.js":18,"./side_pannels/contactlist/ContactList":22,"./side_pannels/settings/SettingsMenu":23,"./toolbars/BottomToolbar":24,"./toolbars/Toolbar":25,"./toolbars/ToolbarToggler":26,"./util/MessageHandler":28,"./util/NicknameHandler":29,"./util/UIUtil":30,"./videolayout/VideoLayout.js":32,"./welcome_page/RoomnameGenerator":33,"./welcome_page/WelcomePage":34,"events":66}],9:[function(require,module,exports){
var CanvasUtil = require("./CanvasUtils");
var ASDrawContext = $('#activeSpeakerAudioLevel')[0].getContext('2d');
@@ -2615,7 +2554,7 @@ var AudioLevels = (function(my) {
})(AudioLevels || {});
module.exports = AudioLevels;
-},{"./CanvasUtils":11}],11:[function(require,module,exports){
+},{"./CanvasUtils":10}],10:[function(require,module,exports){
/**
* Utility class for drawing canvas shapes.
*/
@@ -2727,7 +2666,7 @@ var CanvasUtil = (function(my) {
})(CanvasUtil || {});
module.exports = CanvasUtil;
-},{}],12:[function(require,module,exports){
+},{}],11:[function(require,module,exports){
/* global $, APP*/
var LoginDialog = require('./LoginDialog');
@@ -2852,7 +2791,7 @@ var Authentication = {
};
module.exports = Authentication;
-},{"../../xmpp/moderator":56,"./LoginDialog":13}],13:[function(require,module,exports){
+},{"../../xmpp/moderator":55,"./LoginDialog":12}],12:[function(require,module,exports){
/* global $, APP, config*/
var XMPP = require('../../xmpp/xmpp');
@@ -3081,7 +3020,7 @@ var LoginDialog = {
};
module.exports = LoginDialog;
-},{"../../xmpp/moderator":56,"../../xmpp/xmpp":64}],14:[function(require,module,exports){
+},{"../../xmpp/moderator":55,"../../xmpp/xmpp":63}],13:[function(require,module,exports){
var Settings = require("../../settings/Settings");
var MediaStreamType = require("../../../service/RTC/MediaStreamTypes");
@@ -3244,7 +3183,7 @@ var Avatar = {
module.exports = Avatar;
-},{"../../../service/RTC/MediaStreamTypes":94,"../../settings/Settings":41,"../videolayout/VideoLayout":33}],15:[function(require,module,exports){
+},{"../../../service/RTC/MediaStreamTypes":95,"../../settings/Settings":40,"../videolayout/VideoLayout":32}],14:[function(require,module,exports){
/* global $, config,
setLargeVideoVisible, Util */
@@ -3440,7 +3379,7 @@ var Etherpad = {
module.exports = Etherpad;
-},{"../prezi/Prezi":16,"../util/UIUtil":31,"../videolayout/VideoLayout":33}],16:[function(require,module,exports){
+},{"../prezi/Prezi":15,"../util/UIUtil":30,"../videolayout/VideoLayout":32}],15:[function(require,module,exports){
var ToolbarToggler = require("../toolbars/ToolbarToggler");
var UIUtil = require("../util/UIUtil");
var VideoLayout = require("../videolayout/VideoLayout");
@@ -3816,7 +3755,7 @@ $(window).resize(function () {
module.exports = Prezi;
-},{"../toolbars/ToolbarToggler":27,"../util/MessageHandler":29,"../util/UIUtil":31,"../videolayout/VideoLayout":33,"./PreziPlayer":17}],17:[function(require,module,exports){
+},{"../toolbars/ToolbarToggler":26,"../util/MessageHandler":28,"../util/UIUtil":30,"../videolayout/VideoLayout":32,"./PreziPlayer":16}],16:[function(require,module,exports){
(function() {
"use strict";
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
@@ -4112,7 +4051,7 @@ module.exports = Prezi;
module.exports = PreziPlayer;
-},{}],18:[function(require,module,exports){
+},{}],17:[function(require,module,exports){
var Chat = require("./chat/Chat");
var ContactList = require("./contactlist/ContactList");
var Settings = require("./../../settings/Settings");
@@ -4369,7 +4308,7 @@ var PanelToggler = (function(my) {
}(PanelToggler || {}));
module.exports = PanelToggler;
-},{"../toolbars/ToolbarToggler":27,"../util/UIUtil":31,"../videolayout/VideoLayout":33,"./../../settings/Settings":41,"./chat/Chat":19,"./contactlist/ContactList":23,"./settings/SettingsMenu":24}],19:[function(require,module,exports){
+},{"../toolbars/ToolbarToggler":26,"../util/UIUtil":30,"../videolayout/VideoLayout":32,"./../../settings/Settings":40,"./chat/Chat":18,"./contactlist/ContactList":22,"./settings/SettingsMenu":23}],18:[function(require,module,exports){
/* global $, Util, nickname:true */
var Replacement = require("./Replacement");
var CommandsProcessor = require("./Commands");
@@ -4727,7 +4666,7 @@ var Chat = (function (my) {
return my;
}(Chat || {}));
module.exports = Chat;
-},{"../../../../service/UI/UIEvents":99,"../../toolbars/ToolbarToggler":27,"../../util/NicknameHandler":30,"../../util/UIUtil":31,"../SidePanelToggler":18,"./Commands":20,"./Replacement":21,"./smileys.json":22}],20:[function(require,module,exports){
+},{"../../../../service/UI/UIEvents":100,"../../toolbars/ToolbarToggler":26,"../../util/NicknameHandler":29,"../../util/UIUtil":30,"../SidePanelToggler":17,"./Commands":19,"./Replacement":20,"./smileys.json":21}],19:[function(require,module,exports){
var UIUtil = require("../../util/UIUtil");
/**
@@ -4825,7 +4764,7 @@ CommandsProcessor.prototype.processCommand = function()
};
module.exports = CommandsProcessor;
-},{"../../util/UIUtil":31}],21:[function(require,module,exports){
+},{"../../util/UIUtil":30}],20:[function(require,module,exports){
var Smileys = require("./smileys.json");
/**
* Processes links and smileys in "body"
@@ -4889,7 +4828,7 @@ module.exports = {
linkify: linkify
};
-},{"./smileys.json":22}],22:[function(require,module,exports){
+},{"./smileys.json":21}],21:[function(require,module,exports){
module.exports={
"smileys": {
"smiley1": ":)",
@@ -4939,7 +4878,7 @@ module.exports={
}
}
-},{}],23:[function(require,module,exports){
+},{}],22:[function(require,module,exports){
var numberOfContacts = 0;
var notificationInterval;
@@ -5129,7 +5068,7 @@ var ContactList = {
};
module.exports = ContactList;
-},{}],24:[function(require,module,exports){
+},{}],23:[function(require,module,exports){
var Avatar = require("../../avatar/Avatar");
var Settings = require("./../../../settings/Settings");
var UIUtil = require("../../util/UIUtil");
@@ -5239,7 +5178,7 @@ var SettingsMenu = {
module.exports = SettingsMenu;
-},{"../../../../service/translation/languages":104,"../../avatar/Avatar":14,"../../util/UIUtil":31,"./../../../settings/Settings":41}],25:[function(require,module,exports){
+},{"../../../../service/translation/languages":105,"../../avatar/Avatar":13,"../../util/UIUtil":30,"./../../../settings/Settings":40}],24:[function(require,module,exports){
var PanelToggler = require("../side_pannels/SidePanelToggler");
var buttonHandlers = {
@@ -5284,7 +5223,7 @@ var BottomToolbar = (function (my) {
module.exports = BottomToolbar;
-},{"../side_pannels/SidePanelToggler":18}],26:[function(require,module,exports){
+},{"../side_pannels/SidePanelToggler":17}],25:[function(require,module,exports){
/* global APP,$, buttonClick, config, lockRoom,
setSharedKey, Util */
var messageHandler = require("../util/MessageHandler");
@@ -5933,7 +5872,7 @@ var Toolbar = (function (my) {
}(Toolbar || {}));
module.exports = Toolbar;
-},{"../../../service/authentication/AuthenticationEvents":100,"../authentication/Authentication":12,"../etherpad/Etherpad":15,"../prezi/Prezi":16,"../side_pannels/SidePanelToggler":18,"../util/MessageHandler":29,"../util/UIUtil":31,"./BottomToolbar":25}],27:[function(require,module,exports){
+},{"../../../service/authentication/AuthenticationEvents":101,"../authentication/Authentication":11,"../etherpad/Etherpad":14,"../prezi/Prezi":15,"../side_pannels/SidePanelToggler":17,"../util/MessageHandler":28,"../util/UIUtil":30,"./BottomToolbar":24}],26:[function(require,module,exports){
/* global $, interfaceConfig, Moderator, DesktopStreaming.showDesktopSharingButton */
var toolbarTimeoutObject,
@@ -6051,7 +5990,7 @@ var ToolbarToggler = {
};
module.exports = ToolbarToggler;
-},{}],28:[function(require,module,exports){
+},{}],27:[function(require,module,exports){
var JitsiPopover = (function () {
/**
* Constructs new JitsiPopover and attaches it to the element
@@ -6175,7 +6114,7 @@ var JitsiPopover = (function () {
})();
module.exports = JitsiPopover;
-},{}],29:[function(require,module,exports){
+},{}],28:[function(require,module,exports){
/* global $, APP, jQuery, toastr */
var messageHandler = (function(my) {
@@ -6383,7 +6322,7 @@ module.exports = messageHandler;
-},{}],30:[function(require,module,exports){
+},{}],29:[function(require,module,exports){
var UIEvents = require("../../../service/UI/UIEvents");
var nickname = null;
@@ -6414,7 +6353,7 @@ var NickanameHandler = {
};
module.exports = NickanameHandler;
-},{"../../../service/UI/UIEvents":99}],31:[function(require,module,exports){
+},{"../../../service/UI/UIEvents":100}],30:[function(require,module,exports){
/**
* Created by hristo on 12/22/14.
*/
@@ -6496,7 +6435,7 @@ module.exports = {
};
-},{"../side_pannels/SidePanelToggler":18}],32:[function(require,module,exports){
+},{"../side_pannels/SidePanelToggler":17}],31:[function(require,module,exports){
var JitsiPopover = require("../util/JitsiPopover");
/**
@@ -6924,7 +6863,7 @@ ConnectionIndicator.prototype.hideIndicator = function () {
};
module.exports = ConnectionIndicator;
-},{"../util/JitsiPopover":28}],33:[function(require,module,exports){
+},{"../util/JitsiPopover":27}],32:[function(require,module,exports){
var AudioLevels = require("../audio_levels/AudioLevels");
var Avatar = require("../avatar/Avatar");
var Chat = require("../side_pannels/chat/Chat");
@@ -9247,7 +9186,7 @@ var VideoLayout = (function (my) {
}(VideoLayout || {}));
module.exports = VideoLayout;
-},{"../../../service/RTC/MediaStreamTypes":94,"../../../service/UI/UIEvents":99,"../audio_levels/AudioLevels":10,"../avatar/Avatar":14,"../etherpad/Etherpad":15,"../prezi/Prezi":16,"../side_pannels/chat/Chat":19,"../side_pannels/contactlist/ContactList":23,"../util/NicknameHandler":30,"../util/UIUtil":31,"./ConnectionIndicator":32}],34:[function(require,module,exports){
+},{"../../../service/RTC/MediaStreamTypes":95,"../../../service/UI/UIEvents":100,"../audio_levels/AudioLevels":9,"../avatar/Avatar":13,"../etherpad/Etherpad":14,"../prezi/Prezi":15,"../side_pannels/chat/Chat":18,"../side_pannels/contactlist/ContactList":22,"../util/NicknameHandler":29,"../util/UIUtil":30,"./ConnectionIndicator":31}],33:[function(require,module,exports){
//var nouns = [
//];
var pluralNouns = [
@@ -9428,7 +9367,7 @@ var RoomNameGenerator = {
module.exports = RoomNameGenerator;
-},{}],35:[function(require,module,exports){
+},{}],34:[function(require,module,exports){
var animateTimeout, updateTimeout;
var RoomNameGenerator = require("./RoomnameGenerator");
@@ -9530,7 +9469,7 @@ function setupWelcomePage()
}
module.exports = setupWelcomePage;
-},{"./RoomnameGenerator":34}],36:[function(require,module,exports){
+},{"./RoomnameGenerator":33}],35:[function(require,module,exports){
var params = {};
function getConfigParamsFromUrl() {
if(!location.hash)
@@ -9571,7 +9510,7 @@ var URLProcessor = {
};
module.exports = URLProcessor;
-},{}],37:[function(require,module,exports){
+},{}],36:[function(require,module,exports){
var EventEmitter = require("events");
var eventEmitter = new EventEmitter();
var CQEvents = require("../../service/connectionquality/CQEvents");
@@ -9706,7 +9645,7 @@ var ConnectionQuality = {
};
module.exports = ConnectionQuality;
-},{"../../service/connectionquality/CQEvents":101,"../../service/xmpp/XMPPEvents":105,"events":106}],38:[function(require,module,exports){
+},{"../../service/connectionquality/CQEvents":102,"../../service/xmpp/XMPPEvents":106,"events":66}],37:[function(require,module,exports){
/* global $, alert, APP, changeLocalVideo, chrome, config, getConferenceHandler,
getUserMediaWithConstraints */
/**
@@ -10074,7 +10013,7 @@ module.exports = {
};
-},{"../../service/desktopsharing/DesktopSharingEventTypes":102,"events":106}],39:[function(require,module,exports){
+},{"../../service/desktopsharing/DesktopSharingEventTypes":103,"events":66}],38:[function(require,module,exports){
//maps keycode to character, id of popover for given function and function
var shortcuts = {
67: {
@@ -10167,7 +10106,7 @@ var KeyboardShortcut = {
module.exports = KeyboardShortcut;
-},{}],40:[function(require,module,exports){
+},{}],39:[function(require,module,exports){
/* global APP */
/**
@@ -10298,7 +10237,7 @@ var Members = {
module.exports = Members;
-},{"../../service/members/Events":103,"../../service/xmpp/XMPPEvents":105,"events":106}],41:[function(require,module,exports){
+},{"../../service/members/Events":104,"../../service/xmpp/XMPPEvents":106,"events":66}],40:[function(require,module,exports){
var email = '';
var displayName = '';
var userId;
@@ -10365,7 +10304,7 @@ var Settings =
module.exports = Settings;
-},{}],42:[function(require,module,exports){
+},{}],41:[function(require,module,exports){
/**
*
* @constructor
@@ -10398,7 +10337,7 @@ SimulcastLogger.prototype.error = function (text) {
};
module.exports = SimulcastLogger;
-},{}],43:[function(require,module,exports){
+},{}],42:[function(require,module,exports){
var SimulcastLogger = require("./SimulcastLogger");
var SimulcastUtils = require("./SimulcastUtils");
var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
@@ -10667,7 +10606,7 @@ SimulcastReceiver.prototype.transformRemoteDescription = function (desc) {
};
module.exports = SimulcastReceiver;
-},{"../../service/RTC/MediaStreamTypes":94,"./SimulcastLogger":42,"./SimulcastUtils":45}],44:[function(require,module,exports){
+},{"../../service/RTC/MediaStreamTypes":95,"./SimulcastLogger":41,"./SimulcastUtils":44}],43:[function(require,module,exports){
var SimulcastLogger = require("./SimulcastLogger");
var SimulcastUtils = require("./SimulcastUtils");
@@ -11190,7 +11129,7 @@ module.exports = {
"no": NoSimulcastSender
}
-},{"./SimulcastLogger":42,"./SimulcastUtils":45}],45:[function(require,module,exports){
+},{"./SimulcastLogger":41,"./SimulcastUtils":44}],44:[function(require,module,exports){
var SimulcastLogger = require("./SimulcastLogger");
/**
@@ -11424,7 +11363,7 @@ SimulcastUtils.prototype._compileVideoSources = function (videoSources) {
};
module.exports = SimulcastUtils;
-},{"./SimulcastLogger":42}],46:[function(require,module,exports){
+},{"./SimulcastLogger":41}],45:[function(require,module,exports){
/*jslint plusplus: true */
/*jslint nomen: true*/
@@ -11627,7 +11566,7 @@ SimulcastManager.prototype.resetSender = function() {
var simulcast = new SimulcastManager();
module.exports = simulcast;
-},{"../../service/RTC/RTCEvents":96,"./SimulcastReceiver":43,"./SimulcastSender":44,"./SimulcastUtils":45}],47:[function(require,module,exports){
+},{"../../service/RTC/RTCEvents":97,"./SimulcastReceiver":42,"./SimulcastSender":43,"./SimulcastUtils":44}],46:[function(require,module,exports){
/**
* Provides statistics for the local stream.
*/
@@ -11758,7 +11697,7 @@ LocalStatsCollector.prototype.stop = function () {
};
module.exports = LocalStatsCollector;
-},{}],48:[function(require,module,exports){
+},{}],47:[function(require,module,exports){
/* global ssrc2jid */
/* jshint -W117 */
var RTCBrowserType = require("../../service/RTC/RTCBrowserType");
@@ -12500,7 +12439,7 @@ StatsCollector.prototype.processAudioLevelReport = function ()
};
-},{"../../service/RTC/RTCBrowserType":95}],49:[function(require,module,exports){
+},{"../../service/RTC/RTCBrowserType":96}],48:[function(require,module,exports){
/**
* Created by hristo on 8/4/14.
*/
@@ -12633,7 +12572,7 @@ var statistics =
module.exports = statistics;
-},{"../../service/RTC/StreamEventTypes.js":98,"../../service/xmpp/XMPPEvents":105,"./LocalStatsCollector.js":47,"./RTPStatsCollector.js":48,"events":106}],50:[function(require,module,exports){
+},{"../../service/RTC/StreamEventTypes.js":99,"../../service/xmpp/XMPPEvents":106,"./LocalStatsCollector.js":46,"./RTPStatsCollector.js":47,"events":66}],49:[function(require,module,exports){
var i18n = require("i18next-client");
var languages = require("../../service/translation/languages");
var Settings = require("../settings/Settings");
@@ -12767,7 +12706,7 @@ module.exports = {
}
};
-},{"../../service/translation/languages":104,"../settings/Settings":41,"i18next-client":66}],51:[function(require,module,exports){
+},{"../../service/translation/languages":105,"../settings/Settings":40,"i18next-client":67}],50:[function(require,module,exports){
/* jshint -W117 */
var TraceablePeerConnection = require("./TraceablePeerConnection");
var SDPDiffer = require("./SDPDiffer");
@@ -14160,7 +14099,7 @@ JingleSession.prototype.remoteStreamAdded = function (data, times) {
module.exports = JingleSession;
-},{"../../service/RTC/RTCBrowserType":95,"./SDP":52,"./SDPDiffer":53,"./SDPUtil":54,"./TraceablePeerConnection":55,"async":65}],52:[function(require,module,exports){
+},{"../../service/RTC/RTCBrowserType":96,"./SDP":51,"./SDPDiffer":52,"./SDPUtil":53,"./TraceablePeerConnection":54,"async":64}],51:[function(require,module,exports){
/* jshint -W117 */
var SDPUtil = require("./SDPUtil");
@@ -14782,7 +14721,7 @@ SDP.prototype.jingle2media = function (content) {
module.exports = SDP;
-},{"./SDPUtil":54}],53:[function(require,module,exports){
+},{"./SDPUtil":53}],52:[function(require,module,exports){
function SDPDiffer(mySDP, otherSDP) {
this.mySDP = mySDP;
this.otherSDP = otherSDP;
@@ -14948,7 +14887,7 @@ SDPDiffer.prototype.toJingle = function(modify) {
};
module.exports = SDPDiffer;
-},{}],54:[function(require,module,exports){
+},{}],53:[function(require,module,exports){
SDPUtil = {
iceparams: function (mediadesc, sessiondesc) {
var data = null;
@@ -15298,7 +15237,7 @@ SDPUtil = {
}
};
module.exports = SDPUtil;
-},{}],55:[function(require,module,exports){
+},{}],54:[function(require,module,exports){
function TraceablePeerConnection(ice_config, constraints) {
var self = this;
var RTCPeerconnection = navigator.mozGetUserMedia ? mozRTCPeerConnection : webkitRTCPeerConnection;
@@ -15618,7 +15557,7 @@ TraceablePeerConnection.prototype.getStats = function(callback, errback) {
module.exports = TraceablePeerConnection;
-},{"sdp-interop":87}],56:[function(require,module,exports){
+},{"sdp-interop":88}],55:[function(require,module,exports){
/* global $, $iq, APP, config, connection, UI, messageHandler,
roomName, sessionTerminated, Strophe, Util */
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
@@ -16050,7 +15989,7 @@ module.exports = Moderator;
-},{"../../service/authentication/AuthenticationEvents":100,"../../service/xmpp/XMPPEvents":105,"../settings/Settings":41}],57:[function(require,module,exports){
+},{"../../service/authentication/AuthenticationEvents":101,"../../service/xmpp/XMPPEvents":106,"../settings/Settings":40}],56:[function(require,module,exports){
/* global $, $iq, config, connection, focusMucJid, messageHandler, Moderator,
Toolbar, Util */
var Moderator = require("./moderator");
@@ -16206,7 +16145,7 @@ var Recording = {
}
module.exports = Recording;
-},{"./moderator":56}],58:[function(require,module,exports){
+},{"./moderator":55}],57:[function(require,module,exports){
/* jshint -W117 */
/* a simple MUC connection plugin
* can only handle a single MUC room
@@ -16899,7 +16838,7 @@ module.exports = function(XMPP, eventEmitter) {
};
-},{"../../service/xmpp/XMPPEvents":105,"./JingleSession":51,"./moderator":56}],59:[function(require,module,exports){
+},{"../../service/xmpp/XMPPEvents":106,"./JingleSession":50,"./moderator":55}],58:[function(require,module,exports){
/* jshint -W117 */
var JingleSession = require("./JingleSession");
@@ -17246,7 +17185,7 @@ module.exports = function(XMPP, eventEmitter)
};
-},{"../../service/xmpp/XMPPEvents":105,"./JingleSession":51}],60:[function(require,module,exports){
+},{"../../service/xmpp/XMPPEvents":106,"./JingleSession":50}],59:[function(require,module,exports){
/* global Strophe */
module.exports = function () {
@@ -17267,7 +17206,7 @@ module.exports = function () {
}
});
};
-},{}],61:[function(require,module,exports){
+},{}],60:[function(require,module,exports){
/* global $, $iq, config, connection, focusMucJid, forceMuted,
setAudioMuted, Strophe */
/**
@@ -17326,7 +17265,7 @@ module.exports = function (XMPP) {
}
});
}
-},{}],62:[function(require,module,exports){
+},{}],61:[function(require,module,exports){
/* jshint -W117 */
module.exports = function() {
Strophe.addConnectionPlugin('rayo',
@@ -17423,7 +17362,7 @@ module.exports = function() {
);
};
-},{}],63:[function(require,module,exports){
+},{}],62:[function(require,module,exports){
/**
* Strophe logger implementation. Logs from level WARN and above.
*/
@@ -17467,7 +17406,7 @@ module.exports = function () {
};
};
-},{}],64:[function(require,module,exports){
+},{}],63:[function(require,module,exports){
/* global $, APP, config, Strophe*/
var Moderator = require("./moderator");
var EventEmitter = require("events");
@@ -18083,7 +18022,7 @@ var XMPP = {
module.exports = XMPP;
-},{"../../service/RTC/RTCEvents":96,"../../service/RTC/StreamEventTypes":98,"../../service/UI/UIEvents":99,"../../service/xmpp/XMPPEvents":105,"../settings/Settings":41,"./SDP":52,"./moderator":56,"./recording":57,"./strophe.emuc":58,"./strophe.jingle":59,"./strophe.logger":60,"./strophe.moderate":61,"./strophe.rayo":62,"./strophe.util":63,"events":106,"pako":67,"retry":83}],65:[function(require,module,exports){
+},{"../../service/RTC/RTCEvents":97,"../../service/RTC/StreamEventTypes":99,"../../service/UI/UIEvents":100,"../../service/xmpp/XMPPEvents":106,"../settings/Settings":40,"./SDP":51,"./moderator":55,"./recording":56,"./strophe.emuc":57,"./strophe.jingle":58,"./strophe.logger":59,"./strophe.moderate":60,"./strophe.rayo":61,"./strophe.util":62,"events":66,"pako":68,"retry":84}],64:[function(require,module,exports){
(function (process){
/*!
* async
@@ -19210,158 +19149,553 @@ module.exports = XMPP;
}());
}).call(this,require('_process'))
-},{"_process":107}],66:[function(require,module,exports){
-// i18next, v1.7.7
-// Copyright (c)2014 Jan Mühlemann (jamuhl).
-// Distributed under MIT license
-// http://i18next.com
-(function() {
+},{"_process":65}],65:[function(require,module,exports){
+// shim for using process in browser
- // add indexOf to non ECMA-262 standard compliant browsers
- if (!Array.prototype.indexOf) {
- Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
- "use strict";
- if (this == null) {
- throw new TypeError();
- }
- var t = Object(this);
- var len = t.length >>> 0;
- if (len === 0) {
- return -1;
- }
- var n = 0;
- if (arguments.length > 0) {
- n = Number(arguments[1]);
- if (n != n) { // shortcut for verifying if it's NaN
- n = 0;
- } else if (n != 0 && n != Infinity && n != -Infinity) {
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
- }
- }
- if (n >= len) {
- return -1;
- }
- var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
- for (; k < len; k++) {
- if (k in t && t[k] === searchElement) {
- return k;
- }
- }
- return -1;
- }
+var process = module.exports = {};
+var queue = [];
+var draining = false;
+var currentQueue;
+var queueIndex = -1;
+
+function cleanUpNextTick() {
+ draining = false;
+ if (currentQueue.length) {
+ queue = currentQueue.concat(queue);
+ } else {
+ queueIndex = -1;
}
-
- // add lastIndexOf to non ECMA-262 standard compliant browsers
- if (!Array.prototype.lastIndexOf) {
- Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {
- "use strict";
- if (this == null) {
- throw new TypeError();
- }
- var t = Object(this);
- var len = t.length >>> 0;
- if (len === 0) {
- return -1;
- }
- var n = len;
- if (arguments.length > 1) {
- n = Number(arguments[1]);
- if (n != n) {
- n = 0;
- } else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) {
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
- }
- }
- var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);
- for (; k >= 0; k--) {
- if (k in t && t[k] === searchElement) {
- return k;
- }
- }
- return -1;
- };
+ if (queue.length) {
+ drainQueue();
}
-
- // Add string trim for IE8.
- if (typeof String.prototype.trim !== 'function') {
- String.prototype.trim = function() {
- return this.replace(/^\s+|\s+$/g, '');
+}
+
+function drainQueue() {
+ if (draining) {
+ return;
+ }
+ var timeout = setTimeout(cleanUpNextTick);
+ draining = true;
+
+ var len = queue.length;
+ while(len) {
+ currentQueue = queue;
+ queue = [];
+ while (++queueIndex < len) {
+ currentQueue[queueIndex].run();
}
+ queueIndex = -1;
+ len = queue.length;
}
+ currentQueue = null;
+ draining = false;
+ clearTimeout(timeout);
+}
- var root = this
- , $ = root.jQuery || root.Zepto
- , i18n = {}
- , resStore = {}
- , currentLng
- , replacementCounter = 0
- , languages = []
- , initialized = false
- , sync = {};
+process.nextTick = function (fun) {
+ var args = new Array(arguments.length - 1);
+ if (arguments.length > 1) {
+ for (var i = 1; i < arguments.length; i++) {
+ args[i - 1] = arguments[i];
+ }
+ }
+ queue.push(new Item(fun, args));
+ if (!draining) {
+ setTimeout(drainQueue, 0);
+ }
+};
+// v8 likes predictible objects
+function Item(fun, array) {
+ this.fun = fun;
+ this.array = array;
+}
+Item.prototype.run = function () {
+ this.fun.apply(null, this.array);
+};
+process.title = 'browser';
+process.browser = true;
+process.env = {};
+process.argv = [];
+process.version = ''; // empty string to avoid regexp issues
+process.versions = {};
+function noop() {}
- // Export the i18next object for **CommonJS**.
- // If we're not in CommonJS, add `i18n` to the
- // global object or to jquery.
- if (typeof module !== 'undefined' && module.exports) {
- if (!$) {
- try {
- $ = require('jquery');
- } catch(e) {
- // just ignore
- }
- }
- if ($) {
- $.i18n = $.i18n || i18n;
- }
- module.exports = i18n;
- } else {
- if ($) {
- $.i18n = $.i18n || i18n;
- }
-
- root.i18n = root.i18n || i18n;
- }
- sync = {
-
- load: function(lngs, options, cb) {
- if (options.useLocalStorage) {
- sync._loadLocal(lngs, options, function(err, store) {
- var missingLngs = [];
- for (var i = 0, len = lngs.length; i < len; i++) {
- if (!store[lngs[i]]) missingLngs.push(lngs[i]);
- }
-
- if (missingLngs.length > 0) {
- sync._fetch(missingLngs, options, function(err, fetched) {
- f.extend(store, fetched);
- sync._storeLocal(fetched);
-
- cb(null, store);
- });
- } else {
- cb(null, store);
- }
- });
- } else {
- sync._fetch(lngs, options, function(err, store){
- cb(null, store);
- });
- }
- },
-
- _loadLocal: function(lngs, options, cb) {
- var store = {}
- , nowMS = new Date().getTime();
-
- if(window.localStorage) {
-
- var todo = lngs.length;
-
- f.each(lngs, function(key, lng) {
- var local = window.localStorage.getItem('res_' + lng);
-
+process.on = noop;
+process.addListener = noop;
+process.once = noop;
+process.off = noop;
+process.removeListener = noop;
+process.removeAllListeners = noop;
+process.emit = noop;
+
+process.binding = function (name) {
+ throw new Error('process.binding is not supported');
+};
+
+// TODO(shtylman)
+process.cwd = function () { return '/' };
+process.chdir = function (dir) {
+ throw new Error('process.chdir is not supported');
+};
+process.umask = function() { return 0; };
+
+},{}],66:[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;
+}
+
+},{}],67:[function(require,module,exports){
+// i18next, v1.7.7
+// Copyright (c)2014 Jan Mühlemann (jamuhl).
+// Distributed under MIT license
+// http://i18next.com
+(function() {
+
+ // add indexOf to non ECMA-262 standard compliant browsers
+ if (!Array.prototype.indexOf) {
+ Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
+ "use strict";
+ if (this == null) {
+ throw new TypeError();
+ }
+ var t = Object(this);
+ var len = t.length >>> 0;
+ if (len === 0) {
+ return -1;
+ }
+ var n = 0;
+ if (arguments.length > 0) {
+ n = Number(arguments[1]);
+ if (n != n) { // shortcut for verifying if it's NaN
+ n = 0;
+ } else if (n != 0 && n != Infinity && n != -Infinity) {
+ n = (n > 0 || -1) * Math.floor(Math.abs(n));
+ }
+ }
+ if (n >= len) {
+ return -1;
+ }
+ var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
+ for (; k < len; k++) {
+ if (k in t && t[k] === searchElement) {
+ return k;
+ }
+ }
+ return -1;
+ }
+ }
+
+ // add lastIndexOf to non ECMA-262 standard compliant browsers
+ if (!Array.prototype.lastIndexOf) {
+ Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {
+ "use strict";
+ if (this == null) {
+ throw new TypeError();
+ }
+ var t = Object(this);
+ var len = t.length >>> 0;
+ if (len === 0) {
+ return -1;
+ }
+ var n = len;
+ if (arguments.length > 1) {
+ n = Number(arguments[1]);
+ if (n != n) {
+ n = 0;
+ } else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) {
+ n = (n > 0 || -1) * Math.floor(Math.abs(n));
+ }
+ }
+ var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);
+ for (; k >= 0; k--) {
+ if (k in t && t[k] === searchElement) {
+ return k;
+ }
+ }
+ return -1;
+ };
+ }
+
+ // Add string trim for IE8.
+ if (typeof String.prototype.trim !== 'function') {
+ String.prototype.trim = function() {
+ return this.replace(/^\s+|\s+$/g, '');
+ }
+ }
+
+ var root = this
+ , $ = root.jQuery || root.Zepto
+ , i18n = {}
+ , resStore = {}
+ , currentLng
+ , replacementCounter = 0
+ , languages = []
+ , initialized = false
+ , sync = {};
+
+
+
+ // Export the i18next object for **CommonJS**.
+ // If we're not in CommonJS, add `i18n` to the
+ // global object or to jquery.
+ if (typeof module !== 'undefined' && module.exports) {
+ if (!$) {
+ try {
+ $ = require('jquery');
+ } catch(e) {
+ // just ignore
+ }
+ }
+ if ($) {
+ $.i18n = $.i18n || i18n;
+ }
+ module.exports = i18n;
+ } else {
+ if ($) {
+ $.i18n = $.i18n || i18n;
+ }
+
+ root.i18n = root.i18n || i18n;
+ }
+ sync = {
+
+ load: function(lngs, options, cb) {
+ if (options.useLocalStorage) {
+ sync._loadLocal(lngs, options, function(err, store) {
+ var missingLngs = [];
+ for (var i = 0, len = lngs.length; i < len; i++) {
+ if (!store[lngs[i]]) missingLngs.push(lngs[i]);
+ }
+
+ if (missingLngs.length > 0) {
+ sync._fetch(missingLngs, options, function(err, fetched) {
+ f.extend(store, fetched);
+ sync._storeLocal(fetched);
+
+ cb(null, store);
+ });
+ } else {
+ cb(null, store);
+ }
+ });
+ } else {
+ sync._fetch(lngs, options, function(err, store){
+ cb(null, store);
+ });
+ }
+ },
+
+ _loadLocal: function(lngs, options, cb) {
+ var store = {}
+ , nowMS = new Date().getTime();
+
+ if(window.localStorage) {
+
+ var todo = lngs.length;
+
+ f.each(lngs, function(key, lng) {
+ var local = window.localStorage.getItem('res_' + lng);
+
if (local) {
local = JSON.parse(local);
@@ -21333,7 +21667,7 @@ module.exports = XMPP;
i18n.options = o;
})();
-},{"jquery":"jquery"}],67:[function(require,module,exports){
+},{"jquery":"jquery"}],68:[function(require,module,exports){
// Top level file is just a mixin of submodules & constants
'use strict';
@@ -21348,7 +21682,7 @@ var pako = {};
assign(pako, deflate, inflate, constants);
module.exports = pako;
-},{"./lib/deflate":68,"./lib/inflate":69,"./lib/utils/common":70,"./lib/zlib/constants":73}],68:[function(require,module,exports){
+},{"./lib/deflate":69,"./lib/inflate":70,"./lib/utils/common":71,"./lib/zlib/constants":74}],69:[function(require,module,exports){
'use strict';
@@ -21713,7 +22047,7 @@ exports.Deflate = Deflate;
exports.deflate = deflate;
exports.deflateRaw = deflateRaw;
exports.gzip = gzip;
-},{"./utils/common":70,"./utils/strings":71,"./zlib/deflate.js":75,"./zlib/messages":80,"./zlib/zstream":82}],69:[function(require,module,exports){
+},{"./utils/common":71,"./utils/strings":72,"./zlib/deflate.js":76,"./zlib/messages":81,"./zlib/zstream":83}],70:[function(require,module,exports){
'use strict';
@@ -22082,7 +22416,7 @@ exports.inflate = inflate;
exports.inflateRaw = inflateRaw;
exports.ungzip = inflate;
-},{"./utils/common":70,"./utils/strings":71,"./zlib/constants":73,"./zlib/gzheader":76,"./zlib/inflate.js":78,"./zlib/messages":80,"./zlib/zstream":82}],70:[function(require,module,exports){
+},{"./utils/common":71,"./utils/strings":72,"./zlib/constants":74,"./zlib/gzheader":77,"./zlib/inflate.js":79,"./zlib/messages":81,"./zlib/zstream":83}],71:[function(require,module,exports){
'use strict';
@@ -22185,7 +22519,7 @@ exports.setTyped = function (on) {
};
exports.setTyped(TYPED_OK);
-},{}],71:[function(require,module,exports){
+},{}],72:[function(require,module,exports){
// String encode/decode helpers
'use strict';
@@ -22372,7 +22706,7 @@ exports.utf8border = function(buf, max) {
return (pos + _utf8len[buf[pos]] > max) ? pos : max;
};
-},{"./common":70}],72:[function(require,module,exports){
+},{"./common":71}],73:[function(require,module,exports){
'use strict';
// Note: adler32 takes 12% for level 0 and 2% for level 6.
@@ -22405,7 +22739,7 @@ function adler32(adler, buf, len, pos) {
module.exports = adler32;
-},{}],73:[function(require,module,exports){
+},{}],74:[function(require,module,exports){
module.exports = {
/* Allowed flush values; see deflate() and inflate() below for details */
@@ -22453,7 +22787,7 @@ module.exports = {
Z_DEFLATED: 8
//Z_NULL: null // Use -1 or null inline, depending on var type
};
-},{}],74:[function(require,module,exports){
+},{}],75:[function(require,module,exports){
'use strict';
// Note: we can't get significant speed boost here.
@@ -22495,7 +22829,7 @@ function crc32(crc, buf, len, pos) {
module.exports = crc32;
-},{}],75:[function(require,module,exports){
+},{}],76:[function(require,module,exports){
'use strict';
var utils = require('../utils/common');
@@ -24261,7 +24595,7 @@ exports.deflatePending = deflatePending;
exports.deflatePrime = deflatePrime;
exports.deflateTune = deflateTune;
*/
-},{"../utils/common":70,"./adler32":72,"./crc32":74,"./messages":80,"./trees":81}],76:[function(require,module,exports){
+},{"../utils/common":71,"./adler32":73,"./crc32":75,"./messages":81,"./trees":82}],77:[function(require,module,exports){
'use strict';
@@ -24302,7 +24636,7 @@ function GZheader() {
}
module.exports = GZheader;
-},{}],77:[function(require,module,exports){
+},{}],78:[function(require,module,exports){
'use strict';
// See state defs from inflate.js
@@ -24629,7 +24963,7 @@ module.exports = function inflate_fast(strm, start) {
return;
};
-},{}],78:[function(require,module,exports){
+},{}],79:[function(require,module,exports){
'use strict';
@@ -26133,7 +26467,7 @@ exports.inflateSync = inflateSync;
exports.inflateSyncPoint = inflateSyncPoint;
exports.inflateUndermine = inflateUndermine;
*/
-},{"../utils/common":70,"./adler32":72,"./crc32":74,"./inffast":77,"./inftrees":79}],79:[function(require,module,exports){
+},{"../utils/common":71,"./adler32":73,"./crc32":75,"./inffast":78,"./inftrees":80}],80:[function(require,module,exports){
'use strict';
@@ -26460,7 +26794,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
return 0;
};
-},{"../utils/common":70}],80:[function(require,module,exports){
+},{"../utils/common":71}],81:[function(require,module,exports){
'use strict';
module.exports = {
@@ -26474,7 +26808,7 @@ module.exports = {
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};
-},{}],81:[function(require,module,exports){
+},{}],82:[function(require,module,exports){
'use strict';
@@ -27674,7 +28008,7 @@ exports._tr_stored_block = _tr_stored_block;
exports._tr_flush_block = _tr_flush_block;
exports._tr_tally = _tr_tally;
exports._tr_align = _tr_align;
-},{"../utils/common":70}],82:[function(require,module,exports){
+},{"../utils/common":71}],83:[function(require,module,exports){
'use strict';
@@ -27704,9 +28038,9 @@ function ZStream() {
}
module.exports = ZStream;
-},{}],83:[function(require,module,exports){
+},{}],84:[function(require,module,exports){
module.exports = require('./lib/retry');
-},{"./lib/retry":84}],84:[function(require,module,exports){
+},{"./lib/retry":85}],85:[function(require,module,exports){
var RetryOperation = require('./retry_operation');
exports.operation = function(options) {
@@ -27757,7 +28091,7 @@ exports._createTimeout = function(attempt, opts) {
return timeout;
};
-},{"./retry_operation":85}],85:[function(require,module,exports){
+},{"./retry_operation":86}],86:[function(require,module,exports){
function RetryOperation(timeouts) {
this._timeouts = timeouts;
this._fn = null;
@@ -27867,7 +28201,7 @@ RetryOperation.prototype.mainError = function() {
return mainError;
};
-},{}],86:[function(require,module,exports){
+},{}],87:[function(require,module,exports){
module.exports = function arrayEquals(array) {
// if the other array is a falsy value, return
if (!array)
@@ -27893,10 +28227,10 @@ module.exports = function arrayEquals(array) {
}
-},{}],87:[function(require,module,exports){
+},{}],88:[function(require,module,exports){
exports.Interop = require('./interop');
-},{"./interop":88}],88:[function(require,module,exports){
+},{"./interop":89}],89:[function(require,module,exports){
"use strict";
var transform = require('./transform');
@@ -28308,1302 +28642,1001 @@ Interop.prototype.toUnifiedPlan = function(desc) {
// method.
//
// Because FF generates answers in Unified Plan style,
- // we MUST already have a cached answer with all the
- // local SSRCs mapped to some m-line/mid.
-
- if (desc.type === 'answer') {
- throw new Error("An unmapped SSRC was found.");
- }
-
- unifiedLine.mid = [bLine.type, '-', ssrc].join('');
- }
-
- // Include the candidates in the 1st media line.
- unifiedLine.candidates = candidates;
- unifiedLine.iceUfrag = iceUfrag;
- unifiedLine.icePwd = icePwd;
- unifiedLine.fingerprint = fingerprint;
- unifiedLine.port = port;
-
- mid2ul[unifiedLine.mid] = unifiedLine;
- }
- });
- }
- });
-
- // Rebuild the media array in the right order and add the missing mLines
- // (missing from the Plan B SDP).
- session.media = [];
- mids = []; // reuse
-
- if (desc.type === 'answer') {
-
- // The media lines in the answer must match the media lines in the
- // offer. The order is important too. Here we assume that Firefox is the
- // answerer, so we merely have to use the reconstructed (unified) answer
- // to update the cached (unified) answer accordingly.
- //
- // In the general case, one would have to use the cached (unified) offer
- // to find the m-lines that are missing from the reconstructed answer,
- // potentially grabbing them from the cached (unified) answer. One has
- // to be carefull with this approach because inactive m-lines do not
- // always have an mid, making it tricky (impossible?) to find where
- // exactly and which m-lines are missing from the reconstructed answer.
-
- for (var i = 0; i < cached.media.length; i++) {
- var unifiedLine = cached.media[i];
-
- if (typeof mid2ul[unifiedLine.mid] === 'undefined') {
-
- // The mid isn't in the reconstructed (unified) answer.
- // This is either a (unified) m-line containing a remote
- // track only, or a (unified) m-line containing a remote
- // track and a local track that has been removed.
- // In either case, it MUST exist in the cached
- // (unified) answer.
- //
- // In case this is a removed local track, clean-up
- // the (unified) m-line and make sure it's 'recvonly' or
- // 'inactive'.
-
- delete unifiedLine.msid;
- delete unifiedLine.sources;
- delete unifiedLine.ssrcGroups;
- if (!unifiedLine.direction
- || unifiedLine.direction === 'sendrecv')
- unifiedLine.direction = 'recvonly';
- if (!unifiedLine.direction
- || unifiedLine.direction === 'sendonly')
- unifiedLine.direction = 'inactive';
- } else {
- // This is an (unified) m-line/channel that contains a local
- // track (sendrecv or sendonly channel) or it's a unified
- // recvonly m-line/channel. In either case, since we're
- // going from PlanB -> Unified Plan this m-line MUST
- // exist in the cached answer.
- }
-
- session.media.push(unifiedLine);
-
- if (typeof unifiedLine.mid === 'string') {
- // inactive lines don't/may not have an mid.
- mids.push(unifiedLine.mid);
- }
- }
- } else {
-
- // SDP offer/answer (and the JSEP spec) forbids removing an m-section
- // under any circumstances. If we are no longer interested in sending a
- // track, we just remove the msid and ssrc attributes and set it to
- // either a=recvonly (as the reofferer, we must use recvonly if the
- // other side was previously sending on the m-section, but we can also
- // leave the possibility open if it wasn't previously in use), or
- // a=inacive.
-
- if (typeof cached !== 'undefined' &&
- typeof cached.media !== 'undefined' &&
- Array.isArray(cached.media)) {
- cached.media.forEach(function(unifiedLine) {
- mids.push(unifiedLine.mid);
- if (typeof mid2ul[unifiedLine.mid] !== 'undefined') {
- session.media.push(mid2ul[unifiedLine.mid]);
- } else {
- delete unifiedLine.msid;
- delete unifiedLine.sources;
- delete unifiedLine.ssrcGroups;
- if (!unifiedLine.direction
- || unifiedLine.direction === 'sendrecv')
- unifiedLine.direction = 'recvonly';
- if (!unifiedLine.direction
- || unifiedLine.direction === 'sendonly')
- unifiedLine.direction = 'inactive';
- session.media.push(unifiedLine);
- }
- });
- }
-
- // Add all the remaining (new) m-lines of the transformed SDP.
- Object.keys(mid2ul).forEach(function(mid) {
- if (mids.indexOf(mid) === -1) {
- mids.push(mid);
- if (typeof mid2ul[mid].direction === 'recvonly') {
- // This is a remote recvonly channel. Add its SSRC to the
- // appropriate sendrecv or sendonly channel.
- // TODO(gp) what if we don't have sendrecv/sendonly channel?
- session.media.some(function (unifiedLine) {
- if ((unifiedLine.direction === 'sendrecv' ||
- unifiedLine.direction === 'sendonly') &&
- unifiedLine.type === mid2ul[mid].type) {
-
- // mid2ul[mid] shouldn't have any ssrc-groups
- Object.keys(mid2ul[mid].sources).forEach(function (ssrc) {
- unifiedLine.sources[ssrc] = mid2ul[mid].sources[ssrc];
- });
-
- return true;
- }
- });
- } else {
- session.media.push(mid2ul[mid]);
- }
- }
- });
- }
-
- // We regenerate the BUNDLE group (since we regenerated the mids)
- session.groups.some(function(group) {
- if (group.type === 'BUNDLE') {
- group.mids = mids.join(' ');
- return true;
- }
- });
-
- // msid semantic
- session.msidSemantic = {
- semantic: 'WMS',
- token: '*'
- };
-
- var resStr = transform.write(session);
-
- // Cache the transformed SDP (Unified Plan) for later re-use in this
- // function.
- this.cache[desc.type] = resStr;
-
- return new RTCSessionDescription({
- type: desc.type,
- sdp: resStr
- });
-
- //#endregion
-};
-
-},{"./array-equals":86,"./transform":89}],89:[function(require,module,exports){
-var transform = require('sdp-transform');
-
-exports.write = function(session, opts) {
-
- if (typeof session !== 'undefined' &&
- typeof session.media !== 'undefined' &&
- Array.isArray(session.media)) {
-
- session.media.forEach(function (mLine) {
- // expand sources to ssrcs
- if (typeof mLine.sources !== 'undefined' &&
- Object.keys(mLine.sources).length !== 0) {
- mLine.ssrcs = [];
- Object.keys(mLine.sources).forEach(function (ssrc) {
- var source = mLine.sources[ssrc];
- Object.keys(source).forEach(function (attribute) {
- mLine.ssrcs.push({
- id: ssrc,
- attribute: attribute,
- value: source[attribute]
- });
- });
- });
- delete mLine.sources;
- }
-
- // join ssrcs in ssrc groups
- if (typeof mLine.ssrcGroups !== 'undefined' &&
- Array.isArray(mLine.ssrcGroups)) {
- mLine.ssrcGroups.forEach(function (ssrcGroup) {
- if (typeof ssrcGroup.ssrcs !== 'undefined' &&
- Array.isArray(ssrcGroup.ssrcs)) {
- ssrcGroup.ssrcs = ssrcGroup.ssrcs.join(' ');
- }
- });
- }
- });
- }
-
- // join group mids
- if (typeof session !== 'undefined' &&
- typeof session.groups !== 'undefined' && Array.isArray(session.groups)) {
-
- session.groups.forEach(function (g) {
- if (typeof g.mids !== 'undefined' && Array.isArray(g.mids)) {
- g.mids = g.mids.join(' ');
- }
- });
- }
-
- return transform.write(session, opts);
-};
-
-exports.parse = function(sdp) {
- var session = transform.parse(sdp);
+ // we MUST already have a cached answer with all the
+ // local SSRCs mapped to some m-line/mid.
- if (typeof session !== 'undefined' && typeof session.media !== 'undefined' &&
- Array.isArray(session.media)) {
+ if (desc.type === 'answer') {
+ throw new Error("An unmapped SSRC was found.");
+ }
- session.media.forEach(function (mLine) {
- // group sources attributes by ssrc
- if (typeof mLine.ssrcs !== 'undefined' && Array.isArray(mLine.ssrcs)) {
- mLine.sources = {};
- mLine.ssrcs.forEach(function (ssrc) {
- if (!mLine.sources[ssrc.id])
- mLine.sources[ssrc.id] = {};
- mLine.sources[ssrc.id][ssrc.attribute] = ssrc.value;
- });
+ unifiedLine.mid = [bLine.type, '-', ssrc].join('');
+ }
- delete mLine.ssrcs;
- }
+ // Include the candidates in the 1st media line.
+ unifiedLine.candidates = candidates;
+ unifiedLine.iceUfrag = iceUfrag;
+ unifiedLine.icePwd = icePwd;
+ unifiedLine.fingerprint = fingerprint;
+ unifiedLine.port = port;
- // split ssrcs in ssrc groups
- if (typeof mLine.ssrcGroups !== 'undefined' &&
- Array.isArray(mLine.ssrcGroups)) {
- mLine.ssrcGroups.forEach(function (ssrcGroup) {
- if (typeof ssrcGroup.ssrcs === 'string') {
- ssrcGroup.ssrcs = ssrcGroup.ssrcs.split(' ');
- }
- });
+ mid2ul[unifiedLine.mid] = unifiedLine;
+ }
+ });
}
});
- }
- // split group mids
- if (typeof session !== 'undefined' &&
- typeof session.groups !== 'undefined' && Array.isArray(session.groups)) {
- session.groups.forEach(function (g) {
- if (typeof g.mids === 'string') {
- g.mids = g.mids.split(' ');
- }
- });
- }
+ // Rebuild the media array in the right order and add the missing mLines
+ // (missing from the Plan B SDP).
+ session.media = [];
+ mids = []; // reuse
- return session;
-};
+ if (desc.type === 'answer') {
+ // The media lines in the answer must match the media lines in the
+ // offer. The order is important too. Here we assume that Firefox is the
+ // answerer, so we merely have to use the reconstructed (unified) answer
+ // to update the cached (unified) answer accordingly.
+ //
+ // In the general case, one would have to use the cached (unified) offer
+ // to find the m-lines that are missing from the reconstructed answer,
+ // potentially grabbing them from the cached (unified) answer. One has
+ // to be carefull with this approach because inactive m-lines do not
+ // always have an mid, making it tricky (impossible?) to find where
+ // exactly and which m-lines are missing from the reconstructed answer.
-},{"sdp-transform":91}],90:[function(require,module,exports){
-var grammar = module.exports = {
- v: [{
- name: 'version',
- reg: /^(\d*)$/
- }],
- o: [{ //o=- 20518 0 IN IP4 203.0.113.1
- // NB: sessionId will be a String in most cases because it is huge
- name: 'origin',
- reg: /^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,
- names: ['username', 'sessionId', 'sessionVersion', 'netType', 'ipVer', 'address'],
- format: "%s %s %d %s IP%d %s"
- }],
- // default parsing of these only (though some of these feel outdated)
- s: [{ name: 'name' }],
- i: [{ name: 'description' }],
- u: [{ name: 'uri' }],
- e: [{ name: 'email' }],
- p: [{ name: 'phone' }],
- z: [{ name: 'timezones' }], // TODO: this one can actually be parsed properly..
- r: [{ name: 'repeats' }], // TODO: this one can also be parsed properly
- //k: [{}], // outdated thing ignored
- t: [{ //t=0 0
- name: 'timing',
- reg: /^(\d*) (\d*)/,
- names: ['start', 'stop'],
- format: "%d %d"
- }],
- c: [{ //c=IN IP4 10.47.197.26
- name: 'connection',
- reg: /^IN IP(\d) (\S*)/,
- names: ['version', 'ip'],
- format: "IN IP%d %s"
- }],
- b: [{ //b=AS:4000
- push: 'bandwidth',
- reg: /^(TIAS|AS|CT|RR|RS):(\d*)/,
- names: ['type', 'limit'],
- format: "%s:%s"
- }],
- m: [{ //m=video 51744 RTP/AVP 126 97 98 34 31
- // NB: special - pushes to session
- // TODO: rtp/fmtp should be filtered by the payloads found here?
- reg: /^(\w*) (\d*) ([\w\/]*)(?: (.*))?/,
- names: ['type', 'port', 'protocol', 'payloads'],
- format: "%s %d %s %s"
- }],
- a: [
- { //a=rtpmap:110 opus/48000/2
- push: 'rtp',
- reg: /^rtpmap:(\d*) ([\w\-]*)\/(\d*)(?:\s*\/(\S*))?/,
- names: ['payload', 'codec', 'rate', 'encoding'],
- format: function (o) {
- return (o.encoding) ?
- "rtpmap:%d %s/%s/%s":
- "rtpmap:%d %s/%s";
- }
- },
- { //a=fmtp:108 profile-level-id=24;object=23;bitrate=64000
- push: 'fmtp',
- reg: /^fmtp:(\d*) (\S*)/,
- names: ['payload', 'config'],
- format: "fmtp:%d %s"
- },
- { //a=control:streamid=0
- name: 'control',
- reg: /^control:(.*)/,
- format: "control:%s"
- },
- { //a=rtcp:65179 IN IP4 193.84.77.194
- name: 'rtcp',
- reg: /^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,
- names: ['port', 'netType', 'ipVer', 'address'],
- format: function (o) {
- return (o.address != null) ?
- "rtcp:%d %s IP%d %s":
- "rtcp:%d";
- }
- },
- { //a=rtcp-fb:98 trr-int 100
- push: 'rtcpFbTrrInt',
- reg: /^rtcp-fb:(\*|\d*) trr-int (\d*)/,
- names: ['payload', 'value'],
- format: "rtcp-fb:%d trr-int %d"
- },
- { //a=rtcp-fb:98 nack rpsi
- push: 'rtcpFb',
- reg: /^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,
- names: ['payload', 'type', 'subtype'],
- format: function (o) {
- return (o.subtype != null) ?
- "rtcp-fb:%s %s %s":
- "rtcp-fb:%s %s";
- }
- },
- { //a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
- //a=extmap:1/recvonly URI-gps-string
- push: 'ext',
- reg: /^extmap:([\w_\/]*) (\S*)(?: (\S*))?/,
- names: ['value', 'uri', 'config'], // value may include "/direction" suffix
- format: function (o) {
- return (o.config != null) ?
- "extmap:%s %s %s":
- "extmap:%s %s";
- }
- },
- {
- //a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR|2^20|1:32
- push: 'crypto',
- reg: /^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,
- names: ['id', 'suite', 'config', 'sessionConfig'],
- format: function (o) {
- return (o.sessionConfig != null) ?
- "crypto:%d %s %s %s":
- "crypto:%d %s %s";
- }
- },
- { //a=setup:actpass
- name: 'setup',
- reg: /^setup:(\w*)/,
- format: "setup:%s"
- },
- { //a=mid:1
- name: 'mid',
- reg: /^mid:([^\s]*)/,
- format: "mid:%s"
- },
- { //a=msid:0c8b064d-d807-43b4-b434-f92a889d8587 98178685-d409-46e0-8e16-7ef0db0db64a
- name: 'msid',
- reg: /^msid:(.*)/,
- format: "msid:%s"
- },
- { //a=ptime:20
- name: 'ptime',
- reg: /^ptime:(\d*)/,
- format: "ptime:%d"
- },
- { //a=maxptime:60
- name: 'maxptime',
- reg: /^maxptime:(\d*)/,
- format: "maxptime:%d"
- },
- { //a=sendrecv
- name: 'direction',
- reg: /^(sendrecv|recvonly|sendonly|inactive)/
- },
- { //a=ice-lite
- name: 'icelite',
- reg: /^(ice-lite)/
- },
- { //a=ice-ufrag:F7gI
- name: 'iceUfrag',
- reg: /^ice-ufrag:(\S*)/,
- format: "ice-ufrag:%s"
- },
- { //a=ice-pwd:x9cml/YzichV2+XlhiMu8g
- name: 'icePwd',
- reg: /^ice-pwd:(\S*)/,
- format: "ice-pwd:%s"
- },
- { //a=fingerprint:SHA-1 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33
- name: 'fingerprint',
- reg: /^fingerprint:(\S*) (\S*)/,
- names: ['type', 'hash'],
- format: "fingerprint:%s %s"
- },
- {
- //a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ host
- //a=candidate:1162875081 1 udp 2113937151 192.168.34.75 60017 typ host generation 0
- //a=candidate:3289912957 2 udp 1845501695 193.84.77.194 60017 typ srflx raddr 192.168.34.75 rport 60017 generation 0
- push:'candidates',
- reg: /^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: generation (\d*))?/,
- names: ['foundation', 'component', 'transport', 'priority', 'ip', 'port', 'type', 'raddr', 'rport', 'generation'],
- format: function (o) {
- var str = "candidate:%s %d %s %d %s %d typ %s";
- // NB: candidate has two optional chunks, so %void middle one if it's missing
- str += (o.raddr != null) ? " raddr %s rport %d" : "%v%v";
- if (o.generation != null) {
- str += " generation %d";
+ for (var i = 0; i < cached.media.length; i++) {
+ var unifiedLine = cached.media[i];
+
+ if (typeof mid2ul[unifiedLine.mid] === 'undefined') {
+
+ // The mid isn't in the reconstructed (unified) answer.
+ // This is either a (unified) m-line containing a remote
+ // track only, or a (unified) m-line containing a remote
+ // track and a local track that has been removed.
+ // In either case, it MUST exist in the cached
+ // (unified) answer.
+ //
+ // In case this is a removed local track, clean-up
+ // the (unified) m-line and make sure it's 'recvonly' or
+ // 'inactive'.
+
+ delete unifiedLine.msid;
+ delete unifiedLine.sources;
+ delete unifiedLine.ssrcGroups;
+ if (!unifiedLine.direction
+ || unifiedLine.direction === 'sendrecv')
+ unifiedLine.direction = 'recvonly';
+ if (!unifiedLine.direction
+ || unifiedLine.direction === 'sendonly')
+ unifiedLine.direction = 'inactive';
+ } else {
+ // This is an (unified) m-line/channel that contains a local
+ // track (sendrecv or sendonly channel) or it's a unified
+ // recvonly m-line/channel. In either case, since we're
+ // going from PlanB -> Unified Plan this m-line MUST
+ // exist in the cached answer.
+ }
+
+ session.media.push(unifiedLine);
+
+ if (typeof unifiedLine.mid === 'string') {
+ // inactive lines don't/may not have an mid.
+ mids.push(unifiedLine.mid);
+ }
}
- return str;
- }
- },
- { //a=end-of-candidates (keep after the candidates line for readability)
- name: 'endOfCandidates',
- reg: /^(end-of-candidates)/
- },
- { //a=remote-candidates:1 203.0.113.1 54400 2 203.0.113.1 54401 ...
- name: 'remoteCandidates',
- reg: /^remote-candidates:(.*)/,
- format: "remote-candidates:%s"
- },
- { //a=ice-options:google-ice
- name: 'iceOptions',
- reg: /^ice-options:(\S*)/,
- format: "ice-options:%s"
- },
- { //a=ssrc:2566107569 cname:t9YU8M1UxTF8Y1A1
- push: "ssrcs",
- reg: /^ssrc:(\d*) ([\w_]*):(.*)/,
- names: ['id', 'attribute', 'value'],
- format: "ssrc:%d %s:%s"
- },
- { //a=ssrc-group:FEC 1 2
- push: "ssrcGroups",
- reg: /^ssrc-group:(\w*) (.*)/,
- names: ['semantics', 'ssrcs'],
- format: "ssrc-group:%s %s"
- },
- { //a=msid-semantic: WMS Jvlam5X3SX1OP6pn20zWogvaKJz5Hjf9OnlV
- name: "msidSemantic",
- reg: /^msid-semantic:\s?(\w*) (\S*)/,
- names: ['semantic', 'token'],
- format: "msid-semantic: %s %s" // space after ":" is not accidental
- },
- { //a=group:BUNDLE audio video
- push: 'groups',
- reg: /^group:(\w*) (.*)/,
- names: ['type', 'mids'],
- format: "group:%s %s"
- },
- { //a=rtcp-mux
- name: 'rtcpMux',
- reg: /^(rtcp-mux)/
- },
- { //a=rtcp-rsize
- name: 'rtcpRsize',
- reg: /^(rtcp-rsize)/
- },
- { // any a= that we don't understand is kepts verbatim on media.invalid
- push: 'invalid',
- names: ["value"]
- }
- ]
-};
+ } else {
-// set sensible defaults to avoid polluting the grammar with boring details
-Object.keys(grammar).forEach(function (key) {
- var objs = grammar[key];
- objs.forEach(function (obj) {
- if (!obj.reg) {
- obj.reg = /(.*)/;
- }
- if (!obj.format) {
- obj.format = "%s";
- }
- });
-});
+ // SDP offer/answer (and the JSEP spec) forbids removing an m-section
+ // under any circumstances. If we are no longer interested in sending a
+ // track, we just remove the msid and ssrc attributes and set it to
+ // either a=recvonly (as the reofferer, we must use recvonly if the
+ // other side was previously sending on the m-section, but we can also
+ // leave the possibility open if it wasn't previously in use), or
+ // a=inacive.
-},{}],91:[function(require,module,exports){
-var parser = require('./parser');
-var writer = require('./writer');
+ if (typeof cached !== 'undefined' &&
+ typeof cached.media !== 'undefined' &&
+ Array.isArray(cached.media)) {
+ cached.media.forEach(function(unifiedLine) {
+ mids.push(unifiedLine.mid);
+ if (typeof mid2ul[unifiedLine.mid] !== 'undefined') {
+ session.media.push(mid2ul[unifiedLine.mid]);
+ } else {
+ delete unifiedLine.msid;
+ delete unifiedLine.sources;
+ delete unifiedLine.ssrcGroups;
+ if (!unifiedLine.direction
+ || unifiedLine.direction === 'sendrecv')
+ unifiedLine.direction = 'recvonly';
+ if (!unifiedLine.direction
+ || unifiedLine.direction === 'sendonly')
+ unifiedLine.direction = 'inactive';
+ session.media.push(unifiedLine);
+ }
+ });
+ }
-exports.write = writer;
-exports.parse = parser.parse;
-exports.parseFmtpConfig = parser.parseFmtpConfig;
-exports.parsePayloads = parser.parsePayloads;
-exports.parseRemoteCandidates = parser.parseRemoteCandidates;
+ // Add all the remaining (new) m-lines of the transformed SDP.
+ Object.keys(mid2ul).forEach(function(mid) {
+ if (mids.indexOf(mid) === -1) {
+ mids.push(mid);
+ if (typeof mid2ul[mid].direction === 'recvonly') {
+ // This is a remote recvonly channel. Add its SSRC to the
+ // appropriate sendrecv or sendonly channel.
+ // TODO(gp) what if we don't have sendrecv/sendonly channel?
+ session.media.some(function (unifiedLine) {
+ if ((unifiedLine.direction === 'sendrecv' ||
+ unifiedLine.direction === 'sendonly') &&
+ unifiedLine.type === mid2ul[mid].type) {
-},{"./parser":92,"./writer":93}],92:[function(require,module,exports){
-var toIntIfInt = function (v) {
- return String(Number(v)) === v ? Number(v) : v;
-};
+ // mid2ul[mid] shouldn't have any ssrc-groups
+ Object.keys(mid2ul[mid].sources).forEach(function (ssrc) {
+ unifiedLine.sources[ssrc] = mid2ul[mid].sources[ssrc];
+ });
-var attachProperties = function (match, location, names, rawName) {
- if (rawName && !names) {
- location[rawName] = toIntIfInt(match[1]);
- }
- else {
- for (var i = 0; i < names.length; i += 1) {
- if (match[i+1] != null) {
- location[names[i]] = toIntIfInt(match[i+1]);
- }
+ return true;
+ }
+ });
+ } else {
+ session.media.push(mid2ul[mid]);
+ }
+ }
+ });
}
- }
-};
-var parseReg = function (obj, location, content) {
- var needsBlank = obj.name && obj.names;
- if (obj.push && !location[obj.push]) {
- location[obj.push] = [];
- }
- else if (needsBlank && !location[obj.name]) {
- location[obj.name] = {};
- }
- var keyLocation = obj.push ?
- {} : // blank object that will be pushed
- needsBlank ? location[obj.name] : location; // otherwise, named location or root
+ // We regenerate the BUNDLE group (since we regenerated the mids)
+ session.groups.some(function(group) {
+ if (group.type === 'BUNDLE') {
+ group.mids = mids.join(' ');
+ return true;
+ }
+ });
- attachProperties(content.match(obj.reg), keyLocation, obj.names, obj.name);
+ // msid semantic
+ session.msidSemantic = {
+ semantic: 'WMS',
+ token: '*'
+ };
- if (obj.push) {
- location[obj.push].push(keyLocation);
- }
+ var resStr = transform.write(session);
+
+ // Cache the transformed SDP (Unified Plan) for later re-use in this
+ // function.
+ this.cache[desc.type] = resStr;
+
+ return new RTCSessionDescription({
+ type: desc.type,
+ sdp: resStr
+ });
+
+ //#endregion
};
-var grammar = require('./grammar');
-var validLine = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
+},{"./array-equals":87,"./transform":90}],90:[function(require,module,exports){
+var transform = require('sdp-transform');
-exports.parse = function (sdp) {
- var session = {}
- , media = []
- , location = session; // points at where properties go under (one of the above)
+exports.write = function(session, opts) {
- // parse lines we understand
- sdp.split(/(\r\n|\r|\n)/).filter(validLine).forEach(function (l) {
- var type = l[0];
- var content = l.slice(2);
- if (type === 'm') {
- media.push({rtp: [], fmtp: []});
- location = media[media.length-1]; // point at latest media line
- }
+ if (typeof session !== 'undefined' &&
+ typeof session.media !== 'undefined' &&
+ Array.isArray(session.media)) {
+
+ session.media.forEach(function (mLine) {
+ // expand sources to ssrcs
+ if (typeof mLine.sources !== 'undefined' &&
+ Object.keys(mLine.sources).length !== 0) {
+ mLine.ssrcs = [];
+ Object.keys(mLine.sources).forEach(function (ssrc) {
+ var source = mLine.sources[ssrc];
+ Object.keys(source).forEach(function (attribute) {
+ mLine.ssrcs.push({
+ id: ssrc,
+ attribute: attribute,
+ value: source[attribute]
+ });
+ });
+ });
+ delete mLine.sources;
+ }
+
+ // join ssrcs in ssrc groups
+ if (typeof mLine.ssrcGroups !== 'undefined' &&
+ Array.isArray(mLine.ssrcGroups)) {
+ mLine.ssrcGroups.forEach(function (ssrcGroup) {
+ if (typeof ssrcGroup.ssrcs !== 'undefined' &&
+ Array.isArray(ssrcGroup.ssrcs)) {
+ ssrcGroup.ssrcs = ssrcGroup.ssrcs.join(' ');
+ }
+ });
+ }
+ });
+ }
- for (var j = 0; j < (grammar[type] || []).length; j += 1) {
- var obj = grammar[type][j];
- if (obj.reg.test(content)) {
- return parseReg(obj, location, content);
+ // join group mids
+ if (typeof session !== 'undefined' &&
+ typeof session.groups !== 'undefined' && Array.isArray(session.groups)) {
+
+ session.groups.forEach(function (g) {
+ if (typeof g.mids !== 'undefined' && Array.isArray(g.mids)) {
+ g.mids = g.mids.join(' ');
}
- }
- });
+ });
+ }
- session.media = media; // link it up
- return session;
+ return transform.write(session, opts);
};
-var fmtpReducer = function (acc, expr) {
- var s = expr.split('=');
- if (s.length === 2) {
- acc[s[0]] = toIntIfInt(s[1]);
- }
- return acc;
-};
+exports.parse = function(sdp) {
+ var session = transform.parse(sdp);
-exports.parseFmtpConfig = function (str) {
- return str.split(';').reduce(fmtpReducer, {});
-};
+ if (typeof session !== 'undefined' && typeof session.media !== 'undefined' &&
+ Array.isArray(session.media)) {
-exports.parsePayloads = function (str) {
- return str.split(' ').map(Number);
-};
+ session.media.forEach(function (mLine) {
+ // group sources attributes by ssrc
+ if (typeof mLine.ssrcs !== 'undefined' && Array.isArray(mLine.ssrcs)) {
+ mLine.sources = {};
+ mLine.ssrcs.forEach(function (ssrc) {
+ if (!mLine.sources[ssrc.id])
+ mLine.sources[ssrc.id] = {};
+ mLine.sources[ssrc.id][ssrc.attribute] = ssrc.value;
+ });
-exports.parseRemoteCandidates = function (str) {
- var candidates = [];
- var parts = str.split(' ').map(toIntIfInt);
- for (var i = 0; i < parts.length; i += 3) {
- candidates.push({
- component: parts[i],
- ip: parts[i + 1],
- port: parts[i + 2]
+ delete mLine.ssrcs;
+ }
+
+ // split ssrcs in ssrc groups
+ if (typeof mLine.ssrcGroups !== 'undefined' &&
+ Array.isArray(mLine.ssrcGroups)) {
+ mLine.ssrcGroups.forEach(function (ssrcGroup) {
+ if (typeof ssrcGroup.ssrcs === 'string') {
+ ssrcGroup.ssrcs = ssrcGroup.ssrcs.split(' ');
+ }
+ });
+ }
});
}
- return candidates;
-};
+ // split group mids
+ if (typeof session !== 'undefined' &&
+ typeof session.groups !== 'undefined' && Array.isArray(session.groups)) {
-},{"./grammar":90}],93:[function(require,module,exports){
-var grammar = require('./grammar');
+ session.groups.forEach(function (g) {
+ if (typeof g.mids === 'string') {
+ g.mids = g.mids.split(' ');
+ }
+ });
+ }
-// customized util.format - discards excess arguments and can void middle ones
-var formatRegExp = /%[sdv%]/g;
-var format = function (formatStr) {
- var i = 1;
- var args = arguments;
- var len = args.length;
- return formatStr.replace(formatRegExp, function (x) {
- if (i >= len) {
- return x; // missing argument
- }
- var arg = args[i];
- i += 1;
- switch (x) {
- case '%%':
- return '%';
- case '%s':
- return String(arg);
- case '%d':
- return Number(arg);
- case '%v':
- return '';
- }
- });
- // NB: we discard excess arguments - they are typically undefined from makeLine
+ return session;
};
-var makeLine = function (type, obj, location) {
- var str = obj.format instanceof Function ?
- (obj.format(obj.push ? location : location[obj.name])) :
- obj.format;
- var args = [type + '=' + str];
- if (obj.names) {
- for (var i = 0; i < obj.names.length; i += 1) {
- var n = obj.names[i];
- if (obj.name) {
- args.push(location[obj.name][n]);
+},{"sdp-transform":92}],91:[function(require,module,exports){
+var grammar = module.exports = {
+ v: [{
+ name: 'version',
+ reg: /^(\d*)$/
+ }],
+ o: [{ //o=- 20518 0 IN IP4 203.0.113.1
+ // NB: sessionId will be a String in most cases because it is huge
+ name: 'origin',
+ reg: /^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,
+ names: ['username', 'sessionId', 'sessionVersion', 'netType', 'ipVer', 'address'],
+ format: "%s %s %d %s IP%d %s"
+ }],
+ // default parsing of these only (though some of these feel outdated)
+ s: [{ name: 'name' }],
+ i: [{ name: 'description' }],
+ u: [{ name: 'uri' }],
+ e: [{ name: 'email' }],
+ p: [{ name: 'phone' }],
+ z: [{ name: 'timezones' }], // TODO: this one can actually be parsed properly..
+ r: [{ name: 'repeats' }], // TODO: this one can also be parsed properly
+ //k: [{}], // outdated thing ignored
+ t: [{ //t=0 0
+ name: 'timing',
+ reg: /^(\d*) (\d*)/,
+ names: ['start', 'stop'],
+ format: "%d %d"
+ }],
+ c: [{ //c=IN IP4 10.47.197.26
+ name: 'connection',
+ reg: /^IN IP(\d) (\S*)/,
+ names: ['version', 'ip'],
+ format: "IN IP%d %s"
+ }],
+ b: [{ //b=AS:4000
+ push: 'bandwidth',
+ reg: /^(TIAS|AS|CT|RR|RS):(\d*)/,
+ names: ['type', 'limit'],
+ format: "%s:%s"
+ }],
+ m: [{ //m=video 51744 RTP/AVP 126 97 98 34 31
+ // NB: special - pushes to session
+ // TODO: rtp/fmtp should be filtered by the payloads found here?
+ reg: /^(\w*) (\d*) ([\w\/]*)(?: (.*))?/,
+ names: ['type', 'port', 'protocol', 'payloads'],
+ format: "%s %d %s %s"
+ }],
+ a: [
+ { //a=rtpmap:110 opus/48000/2
+ push: 'rtp',
+ reg: /^rtpmap:(\d*) ([\w\-]*)\/(\d*)(?:\s*\/(\S*))?/,
+ names: ['payload', 'codec', 'rate', 'encoding'],
+ format: function (o) {
+ return (o.encoding) ?
+ "rtpmap:%d %s/%s/%s":
+ "rtpmap:%d %s/%s";
}
- else { // for mLine and push attributes
- args.push(location[obj.names[i]]);
+ },
+ { //a=fmtp:108 profile-level-id=24;object=23;bitrate=64000
+ push: 'fmtp',
+ reg: /^fmtp:(\d*) (\S*)/,
+ names: ['payload', 'config'],
+ format: "fmtp:%d %s"
+ },
+ { //a=control:streamid=0
+ name: 'control',
+ reg: /^control:(.*)/,
+ format: "control:%s"
+ },
+ { //a=rtcp:65179 IN IP4 193.84.77.194
+ name: 'rtcp',
+ reg: /^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,
+ names: ['port', 'netType', 'ipVer', 'address'],
+ format: function (o) {
+ return (o.address != null) ?
+ "rtcp:%d %s IP%d %s":
+ "rtcp:%d";
}
- }
- }
- else {
- args.push(location[obj.name]);
- }
- return format.apply(null, args);
-};
-
-// RFC specified order
-// TODO: extend this with all the rest
-var defaultOuterOrder = [
- 'v', 'o', 's', 'i',
- 'u', 'e', 'p', 'c',
- 'b', 't', 'r', 'z', 'a'
-];
-var defaultInnerOrder = ['i', 'c', 'b', 'a'];
-
-
-module.exports = function (session, opts) {
- opts = opts || {};
- // ensure certain properties exist
- if (session.version == null) {
- session.version = 0; // "v=0" must be there (only defined version atm)
- }
- if (session.name == null) {
- session.name = " "; // "s= " must be there if no meaningful name set
- }
- session.media.forEach(function (mLine) {
- if (mLine.payloads == null) {
- mLine.payloads = "";
- }
- });
-
- var outerOrder = opts.outerOrder || defaultOuterOrder;
- var innerOrder = opts.innerOrder || defaultInnerOrder;
- var sdp = [];
-
- // loop through outerOrder for matching properties on session
- outerOrder.forEach(function (type) {
- grammar[type].forEach(function (obj) {
- if (obj.name in session && session[obj.name] != null) {
- sdp.push(makeLine(type, obj, session));
+ },
+ { //a=rtcp-fb:98 trr-int 100
+ push: 'rtcpFbTrrInt',
+ reg: /^rtcp-fb:(\*|\d*) trr-int (\d*)/,
+ names: ['payload', 'value'],
+ format: "rtcp-fb:%d trr-int %d"
+ },
+ { //a=rtcp-fb:98 nack rpsi
+ push: 'rtcpFb',
+ reg: /^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,
+ names: ['payload', 'type', 'subtype'],
+ format: function (o) {
+ return (o.subtype != null) ?
+ "rtcp-fb:%s %s %s":
+ "rtcp-fb:%s %s";
+ }
+ },
+ { //a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
+ //a=extmap:1/recvonly URI-gps-string
+ push: 'ext',
+ reg: /^extmap:([\w_\/]*) (\S*)(?: (\S*))?/,
+ names: ['value', 'uri', 'config'], // value may include "/direction" suffix
+ format: function (o) {
+ return (o.config != null) ?
+ "extmap:%s %s %s":
+ "extmap:%s %s";
}
- else if (obj.push in session && session[obj.push] != null) {
- session[obj.push].forEach(function (el) {
- sdp.push(makeLine(type, obj, el));
- });
+ },
+ {
+ //a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR|2^20|1:32
+ push: 'crypto',
+ reg: /^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,
+ names: ['id', 'suite', 'config', 'sessionConfig'],
+ format: function (o) {
+ return (o.sessionConfig != null) ?
+ "crypto:%d %s %s %s":
+ "crypto:%d %s %s";
}
- });
- });
-
- // then for each media line, follow the innerOrder
- session.media.forEach(function (mLine) {
- sdp.push(makeLine('m', grammar.m[0], mLine));
-
- innerOrder.forEach(function (type) {
- grammar[type].forEach(function (obj) {
- if (obj.name in mLine && mLine[obj.name] != null) {
- sdp.push(makeLine(type, obj, mLine));
- }
- else if (obj.push in mLine && mLine[obj.push] != null) {
- mLine[obj.push].forEach(function (el) {
- sdp.push(makeLine(type, obj, el));
- });
+ },
+ { //a=setup:actpass
+ name: 'setup',
+ reg: /^setup:(\w*)/,
+ format: "setup:%s"
+ },
+ { //a=mid:1
+ name: 'mid',
+ reg: /^mid:([^\s]*)/,
+ format: "mid:%s"
+ },
+ { //a=msid:0c8b064d-d807-43b4-b434-f92a889d8587 98178685-d409-46e0-8e16-7ef0db0db64a
+ name: 'msid',
+ reg: /^msid:(.*)/,
+ format: "msid:%s"
+ },
+ { //a=ptime:20
+ name: 'ptime',
+ reg: /^ptime:(\d*)/,
+ format: "ptime:%d"
+ },
+ { //a=maxptime:60
+ name: 'maxptime',
+ reg: /^maxptime:(\d*)/,
+ format: "maxptime:%d"
+ },
+ { //a=sendrecv
+ name: 'direction',
+ reg: /^(sendrecv|recvonly|sendonly|inactive)/
+ },
+ { //a=ice-lite
+ name: 'icelite',
+ reg: /^(ice-lite)/
+ },
+ { //a=ice-ufrag:F7gI
+ name: 'iceUfrag',
+ reg: /^ice-ufrag:(\S*)/,
+ format: "ice-ufrag:%s"
+ },
+ { //a=ice-pwd:x9cml/YzichV2+XlhiMu8g
+ name: 'icePwd',
+ reg: /^ice-pwd:(\S*)/,
+ format: "ice-pwd:%s"
+ },
+ { //a=fingerprint:SHA-1 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33
+ name: 'fingerprint',
+ reg: /^fingerprint:(\S*) (\S*)/,
+ names: ['type', 'hash'],
+ format: "fingerprint:%s %s"
+ },
+ {
+ //a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ host
+ //a=candidate:1162875081 1 udp 2113937151 192.168.34.75 60017 typ host generation 0
+ //a=candidate:3289912957 2 udp 1845501695 193.84.77.194 60017 typ srflx raddr 192.168.34.75 rport 60017 generation 0
+ push:'candidates',
+ reg: /^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: generation (\d*))?/,
+ names: ['foundation', 'component', 'transport', 'priority', 'ip', 'port', 'type', 'raddr', 'rport', 'generation'],
+ format: function (o) {
+ var str = "candidate:%s %d %s %d %s %d typ %s";
+ // NB: candidate has two optional chunks, so %void middle one if it's missing
+ str += (o.raddr != null) ? " raddr %s rport %d" : "%v%v";
+ if (o.generation != null) {
+ str += " generation %d";
}
- });
- });
- });
-
- return sdp.join('\r\n') + '\r\n';
-};
-
-},{"./grammar":90}],94:[function(require,module,exports){
-var MediaStreamType = {
- VIDEO_TYPE: "Video",
-
- AUDIO_TYPE: "Audio"
-};
-module.exports = MediaStreamType;
-},{}],95:[function(require,module,exports){
-var RTCBrowserType = {
- RTC_BROWSER_CHROME: "rtc_browser.chrome",
-
- RTC_BROWSER_FIREFOX: "rtc_browser.firefox"
-};
-
-module.exports = RTCBrowserType;
-},{}],96:[function(require,module,exports){
-var RTCEvents = {
- LASTN_CHANGED: "rtc.lastn_changed",
- DOMINANTSPEAKER_CHANGED: "rtc.dominantspeaker_changed",
- LASTN_ENDPOINT_CHANGED: "rtc.lastn_endpoint_changed",
- SIMULCAST_LAYER_CHANGED: "rtc.simulcast_layer_changed",
- SIMULCAST_LAYER_CHANGING: "rtc.simulcast_layer_changing",
- SIMULCAST_START: "rtc.simlcast_start",
- SIMULCAST_STOP: "rtc.simlcast_stop",
- AVAILABLE_DEVICES_CHANGED: "rtc.available_devices_changed"
-};
-
-module.exports = RTCEvents;
-},{}],97:[function(require,module,exports){
-var Resolutions = {
- "1080": {
- width: 1920,
- height: 1080,
- order: 7
+ return str;
+ }
},
- "fullhd": {
- width: 1920,
- height: 1080,
- order: 7
+ { //a=end-of-candidates (keep after the candidates line for readability)
+ name: 'endOfCandidates',
+ reg: /^(end-of-candidates)/
},
- "720": {
- width: 1280,
- height: 720,
- order: 6
+ { //a=remote-candidates:1 203.0.113.1 54400 2 203.0.113.1 54401 ...
+ name: 'remoteCandidates',
+ reg: /^remote-candidates:(.*)/,
+ format: "remote-candidates:%s"
},
- "hd": {
- width: 1280,
- height: 720,
- order: 6
+ { //a=ice-options:google-ice
+ name: 'iceOptions',
+ reg: /^ice-options:(\S*)/,
+ format: "ice-options:%s"
},
- "960": {
- width: 960,
- height: 720,
- order: 5
+ { //a=ssrc:2566107569 cname:t9YU8M1UxTF8Y1A1
+ push: "ssrcs",
+ reg: /^ssrc:(\d*) ([\w_]*):(.*)/,
+ names: ['id', 'attribute', 'value'],
+ format: "ssrc:%d %s:%s"
},
- "640": {
- width: 640,
- height: 480,
- order: 4
+ { //a=ssrc-group:FEC 1 2
+ push: "ssrcGroups",
+ reg: /^ssrc-group:(\w*) (.*)/,
+ names: ['semantics', 'ssrcs'],
+ format: "ssrc-group:%s %s"
},
- "vga": {
- width: 640,
- height: 480,
- order: 4
+ { //a=msid-semantic: WMS Jvlam5X3SX1OP6pn20zWogvaKJz5Hjf9OnlV
+ name: "msidSemantic",
+ reg: /^msid-semantic:\s?(\w*) (\S*)/,
+ names: ['semantic', 'token'],
+ format: "msid-semantic: %s %s" // space after ":" is not accidental
},
- "360": {
- width: 640,
- height: 360,
- order: 3
+ { //a=group:BUNDLE audio video
+ push: 'groups',
+ reg: /^group:(\w*) (.*)/,
+ names: ['type', 'mids'],
+ format: "group:%s %s"
},
- "320": {
- width: 320,
- height: 240,
- order: 2
+ { //a=rtcp-mux
+ name: 'rtcpMux',
+ reg: /^(rtcp-mux)/
},
- "180": {
- width: 320,
- height: 180,
- order: 1
- }
-};
-module.exports = Resolutions;
-},{}],98:[function(require,module,exports){
-var StreamEventTypes = {
- EVENT_TYPE_LOCAL_CREATED: "stream.local_created",
-
- EVENT_TYPE_LOCAL_CHANGED: "stream.local_changed",
-
- EVENT_TYPE_LOCAL_ENDED: "stream.local_ended",
-
- EVENT_TYPE_REMOTE_CREATED: "stream.remote_created",
-
- EVENT_TYPE_REMOTE_ENDED: "stream.remote_ended",
-
- EVENT_TYPE_REMOTE_CHANGED: "stream.changed"
-};
-
-module.exports = StreamEventTypes;
-},{}],99:[function(require,module,exports){
-var UIEvents = {
- NICKNAME_CHANGED: "UI.nickname_changed",
- SELECTED_ENDPOINT: "UI.selected_endpoint",
- PINNED_ENDPOINT: "UI.pinned_endpoint"
-};
-module.exports = UIEvents;
-},{}],100:[function(require,module,exports){
-var AuthenticationEvents = {
- /**
- * Event callback arguments:
- * function(authenticationEnabled, userIdentity)
- * authenticationEnabled - indicates whether authentication has been enabled
- * in this session
- * userIdentity - if user has been logged in then it contains user name. If
- * contains 'null' or 'undefined' then user is not logged in.
- */
- IDENTITY_UPDATED: "authentication.identity_updated"
-};
-module.exports = AuthenticationEvents;
-
-},{}],101:[function(require,module,exports){
-var CQEvents = {
- LOCALSTATS_UPDATED: "cq.localstats_updated",
- REMOTESTATS_UPDATED: "cq.remotestats_updated",
- STOP: "cq.stop"
+ { //a=rtcp-rsize
+ name: 'rtcpRsize',
+ reg: /^(rtcp-rsize)/
+ },
+ { // any a= that we don't understand is kepts verbatim on media.invalid
+ push: 'invalid',
+ names: ["value"]
+ }
+ ]
};
-module.exports = CQEvents;
-},{}],102:[function(require,module,exports){
-var DesktopSharingEventTypes = {
- INIT: "ds.init",
+// set sensible defaults to avoid polluting the grammar with boring details
+Object.keys(grammar).forEach(function (key) {
+ var objs = grammar[key];
+ objs.forEach(function (obj) {
+ if (!obj.reg) {
+ obj.reg = /(.*)/;
+ }
+ if (!obj.format) {
+ obj.format = "%s";
+ }
+ });
+});
- SWITCHING_DONE: "ds.switching_done",
+},{}],92:[function(require,module,exports){
+var parser = require('./parser');
+var writer = require('./writer');
- NEW_STREAM_CREATED: "ds.new_stream_created"
-};
+exports.write = writer;
+exports.parse = parser.parse;
+exports.parseFmtpConfig = parser.parseFmtpConfig;
+exports.parsePayloads = parser.parsePayloads;
+exports.parseRemoteCandidates = parser.parseRemoteCandidates;
-module.exports = DesktopSharingEventTypes;
-},{}],103:[function(require,module,exports){
-var Events = {
- DTMF_SUPPORT_CHANGED: "members.dtmf_support_changed"
+},{"./parser":93,"./writer":94}],93:[function(require,module,exports){
+var toIntIfInt = function (v) {
+ return String(Number(v)) === v ? Number(v) : v;
};
-module.exports = Events;
-
-},{}],104:[function(require,module,exports){
-module.exports = {
- getLanguages : function () {
- var languages = [];
- for(var lang in this)
- {
- if(typeof this[lang] === "string")
- languages.push(this[lang]);
- }
- return languages;
- },
- EN: "en",
- BG: "bg",
- DE: "de",
- TR: "tr"
-}
-},{}],105:[function(require,module,exports){
-var XMPPEvents = {
- CONNECTION_FAILED: "xmpp.connection.failed",
- CONFERENCE_CREATED: "xmpp.conferenceCreated.jingle",
- CALL_TERMINATED: "xmpp.callterminated.jingle",
- CALL_INCOMING: "xmpp.callincoming.jingle",
- DISPOSE_CONFERENCE: "xmpp.dispose_conference",
- GRACEFUL_SHUTDOWN: "xmpp.graceful_shutdown",
- KICKED: "xmpp.kicked",
- BRIDGE_DOWN: "xmpp.bridge_down",
- USER_ID_CHANGED: "xmpp.user_id_changed",
- STREAMS_CHANGED: "xmpp.streams_changed",
- // We joined the MUC
- MUC_JOINED: "xmpp.muc_joined",
- // A member joined the MUC
- MUC_MEMBER_JOINED: "xmpp.muc_member_joined",
- // A member left the MUC
- MUC_MEMBER_LEFT: "xmpp.muc_member_left",
- MUC_ROLE_CHANGED: "xmpp.muc_role_changed",
- MUC_DESTROYED: "xmpp.muc_destroyed",
- DISPLAY_NAME_CHANGED: "xmpp.display_name_changed",
- REMOTE_STATS: "xmpp.remote_stats",
- LOCAL_ROLE_CHANGED: "xmpp.localrole_changed",
- PRESENCE_STATUS: "xmpp.presence_status",
- RESERVATION_ERROR: "xmpp.room_reservation_error",
- SUBJECT_CHANGED: "xmpp.subject_changed",
- MESSAGE_RECEIVED: "xmpp.message_received",
- SENDING_CHAT_MESSAGE: "xmpp.sending_chat_message",
- PASSWORD_REQUIRED: "xmpp.password_required",
- AUTHENTICATION_REQUIRED: "xmpp.authentication_required",
- CHAT_ERROR_RECEIVED: "xmpp.chat_error_received",
- ETHERPAD: "xmpp.etherpad",
- DEVICE_AVAILABLE: "xmpp.device_available",
- START_MUTED: "xmpp.start_muted"
+var attachProperties = function (match, location, names, rawName) {
+ if (rawName && !names) {
+ location[rawName] = toIntIfInt(match[1]);
+ }
+ else {
+ for (var i = 0; i < names.length; i += 1) {
+ if (match[i+1] != null) {
+ location[names[i]] = toIntIfInt(match[i+1]);
+ }
+ }
+ }
};
-module.exports = XMPPEvents;
-},{}],106:[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;
+var parseReg = function (obj, location, content) {
+ var needsBlank = obj.name && obj.names;
+ if (obj.push && !location[obj.push]) {
+ location[obj.push] = [];
+ }
+ else if (needsBlank && !location[obj.name]) {
+ location[obj.name] = {};
+ }
+ var keyLocation = obj.push ?
+ {} : // blank object that will be pushed
+ needsBlank ? location[obj.name] : location; // otherwise, named location or root
-// 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;
+ attachProperties(content.match(obj.reg), keyLocation, obj.names, obj.name);
-// 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;
+ if (obj.push) {
+ location[obj.push].push(keyLocation);
+ }
};
-EventEmitter.prototype.emit = function(type) {
- var er, handler, len, args, i, listeners;
+var grammar = require('./grammar');
+var validLine = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
- if (!this._events)
- this._events = {};
+exports.parse = function (sdp) {
+ var session = {}
+ , media = []
+ , location = session; // points at where properties go under (one of the above)
- // 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.');
+ // parse lines we understand
+ sdp.split(/(\r\n|\r|\n)/).filter(validLine).forEach(function (l) {
+ var type = l[0];
+ var content = l.slice(2);
+ if (type === 'm') {
+ media.push({rtp: [], fmtp: []});
+ location = media[media.length-1]; // point at latest media line
}
- }
-
- 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);
+ for (var j = 0; j < (grammar[type] || []).length; j += 1) {
+ var obj = grammar[type][j];
+ if (obj.reg.test(content)) {
+ return parseReg(obj, location, content);
+ }
}
- } 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;
+ session.media = media; // link it up
+ return session;
};
-EventEmitter.prototype.addListener = function(type, listener) {
- var m;
+var fmtpReducer = function (acc, expr) {
+ var s = expr.split('=');
+ if (s.length === 2) {
+ acc[s[0]] = toIntIfInt(s[1]);
+ }
+ return acc;
+};
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
+exports.parseFmtpConfig = function (str) {
+ return str.split(';').reduce(fmtpReducer, {});
+};
- if (!this._events)
- this._events = {};
+exports.parsePayloads = function (str) {
+ return str.split(' ').map(Number);
+};
- // 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);
+exports.parseRemoteCandidates = function (str) {
+ var candidates = [];
+ var parts = str.split(' ').map(toIntIfInt);
+ for (var i = 0; i < parts.length; i += 3) {
+ candidates.push({
+ component: parts[i],
+ ip: parts[i + 1],
+ port: parts[i + 2]
+ });
+ }
+ return candidates;
+};
- 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];
+},{"./grammar":91}],94:[function(require,module,exports){
+var grammar = require('./grammar');
- // 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;
+// customized util.format - discards excess arguments and can void middle ones
+var formatRegExp = /%[sdv%]/g;
+var format = function (formatStr) {
+ var i = 1;
+ var args = arguments;
+ var len = args.length;
+ return formatStr.replace(formatRegExp, function (x) {
+ if (i >= len) {
+ return x; // missing argument
+ }
+ var arg = args[i];
+ i += 1;
+ switch (x) {
+ case '%%':
+ return '%';
+ case '%s':
+ return String(arg);
+ case '%d':
+ return Number(arg);
+ case '%v':
+ return '';
}
+ });
+ // NB: we discard excess arguments - they are typically undefined from makeLine
+};
- 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();
+var makeLine = function (type, obj, location) {
+ var str = obj.format instanceof Function ?
+ (obj.format(obj.push ? location : location[obj.name])) :
+ obj.format;
+
+ var args = [type + '=' + str];
+ if (obj.names) {
+ for (var i = 0; i < obj.names.length; i += 1) {
+ var n = obj.names[i];
+ if (obj.name) {
+ args.push(location[obj.name][n]);
+ }
+ else { // for mLine and push attributes
+ args.push(location[obj.names[i]]);
}
}
}
-
- return this;
+ else {
+ args.push(location[obj.name]);
+ }
+ return format.apply(null, args);
};
-EventEmitter.prototype.on = EventEmitter.prototype.addListener;
+// RFC specified order
+// TODO: extend this with all the rest
+var defaultOuterOrder = [
+ 'v', 'o', 's', 'i',
+ 'u', 'e', 'p', 'c',
+ 'b', 't', 'r', 'z', 'a'
+];
+var defaultInnerOrder = ['i', 'c', 'b', 'a'];
-EventEmitter.prototype.once = function(type, listener) {
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
- var fired = false;
+module.exports = function (session, opts) {
+ opts = opts || {};
+ // ensure certain properties exist
+ if (session.version == null) {
+ session.version = 0; // "v=0" must be there (only defined version atm)
+ }
+ if (session.name == null) {
+ session.name = " "; // "s= " must be there if no meaningful name set
+ }
+ session.media.forEach(function (mLine) {
+ if (mLine.payloads == null) {
+ mLine.payloads = "";
+ }
+ });
- function g() {
- this.removeListener(type, g);
+ var outerOrder = opts.outerOrder || defaultOuterOrder;
+ var innerOrder = opts.innerOrder || defaultInnerOrder;
+ var sdp = [];
- if (!fired) {
- fired = true;
- listener.apply(this, arguments);
- }
- }
+ // loop through outerOrder for matching properties on session
+ outerOrder.forEach(function (type) {
+ grammar[type].forEach(function (obj) {
+ if (obj.name in session && session[obj.name] != null) {
+ sdp.push(makeLine(type, obj, session));
+ }
+ else if (obj.push in session && session[obj.push] != null) {
+ session[obj.push].forEach(function (el) {
+ sdp.push(makeLine(type, obj, el));
+ });
+ }
+ });
+ });
- g.listener = listener;
- this.on(type, g);
+ // then for each media line, follow the innerOrder
+ session.media.forEach(function (mLine) {
+ sdp.push(makeLine('m', grammar.m[0], mLine));
- return this;
-};
+ innerOrder.forEach(function (type) {
+ grammar[type].forEach(function (obj) {
+ if (obj.name in mLine && mLine[obj.name] != null) {
+ sdp.push(makeLine(type, obj, mLine));
+ }
+ else if (obj.push in mLine && mLine[obj.push] != null) {
+ mLine[obj.push].forEach(function (el) {
+ sdp.push(makeLine(type, obj, el));
+ });
+ }
+ });
+ });
+ });
-// emits a 'removeListener' event iff the listener was removed
-EventEmitter.prototype.removeListener = function(type, listener) {
- var list, position, length, i;
+ return sdp.join('\r\n') + '\r\n';
+};
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
+},{"./grammar":91}],95:[function(require,module,exports){
+var MediaStreamType = {
+ VIDEO_TYPE: "Video",
- if (!this._events || !this._events[type])
- return this;
+ AUDIO_TYPE: "Audio"
+};
+module.exports = MediaStreamType;
+},{}],96:[function(require,module,exports){
+var RTCBrowserType = {
+ RTC_BROWSER_CHROME: "rtc_browser.chrome",
- list = this._events[type];
- length = list.length;
- position = -1;
+ RTC_BROWSER_FIREFOX: "rtc_browser.firefox"
+};
- if (list === listener ||
- (isFunction(list.listener) && list.listener === listener)) {
- delete this._events[type];
- if (this._events.removeListener)
- this.emit('removeListener', type, listener);
+module.exports = RTCBrowserType;
+},{}],97:[function(require,module,exports){
+var RTCEvents = {
+ LASTN_CHANGED: "rtc.lastn_changed",
+ DOMINANTSPEAKER_CHANGED: "rtc.dominantspeaker_changed",
+ LASTN_ENDPOINT_CHANGED: "rtc.lastn_endpoint_changed",
+ SIMULCAST_LAYER_CHANGED: "rtc.simulcast_layer_changed",
+ SIMULCAST_LAYER_CHANGING: "rtc.simulcast_layer_changing",
+ SIMULCAST_START: "rtc.simlcast_start",
+ SIMULCAST_STOP: "rtc.simlcast_stop",
+ AVAILABLE_DEVICES_CHANGED: "rtc.available_devices_changed"
+};
- } else if (isObject(list)) {
- for (i = length; i-- > 0;) {
- if (list[i] === listener ||
- (list[i].listener && list[i].listener === listener)) {
- position = i;
- break;
- }
+module.exports = RTCEvents;
+},{}],98:[function(require,module,exports){
+var Resolutions = {
+ "1080": {
+ width: 1920,
+ height: 1080,
+ order: 7
+ },
+ "fullhd": {
+ width: 1920,
+ height: 1080,
+ order: 7
+ },
+ "720": {
+ width: 1280,
+ height: 720,
+ order: 6
+ },
+ "hd": {
+ width: 1280,
+ height: 720,
+ order: 6
+ },
+ "960": {
+ width: 960,
+ height: 720,
+ order: 5
+ },
+ "640": {
+ width: 640,
+ height: 480,
+ order: 4
+ },
+ "vga": {
+ width: 640,
+ height: 480,
+ order: 4
+ },
+ "360": {
+ width: 640,
+ height: 360,
+ order: 3
+ },
+ "320": {
+ width: 320,
+ height: 240,
+ order: 2
+ },
+ "180": {
+ width: 320,
+ height: 180,
+ order: 1
}
+};
+module.exports = Resolutions;
+},{}],99:[function(require,module,exports){
+var StreamEventTypes = {
+ EVENT_TYPE_LOCAL_CREATED: "stream.local_created",
- if (position < 0)
- return this;
+ EVENT_TYPE_LOCAL_CHANGED: "stream.local_changed",
+
+ EVENT_TYPE_LOCAL_ENDED: "stream.local_ended",
+
+ EVENT_TYPE_REMOTE_CREATED: "stream.remote_created",
- if (list.length === 1) {
- list.length = 0;
- delete this._events[type];
- } else {
- list.splice(position, 1);
- }
+ EVENT_TYPE_REMOTE_ENDED: "stream.remote_ended",
- if (this._events.removeListener)
- this.emit('removeListener', type, listener);
- }
+ EVENT_TYPE_REMOTE_CHANGED: "stream.changed"
+};
- return this;
+module.exports = StreamEventTypes;
+},{}],100:[function(require,module,exports){
+var UIEvents = {
+ NICKNAME_CHANGED: "UI.nickname_changed",
+ SELECTED_ENDPOINT: "UI.selected_endpoint",
+ PINNED_ENDPOINT: "UI.pinned_endpoint"
+};
+module.exports = UIEvents;
+},{}],101:[function(require,module,exports){
+var AuthenticationEvents = {
+ /**
+ * Event callback arguments:
+ * function(authenticationEnabled, userIdentity)
+ * authenticationEnabled - indicates whether authentication has been enabled
+ * in this session
+ * userIdentity - if user has been logged in then it contains user name. If
+ * contains 'null' or 'undefined' then user is not logged in.
+ */
+ IDENTITY_UPDATED: "authentication.identity_updated"
};
+module.exports = AuthenticationEvents;
-EventEmitter.prototype.removeAllListeners = function(type) {
- var key, listeners;
+},{}],102:[function(require,module,exports){
+var CQEvents = {
+ LOCALSTATS_UPDATED: "cq.localstats_updated",
+ REMOTESTATS_UPDATED: "cq.remotestats_updated",
+ STOP: "cq.stop"
+};
- if (!this._events)
- return this;
+module.exports = CQEvents;
+},{}],103:[function(require,module,exports){
+var DesktopSharingEventTypes = {
+ INIT: "ds.init",
- // 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;
- }
+ SWITCHING_DONE: "ds.switching_done",
- // 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;
- }
+ NEW_STREAM_CREATED: "ds.new_stream_created"
+};
- listeners = this._events[type];
+module.exports = DesktopSharingEventTypes;
+},{}],104:[function(require,module,exports){
+var Events = {
+ DTMF_SUPPORT_CHANGED: "members.dtmf_support_changed"
+};
- if (isFunction(listeners)) {
- this.removeListener(type, listeners);
- } else {
- // LIFO order
- while (listeners.length)
- this.removeListener(type, listeners[listeners.length - 1]);
- }
- delete this._events[type];
+module.exports = Events;
- return this;
+},{}],105:[function(require,module,exports){
+module.exports = {
+ getLanguages : function () {
+ var languages = [];
+ for(var lang in this)
+ {
+ if(typeof this[lang] === "string")
+ languages.push(this[lang]);
+ }
+ return languages;
+ },
+ EN: "en",
+ BG: "bg",
+ DE: "de",
+ TR: "tr"
+}
+},{}],106:[function(require,module,exports){
+var XMPPEvents = {
+ CONNECTION_FAILED: "xmpp.connection.failed",
+ CONFERENCE_CREATED: "xmpp.conferenceCreated.jingle",
+ CALL_TERMINATED: "xmpp.callterminated.jingle",
+ CALL_INCOMING: "xmpp.callincoming.jingle",
+ DISPOSE_CONFERENCE: "xmpp.dispose_conference",
+ GRACEFUL_SHUTDOWN: "xmpp.graceful_shutdown",
+ KICKED: "xmpp.kicked",
+ BRIDGE_DOWN: "xmpp.bridge_down",
+ USER_ID_CHANGED: "xmpp.user_id_changed",
+ STREAMS_CHANGED: "xmpp.streams_changed",
+ // We joined the MUC
+ MUC_JOINED: "xmpp.muc_joined",
+ // A member joined the MUC
+ MUC_MEMBER_JOINED: "xmpp.muc_member_joined",
+ // A member left the MUC
+ MUC_MEMBER_LEFT: "xmpp.muc_member_left",
+ MUC_ROLE_CHANGED: "xmpp.muc_role_changed",
+ MUC_DESTROYED: "xmpp.muc_destroyed",
+ DISPLAY_NAME_CHANGED: "xmpp.display_name_changed",
+ REMOTE_STATS: "xmpp.remote_stats",
+ LOCAL_ROLE_CHANGED: "xmpp.localrole_changed",
+ PRESENCE_STATUS: "xmpp.presence_status",
+ RESERVATION_ERROR: "xmpp.room_reservation_error",
+ SUBJECT_CHANGED: "xmpp.subject_changed",
+ MESSAGE_RECEIVED: "xmpp.message_received",
+ SENDING_CHAT_MESSAGE: "xmpp.sending_chat_message",
+ PASSWORD_REQUIRED: "xmpp.password_required",
+ AUTHENTICATION_REQUIRED: "xmpp.authentication_required",
+ CHAT_ERROR_RECEIVED: "xmpp.chat_error_received",
+ ETHERPAD: "xmpp.etherpad",
+ DEVICE_AVAILABLE: "xmpp.device_available",
+ START_MUTED: "xmpp.start_muted"
};
+module.exports = XMPPEvents;
+},{}],107:[function(require,module,exports){
+/* jshint -W117 */
+/* application specific logic */
-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;
+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");
+ this.translation = require("./modules/translation/translation");
+ this.settings = require("./modules/settings/Settings");
+ this.DTMF = require("./modules/DTMF/DTMF");
+ this.members = require("./modules/members/MemberList");
+ }
};
-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 init() {
-function isFunction(arg) {
- return typeof arg === 'function';
-}
+ APP.RTC.start();
+ APP.xmpp.start();
+ APP.statistics.start();
+ APP.connectionquality.init();
-function isNumber(arg) {
- return typeof arg === 'number';
-}
+ // Set default desktop sharing method
+ APP.desktopsharing.init();
-function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
+ APP.keyboardshortcut.init();
+ APP.members.start();
}
-function isUndefined(arg) {
- return arg === void 0;
-}
-},{}],107:[function(require,module,exports){
-// shim for using process in browser
+$(document).ready(function () {
-var process = module.exports = {};
-var queue = [];
-var draining = false;
+ var URLPRocessor = require("./modules/URLProcessor/URLProcessor");
+ URLPRocessor.setConfigParametersFromUrl();
+ APP.init();
-function drainQueue() {
- if (draining) {
- return;
- }
- draining = true;
- var currentQueue;
- var len = queue.length;
- while(len) {
- currentQueue = queue;
- queue = [];
- var i = -1;
- while (++i < len) {
- currentQueue[i]();
- }
- len = queue.length;
- }
- draining = false;
-}
-process.nextTick = function (fun) {
- queue.push(fun);
- if (!draining) {
- setTimeout(drainQueue, 0);
- }
-};
+ APP.translation.init();
-process.title = 'browser';
-process.browser = true;
-process.env = {};
-process.argv = [];
-process.version = ''; // empty string to avoid regexp issues
+ if(APP.API.isEnabled())
+ APP.API.init();
-function noop() {}
+ APP.UI.start(init);
-process.on = noop;
-process.addListener = noop;
-process.once = noop;
-process.off = noop;
-process.removeListener = noop;
-process.removeAllListeners = noop;
-process.emit = noop;
+});
-process.binding = function (name) {
- throw new Error('process.binding is not supported');
-};
+$(window).bind('beforeunload', function () {
+ if(APP.API.isEnabled())
+ APP.API.dispose();
+});
+
+module.exports = APP;
-// TODO(shtylman)
-process.cwd = function () { return '/' };
-process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
-};
-process.umask = function() { return 0; };
-},{}]},{},[1])(1)
+},{"./modules/API/API":1,"./modules/DTMF/DTMF":2,"./modules/RTC/RTC":6,"./modules/UI/UI":8,"./modules/URLProcessor/URLProcessor":35,"./modules/connectionquality/connectionquality":36,"./modules/desktopsharing/desktopsharing":37,"./modules/keyboardshortcut/keyboardshortcut":38,"./modules/members/MemberList":39,"./modules/settings/Settings":40,"./modules/simulcast/simulcast":45,"./modules/statistics/statistics":48,"./modules/translation/translation":49,"./modules/xmpp/xmpp":63}]},{},[107])(107)
});
\ No newline at end of file