Преглед на файлове

Switches the order of the parameters of desktopsharing.addListener to match the rest of the code. Renames variables.

master
Boris Grozev преди 10 години
родител
ревизия
dc2b63fc60
променени са 4 файла, в които са добавени 23 реда и са изтрити 23 реда
  1. 6
    5
      modules/RTC/RTC.js
  2. 5
    5
      modules/UI/UI.js
  3. 2
    3
      modules/desktopsharing/desktopsharing.js
  4. 10
    10
      modules/xmpp/JingleSessionPC.js

+ 6
- 5
modules/RTC/RTC.js Целия файл

@@ -151,9 +151,10 @@ var RTC = {
151 151
     start: function () {
152 152
         var self = this;
153 153
         APP.desktopsharing.addListener(
154
+            DesktopSharingEventTypes.NEW_STREAM_CREATED,
154 155
             function (stream, isUsingScreenStream, callback) {
155 156
                 self.changeLocalVideo(stream, isUsingScreenStream, callback);
156
-            }, DesktopSharingEventTypes.NEW_STREAM_CREATED);
157
+        });
157 158
         APP.xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {
158 159
             DataChannels.init(event.peerconnection, eventEmitter);
159 160
         });
@@ -195,13 +196,13 @@ var RTC = {
195 196
         }
196 197
         return false;
197 198
     },
198
-    switchVideoStreams: function (new_stream) {
199
-        this.localVideo.stream = new_stream;
199
+    switchVideoStreams: function (newStream) {
200
+        this.localVideo.stream = newStream;
200 201
 
201 202
         this.localStreams = [];
202 203
 
203 204
         //in firefox we have only one stream object
204
-        if (this.localAudio.getOriginalStream() != new_stream)
205
+        if (this.localAudio.getOriginalStream() != newStream)
205 206
             this.localStreams.push(this.localAudio);
206 207
         this.localStreams.push(this.localVideo);
207 208
     },
@@ -227,7 +228,7 @@ var RTC = {
227 228
         // Stop the stream to trigger onended event for old stream
228 229
         oldStream.stop();
229 230
 
230
-        this.switchVideoStreams(videoStream, oldStream);
231
+        this.switchVideoStreams(videoStream);
231 232
 
232 233
         APP.xmpp.switchStreams(videoStream, oldStream,localCallback);
233 234
     },

+ 5
- 5
modules/UI/UI.js Целия файл

@@ -193,12 +193,12 @@ function registerListeners() {
193 193
         AudioLevels.updateAudioLevel(resourceJid, audioLevel,
194 194
             UI.getLargeVideoResource());
195 195
     });
196
-    APP.desktopsharing.addListener(function () {
197
-        ToolbarToggler.showDesktopSharingButton();
198
-    }, DesktopSharingEventTypes.INIT);
199 196
     APP.desktopsharing.addListener(
200
-        Toolbar.changeDesktopSharingButtonState,
201
-        DesktopSharingEventTypes.SWITCHING_DONE);
197
+        DesktopSharingEventTypes.INIT,
198
+        ToolbarToggler.showToolbar);
199
+    APP.desktopsharing.addListener(
200
+        DesktopSharingEventTypes.SWITCHING_DONE,
201
+        Toolbar.changeDesktopSharingButtonState);
202 202
     APP.connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,
203 203
         VideoLayout.updateLocalConnectionStats);
204 204
     APP.connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,

+ 2
- 3
modules/desktopsharing/desktopsharing.js Целия файл

@@ -329,12 +329,11 @@ module.exports = {
329 329
         APP.RTC.addListener(RTCEvents.RTC_READY, onWebRtcReady);
330 330
     },
331 331
 
332
-    addListener: function (listener, type)
333
-    {
332
+    addListener: function (type, listener) {
334 333
         eventEmitter.on(type, listener);
335 334
     },
336 335
 
337
-    removeListener: function (listener, type) {
336
+    removeListener: function (type, listener) {
338 337
         eventEmitter.removeListener(type, listener);
339 338
     },
340 339
 

+ 10
- 10
modules/xmpp/JingleSessionPC.js Целия файл

@@ -1066,28 +1066,28 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
1066 1066
 
1067 1067
 /**
1068 1068
  * Switches video streams.
1069
- * @param new_stream new stream that will be used as video of this session.
1069
+ * @param newStream new stream that will be used as video of this session.
1070 1070
  * @param oldStream old video stream of this session.
1071
- * @param success_callback callback executed after successful stream switch.
1071
+ * @param successCallback callback executed after successful stream switch.
1072 1072
  */
1073
-JingleSessionPC.prototype.switchStreams = function (new_stream, oldStream, success_callback, isAudio) {
1073
+JingleSessionPC.prototype.switchStreams = function (newStream, oldStream, successCallback) {
1074 1074
 
1075 1075
     var self = this;
1076 1076
 
1077 1077
     // Remember SDP to figure out added/removed SSRCs
1078 1078
     var oldSdp = null;
1079
-    if(self.peerconnection) {
1080
-        if(self.peerconnection.localDescription) {
1079
+    if (self.peerconnection) {
1080
+        if (self.peerconnection.localDescription) {
1081 1081
             oldSdp = new SDP(self.peerconnection.localDescription.sdp);
1082 1082
         }
1083 1083
         self.peerconnection.removeStream(oldStream, true);
1084
-        if(new_stream)
1085
-            self.peerconnection.addStream(new_stream);
1084
+        if (newStream)
1085
+            self.peerconnection.addStream(newStream);
1086 1086
     }
1087 1087
 
1088 1088
     // Conference is not active
1089
-    if(!oldSdp || !self.peerconnection) {
1090
-        success_callback();
1089
+    if (!oldSdp) {
1090
+        successCallback();
1091 1091
         return;
1092 1092
     }
1093 1093
 
@@ -1095,7 +1095,7 @@ JingleSessionPC.prototype.switchStreams = function (new_stream, oldStream, succe
1095 1095
     self.modifySourcesQueue.push(function() {
1096 1096
         console.log('modify sources done');
1097 1097
 
1098
-        success_callback();
1098
+        successCallback();
1099 1099
 
1100 1100
         var newSdp = new SDP(self.peerconnection.localDescription.sdp);
1101 1101
         console.log("SDPs", oldSdp, newSdp);

Loading…
Отказ
Запис