Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Removes some dependancies from functions in app.js.
hristoterezov27502d3fa8b0
diff --git a/app.js b/app.jsindex be2c0da49a..f9f0428b23 100644--- a/app.js+++ b/app.js@@ -44,18 +44,6 @@ var flipXLocalVideo = true;var isFullScreen = false;var currentVideoWidth = null;var currentVideoHeight = null;-/**- * Method used to calculate large video size.- * @type {function ()}- */-var getVideoSize;-/**- * Method used to get large video position.- * @type {function ()}- */-var getVideoPosition;--/* window.onbeforeunload = closePageWarning; */var sessionTerminated = false;@@ -624,10 +612,6 @@ function isVideoSrcDesktop(jid) {return isDesktop;}-function getConferenceHandler() {- return activecall;-}-/*** Mutes/unmutes the local video.*@@ -639,7 +623,7 @@ function getConferenceHandler() {*/function setVideoMute(mute, options) {if (connection && connection.jingle.localVideo) {- var session = getConferenceHandler();+ var session = activecall;if (session) {session.setVideoMute(@@ -677,7 +661,7 @@ function toggleVideo() {buttonClick("#video", "icon-camera icon-camera-disabled");if (connection && connection.jingle.localVideo) {- var session = getConferenceHandler();+ var session = activecall;if (session) {setVideoMute(!session.isVideoMute());@@ -793,7 +777,7 @@ $(window).bind('beforeunload', function () {function disposeConference(onUnload) {UI.onDisposeConference(onUnload);- var handler = getConferenceHandler();+ var handler = activecall;if (handler && handler.peerconnection) {// FIXME: probably removing streams is not required and close() should// be enough@@ -809,45 +793,6 @@ function disposeConference(onUnload) {activecall = null;}-function dump(elem, filename) {- elem = elem.parentNode;- elem.download = filename || 'meetlog.json';- elem.href = 'data:application/json;charset=utf-8,\n';- var data = populateData();- elem.href += encodeURIComponent(JSON.stringify(data, null, ' '));- return false;-}---/**- * Populates the log data- */-function populateData() {- var data = {};- if (connection.jingle) {- Object.keys(connection.jingle.sessions).forEach(function (sid) {- var session = connection.jingle.sessions[sid];- if (session.peerconnection && session.peerconnection.updateLog) {- // FIXME: should probably be a .dump call- data["jingle_" + session.sid] = {- updateLog: session.peerconnection.updateLog,- stats: session.peerconnection.stats,- url: window.location.href- };- }- });- }- var metadata = {};- metadata.time = new Date();- metadata.url = window.location.href;- metadata.ua = navigator.userAgent;- if (connection.logger) {- metadata.xmpp = connection.logger.log;- }- data.metadata = metadata;- return data;-}-/*** Changes the style class of the element given by id.*/diff --git a/desktopsharing.js b/desktopsharing.jsindex 4b162614c4..e07e1fbc9e 100644--- a/desktopsharing.js+++ b/desktopsharing.js@@ -260,10 +260,9 @@ function newStreamCreated(stream) {UI.changeLocalVideo(stream, !isUsingScreenStream);- var conferenceHandler = getConferenceHandler();- if (conferenceHandler) {+ if (activecall) {// FIXME: will block switchInProgress on true value in case of exception- conferenceHandler.switchStreams(stream, oldStream, streamSwitchDone);+ activecall.switchStreams(stream, oldStream, streamSwitchDone);} else {// We are done immediatelyconsole.error("No conference handler");diff --git a/libs/strophe/strophe.jingle.js b/libs/strophe/strophe.jingle.jsindex 14d1a2b524..652358b51d 100644--- a/libs/strophe/strophe.jingle.js+++ b/libs/strophe/strophe.jingle.js@@ -321,5 +321,24 @@ Strophe.addConnectionPlugin('jingle', {});// implement push?+ },++ /**+ * Populates the log data+ */+ populateData: function () {+ var data = {};+ Object.keys(this.sessions).forEach(function (sid) {+ var session = this.sessions[sid];+ if (session.peerconnection && session.peerconnection.updateLog) {+ // FIXME: should probably be a .dump call+ data["jingle_" + session.sid] = {+ updateLog: session.peerconnection.updateLog,+ stats: session.peerconnection.stats,+ url: window.location.href+ };+ }+ });+ return data;}});diff --git a/modules/UI/UI.js b/modules/UI/UI.jsindex 05c3f81bd8..41aeffa4ae 100644--- a/modules/UI/UI.js+++ b/modules/UI/UI.js@@ -551,16 +551,36 @@ UI.generateRoomName = function() {UI.connectionIndicatorShowMore = function(id){return VideoLayout.connectionIndicators[id].showMore();-}+};UI.showToolbar = function () {return ToolbarToggler.showToolbar();-}+};UI.dockToolbar = function (isDock) {return ToolbarToggler.dockToolbar(isDock);-}+};++function dump(elem, filename) {+ elem = elem.parentNode;+ elem.download = filename || 'meetlog.json';+ elem.href = 'data:application/json;charset=utf-8,\n';+ var data = {};+ if (connection.jingle) {+ data = connection.jingle.populateData();+ }+ var metadata = {};+ metadata.time = new Date();+ metadata.url = window.location.href;+ metadata.ua = navigator.userAgent;+ if (connection.logger) {+ metadata.xmpp = connection.logger.log;+ }+ data.metadata = metadata;+ elem.href += encodeURIComponent(JSON.stringify(data, null, ' '));+ return false;+}module.exports = UI;diff --git a/modules/UI/side_pannels/SidePanelToggler.js b/modules/UI/side_pannels/SidePanelToggler.jsindex 6eb74f3334..44bbf042d9 100644--- a/modules/UI/side_pannels/SidePanelToggler.js+++ b/modules/UI/side_pannels/SidePanelToggler.js@@ -29,10 +29,10 @@ var PanelToggler = (function(my) {var videospaceWidth = window.innerWidth - panelSize[0];var videospaceHeight = window.innerHeight;var videoSize- = getVideoSize(null, null, videospaceWidth, videospaceHeight);+ = VideoLayout.getVideoSize(null, null, videospaceWidth, videospaceHeight);var videoWidth = videoSize[0];var videoHeight = videoSize[1];- var videoPosition = getVideoPosition(videoWidth,+ var videoPosition = VideoLayout.getVideoPosition(videoWidth,videoHeight,videospaceWidth,videospaceHeight);diff --git a/modules/UI/side_pannels/chat/Chat.js b/modules/UI/side_pannels/chat/Chat.jsindex 447c3a2b72..09683fea0d 100644--- a/modules/UI/side_pannels/chat/Chat.js+++ b/modules/UI/side_pannels/chat/Chat.js@@ -1,5 +1,4 @@-/* global $, Util, connection, nickname:true, getVideoSize,-getVideoPosition, showToolbar */+/* global $, Util, connection, nickname:true, showToolbar */var Replacement = require("./Replacement");var CommandsProcessor = require("./Commands");var ToolbarToggler = require("../../toolbars/ToolbarToggler");diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.jsindex 99455b2714..9fdcc67229 100644--- a/modules/UI/videolayout/VideoLayout.js+++ b/modules/UI/videolayout/VideoLayout.js@@ -16,10 +16,6 @@ var largeVideoState = {newSrc: ''};-// By default we use camera-var getVideoSize = getCameraVideoSize;-var getVideoPosition = getCameraVideoPosition;-var defaultLocalDisplayName = "Me";/**@@ -407,6 +403,10 @@ function createModeratorIndicatorElement(parentElement) {var VideoLayout = (function (my) {my.connectionIndicators = {};+ // By default we use camera+ my.getVideoSize = getCameraVideoSize;+ my.getVideoPosition = getCameraVideoPosition;+my.isInLastN = function(resource) {return lastNCount < 0 // lastN is disabled, return true|| (lastNCount > 0 && lastNEndpointsCache.length == 0) // lastNEndpoints cache not built yet, return true@@ -692,10 +692,10 @@ var VideoLayout = (function (my) {// Change the way we'll be measuring and positioning large video- getVideoSize = largeVideoState.isDesktop+ VideoLayout.getVideoSize = largeVideoState.isDesktop? getDesktopVideoSize: getCameraVideoSize;- getVideoPosition = largeVideoState.isDesktop+ VideoLayout.getVideoPosition = largeVideoState.isDesktop? getDesktopVideoPosition: getCameraVideoPosition;@@ -829,7 +829,7 @@ var VideoLayout = (function (my) {var videoSpaceWidth = $('#videospace').width();var videoSpaceHeight = window.innerHeight;- var videoSize = getVideoSize(videoWidth,+ var videoSize = VideoLayout.getVideoSize(videoWidth,videoHeight,videoSpaceWidth,videoSpaceHeight);@@ -837,7 +837,7 @@ var VideoLayout = (function (my) {var largeVideoWidth = videoSize[0];var largeVideoHeight = videoSize[1];- var videoPosition = getVideoPosition(largeVideoWidth,+ var videoPosition = VideoLayout.getVideoPosition(largeVideoWidth,largeVideoHeight,videoSpaceWidth,videoSpaceHeight);