Removes some dependancies from functions in app.js.
This commit is contained in:
parent
1057ff36cd
commit
27502d3fa8
61
app.js
61
app.js
|
@ -44,18 +44,6 @@ var flipXLocalVideo = true;
|
||||||
var isFullScreen = false;
|
var isFullScreen = false;
|
||||||
var currentVideoWidth = null;
|
var currentVideoWidth = null;
|
||||||
var currentVideoHeight = 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;
|
var sessionTerminated = false;
|
||||||
|
|
||||||
|
@ -624,10 +612,6 @@ function isVideoSrcDesktop(jid) {
|
||||||
return isDesktop;
|
return isDesktop;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConferenceHandler() {
|
|
||||||
return activecall;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mutes/unmutes the local video.
|
* Mutes/unmutes the local video.
|
||||||
*
|
*
|
||||||
|
@ -639,7 +623,7 @@ function getConferenceHandler() {
|
||||||
*/
|
*/
|
||||||
function setVideoMute(mute, options) {
|
function setVideoMute(mute, options) {
|
||||||
if (connection && connection.jingle.localVideo) {
|
if (connection && connection.jingle.localVideo) {
|
||||||
var session = getConferenceHandler();
|
var session = activecall;
|
||||||
|
|
||||||
if (session) {
|
if (session) {
|
||||||
session.setVideoMute(
|
session.setVideoMute(
|
||||||
|
@ -677,7 +661,7 @@ function toggleVideo() {
|
||||||
buttonClick("#video", "icon-camera icon-camera-disabled");
|
buttonClick("#video", "icon-camera icon-camera-disabled");
|
||||||
|
|
||||||
if (connection && connection.jingle.localVideo) {
|
if (connection && connection.jingle.localVideo) {
|
||||||
var session = getConferenceHandler();
|
var session = activecall;
|
||||||
|
|
||||||
if (session) {
|
if (session) {
|
||||||
setVideoMute(!session.isVideoMute());
|
setVideoMute(!session.isVideoMute());
|
||||||
|
@ -793,7 +777,7 @@ $(window).bind('beforeunload', function () {
|
||||||
|
|
||||||
function disposeConference(onUnload) {
|
function disposeConference(onUnload) {
|
||||||
UI.onDisposeConference(onUnload);
|
UI.onDisposeConference(onUnload);
|
||||||
var handler = getConferenceHandler();
|
var handler = activecall;
|
||||||
if (handler && handler.peerconnection) {
|
if (handler && handler.peerconnection) {
|
||||||
// FIXME: probably removing streams is not required and close() should
|
// FIXME: probably removing streams is not required and close() should
|
||||||
// be enough
|
// be enough
|
||||||
|
@ -809,45 +793,6 @@ function disposeConference(onUnload) {
|
||||||
activecall = null;
|
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.
|
* Changes the style class of the element given by id.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -260,10 +260,9 @@ function newStreamCreated(stream) {
|
||||||
|
|
||||||
UI.changeLocalVideo(stream, !isUsingScreenStream);
|
UI.changeLocalVideo(stream, !isUsingScreenStream);
|
||||||
|
|
||||||
var conferenceHandler = getConferenceHandler();
|
if (activecall) {
|
||||||
if (conferenceHandler) {
|
|
||||||
// FIXME: will block switchInProgress on true value in case of exception
|
// FIXME: will block switchInProgress on true value in case of exception
|
||||||
conferenceHandler.switchStreams(stream, oldStream, streamSwitchDone);
|
activecall.switchStreams(stream, oldStream, streamSwitchDone);
|
||||||
} else {
|
} else {
|
||||||
// We are done immediately
|
// We are done immediately
|
||||||
console.error("No conference handler");
|
console.error("No conference handler");
|
||||||
|
|
|
@ -321,5 +321,24 @@ Strophe.addConnectionPlugin('jingle', {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// implement push?
|
// 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;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -551,16 +551,36 @@ UI.generateRoomName = function() {
|
||||||
UI.connectionIndicatorShowMore = function(id)
|
UI.connectionIndicatorShowMore = function(id)
|
||||||
{
|
{
|
||||||
return VideoLayout.connectionIndicators[id].showMore();
|
return VideoLayout.connectionIndicators[id].showMore();
|
||||||
}
|
};
|
||||||
|
|
||||||
UI.showToolbar = function () {
|
UI.showToolbar = function () {
|
||||||
return ToolbarToggler.showToolbar();
|
return ToolbarToggler.showToolbar();
|
||||||
}
|
};
|
||||||
|
|
||||||
UI.dockToolbar = function (isDock) {
|
UI.dockToolbar = function (isDock) {
|
||||||
return ToolbarToggler.dockToolbar(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;
|
module.exports = UI;
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@ var PanelToggler = (function(my) {
|
||||||
var videospaceWidth = window.innerWidth - panelSize[0];
|
var videospaceWidth = window.innerWidth - panelSize[0];
|
||||||
var videospaceHeight = window.innerHeight;
|
var videospaceHeight = window.innerHeight;
|
||||||
var videoSize
|
var videoSize
|
||||||
= getVideoSize(null, null, videospaceWidth, videospaceHeight);
|
= VideoLayout.getVideoSize(null, null, videospaceWidth, videospaceHeight);
|
||||||
var videoWidth = videoSize[0];
|
var videoWidth = videoSize[0];
|
||||||
var videoHeight = videoSize[1];
|
var videoHeight = videoSize[1];
|
||||||
var videoPosition = getVideoPosition(videoWidth,
|
var videoPosition = VideoLayout.getVideoPosition(videoWidth,
|
||||||
videoHeight,
|
videoHeight,
|
||||||
videospaceWidth,
|
videospaceWidth,
|
||||||
videospaceHeight);
|
videospaceHeight);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* global $, Util, connection, nickname:true, getVideoSize,
|
/* global $, Util, connection, nickname:true, showToolbar */
|
||||||
getVideoPosition, showToolbar */
|
|
||||||
var Replacement = require("./Replacement");
|
var Replacement = require("./Replacement");
|
||||||
var CommandsProcessor = require("./Commands");
|
var CommandsProcessor = require("./Commands");
|
||||||
var ToolbarToggler = require("../../toolbars/ToolbarToggler");
|
var ToolbarToggler = require("../../toolbars/ToolbarToggler");
|
||||||
|
|
|
@ -16,10 +16,6 @@ var largeVideoState = {
|
||||||
newSrc: ''
|
newSrc: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
// By default we use camera
|
|
||||||
var getVideoSize = getCameraVideoSize;
|
|
||||||
var getVideoPosition = getCameraVideoPosition;
|
|
||||||
|
|
||||||
var defaultLocalDisplayName = "Me";
|
var defaultLocalDisplayName = "Me";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -407,6 +403,10 @@ function createModeratorIndicatorElement(parentElement) {
|
||||||
var VideoLayout = (function (my) {
|
var VideoLayout = (function (my) {
|
||||||
my.connectionIndicators = {};
|
my.connectionIndicators = {};
|
||||||
|
|
||||||
|
// By default we use camera
|
||||||
|
my.getVideoSize = getCameraVideoSize;
|
||||||
|
my.getVideoPosition = getCameraVideoPosition;
|
||||||
|
|
||||||
my.isInLastN = function(resource) {
|
my.isInLastN = function(resource) {
|
||||||
return lastNCount < 0 // lastN is disabled, return true
|
return lastNCount < 0 // lastN is disabled, return true
|
||||||
|| (lastNCount > 0 && lastNEndpointsCache.length == 0) // lastNEndpoints cache not built yet, 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
|
// Change the way we'll be measuring and positioning large video
|
||||||
|
|
||||||
getVideoSize = largeVideoState.isDesktop
|
VideoLayout.getVideoSize = largeVideoState.isDesktop
|
||||||
? getDesktopVideoSize
|
? getDesktopVideoSize
|
||||||
: getCameraVideoSize;
|
: getCameraVideoSize;
|
||||||
getVideoPosition = largeVideoState.isDesktop
|
VideoLayout.getVideoPosition = largeVideoState.isDesktop
|
||||||
? getDesktopVideoPosition
|
? getDesktopVideoPosition
|
||||||
: getCameraVideoPosition;
|
: getCameraVideoPosition;
|
||||||
|
|
||||||
|
@ -829,7 +829,7 @@ var VideoLayout = (function (my) {
|
||||||
var videoSpaceWidth = $('#videospace').width();
|
var videoSpaceWidth = $('#videospace').width();
|
||||||
var videoSpaceHeight = window.innerHeight;
|
var videoSpaceHeight = window.innerHeight;
|
||||||
|
|
||||||
var videoSize = getVideoSize(videoWidth,
|
var videoSize = VideoLayout.getVideoSize(videoWidth,
|
||||||
videoHeight,
|
videoHeight,
|
||||||
videoSpaceWidth,
|
videoSpaceWidth,
|
||||||
videoSpaceHeight);
|
videoSpaceHeight);
|
||||||
|
@ -837,7 +837,7 @@ var VideoLayout = (function (my) {
|
||||||
var largeVideoWidth = videoSize[0];
|
var largeVideoWidth = videoSize[0];
|
||||||
var largeVideoHeight = videoSize[1];
|
var largeVideoHeight = videoSize[1];
|
||||||
|
|
||||||
var videoPosition = getVideoPosition(largeVideoWidth,
|
var videoPosition = VideoLayout.getVideoPosition(largeVideoWidth,
|
||||||
largeVideoHeight,
|
largeVideoHeight,
|
||||||
videoSpaceWidth,
|
videoSpaceWidth,
|
||||||
videoSpaceHeight);
|
videoSpaceHeight);
|
||||||
|
|
Loading…
Reference in New Issue