Commit 91ed217d authored by Luc Renambot's avatar Luc Renambot

Pass to jshint


Former-commit-id: d4c605fe65d73fd80c4137a4eb8a43477d784c01
parent 500f73f2
......@@ -29,7 +29,7 @@ function appLoader(publicDir, hostOrigin, displayWidth, displayHeight, titleBarH
this.hostOrigin = hostOrigin;
this.displayWidth = displayWidth;
this.displayHeight = displayHeight;
this.titleBarHeight = titleBarHeight
this.titleBarHeight = titleBarHeight;
this.mime2app = {
"image/jpeg": "image_viewer",
"image/png": "image_viewer",
......@@ -68,7 +68,7 @@ appLoader.prototype.scaleAppToFitDisplay = function(appInstance) {
appInstance.width = iWidth;
appInstance.height = iHeight;
}
};
appLoader.prototype.loadImageFromURL = function(url, mime_type, name, strictSSL, callback) {
var _this = this;
......@@ -485,7 +485,7 @@ appLoader.prototype.loadApplicationFromRemoteServer = function(application, call
callback(appInstance);
}
});
}
};
appLoader.prototype.loadFileFromWebURL = function(file, callback) {
var mime_type = file.type;
......@@ -530,8 +530,10 @@ appLoader.prototype.manageAndLoadUploadedFile = function(file, callback) {
};
appLoader.prototype.loadApplication = function(appData, callback) {
var app = null;
if(appData.location === "file") {
var app = this.mime2app[appData.type];
app = this.mime2app[appData.type];
var dir = this.app2dir[app];
if(app === "image_viewer"){
......@@ -567,7 +569,7 @@ appLoader.prototype.loadApplication = function(appData, callback) {
}
else if(appData.location === "url") {
var app = this.mime2app[appData.type];
app = this.mime2app[appData.type];
if(app === "image_viewer"){
this.loadImageFromURL(appData.url, appData.type, appData.name, appData.strictSSL, function(appInstance) {
......
......@@ -555,27 +555,30 @@ function wsStopMediaStream(wsio, data) {
function wsReceivedMediaStreamFrame(wsio, data) {
var uniqueID = wsio.remoteAddress.address + ":" + wsio.remoteAddress.port;
var i;
var broadcastAddress, broadcastID;
var serverAddress, clientAddress;
mediaStreams[data.id].clients[uniqueID] = true;
if(allTrueDict(mediaStreams[data.id].clients) && mediaStreams[data.id].ready){
mediaStreams[data.id].ready = false;
var broadcastWS = null;
var mediaStreamData = data.id.split("|");
if(mediaStreamData.length === 2){ // local stream --> client | stream_id
var broadcastAddress = mediaStreamData[0];
var broadcastID = parseInt(mediaStreamData[1]);
for(var i=0; i<clients.length; i++){
var clientAddress = clients[i].remoteAddress.address + ":" + clients[i].remoteAddress.port;
broadcastAddress = mediaStreamData[0];
broadcastID = parseInt(mediaStreamData[1]);
for(i=0; i<clients.length; i++){
clientAddress = clients[i].remoteAddress.address + ":" + clients[i].remoteAddress.port;
if(clientAddress == broadcastAddress) broadcastWS = clients[i];
}
if(broadcastWS !== null) broadcastWS.emit('requestNextFrame', {streamId: broadcastID});
}
else if(mediaStreamData.length === 3){ // remote stream --> remote_server | client | stream_id
var serverAddress = mediaStreamData[0];
var broadcastAddress = mediaStreamData[1];
var broadcastID = mediaStreamData[2];
serverAddress = mediaStreamData[0];
broadcastAddress = mediaStreamData[1];
broadcastID = mediaStreamData[2];
for(i=0; i<clients.length; i++){
var clientAddress = clients[i].remoteAddress.address + ":" + clients[i].remoteAddress.port;
clientAddress = clients[i].remoteAddress.address + ":" + clients[i].remoteAddress.port;
if(clientAddress == serverAddress) { broadcastWS = clients[i]; break; }
}
......@@ -673,14 +676,16 @@ function wsUpdateVideoTime(wsio, data) {
/******************** Remote Server Content ****************************/
function wsAddNewElementFromRemoteServer(wsio, data) {
console.log("add element from remote server");
var clientAddress, i;
appLoader.loadApplicationFromRemoteServer(data, function(appInstance) {
console.log("Remote App: " + appInstance.application);
if(appInstance.application === "media_stream"){
appInstance.id = wsio.remoteAddress.address + ":" + wsio.remoteAddress.port + "|" + appInstance.id;
mediaStreams[appInstance.id] = {ready: true, chunks: [], clients: {}};
for(var i=0; i<clients.length; i++){
for(i=0; i<clients.length; i++){
if(clients[i].messages.receivesMediaStreamFrames){
var clientAddress = clients[i].remoteAddress.address + ":" + clients[i].remoteAddress.port;
clientAddress = clients[i].remoteAddress.address + ":" + clients[i].remoteAddress.port;
mediaStreams[appInstance.id].clients[clientAddress] = false;
}
}
......@@ -695,11 +700,10 @@ function wsAddNewElementFromRemoteServer(wsio, data) {
applications.push(appInstance);
if(appInstance.animation){
var i;
appAnimations[appInstance.id] = {clients: {}, date: new Date()};
for(i=0; i<clients.length; i++){
if(clients[i].messages.requiresFullApps){
var clientAddress = clients[i].remoteAddress.address + ":" + clients[i].remoteAddress.port;
clientAddress = clients[i].remoteAddress.address + ":" + clients[i].remoteAddress.port;
appAnimations[appInstance.id].clients[clientAddress] = false;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment