Sfoglia il codice sorgente

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

master
Boris Grozev 10 anni fa
parent
commit
dc2b63fc60

+ 6
- 5
modules/RTC/RTC.js Vedi File

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

+ 5
- 5
modules/UI/UI.js Vedi File

193
         AudioLevels.updateAudioLevel(resourceJid, audioLevel,
193
         AudioLevels.updateAudioLevel(resourceJid, audioLevel,
194
             UI.getLargeVideoResource());
194
             UI.getLargeVideoResource());
195
     });
195
     });
196
-    APP.desktopsharing.addListener(function () {
197
-        ToolbarToggler.showDesktopSharingButton();
198
-    }, DesktopSharingEventTypes.INIT);
199
     APP.desktopsharing.addListener(
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
     APP.connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,
202
     APP.connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,
203
         VideoLayout.updateLocalConnectionStats);
203
         VideoLayout.updateLocalConnectionStats);
204
     APP.connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,
204
     APP.connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,

+ 2
- 3
modules/desktopsharing/desktopsharing.js Vedi File

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

+ 10
- 10
modules/xmpp/JingleSessionPC.js Vedi File

1066
 
1066
 
1067
 /**
1067
 /**
1068
  * Switches video streams.
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
  * @param oldStream old video stream of this session.
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
     var self = this;
1075
     var self = this;
1076
 
1076
 
1077
     // Remember SDP to figure out added/removed SSRCs
1077
     // Remember SDP to figure out added/removed SSRCs
1078
     var oldSdp = null;
1078
     var oldSdp = null;
1079
-    if(self.peerconnection) {
1080
-        if(self.peerconnection.localDescription) {
1079
+    if (self.peerconnection) {
1080
+        if (self.peerconnection.localDescription) {
1081
             oldSdp = new SDP(self.peerconnection.localDescription.sdp);
1081
             oldSdp = new SDP(self.peerconnection.localDescription.sdp);
1082
         }
1082
         }
1083
         self.peerconnection.removeStream(oldStream, true);
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
     // Conference is not active
1088
     // Conference is not active
1089
-    if(!oldSdp || !self.peerconnection) {
1090
-        success_callback();
1089
+    if (!oldSdp) {
1090
+        successCallback();
1091
         return;
1091
         return;
1092
     }
1092
     }
1093
 
1093
 
1095
     self.modifySourcesQueue.push(function() {
1095
     self.modifySourcesQueue.push(function() {
1096
         console.log('modify sources done');
1096
         console.log('modify sources done');
1097
 
1097
 
1098
-        success_callback();
1098
+        successCallback();
1099
 
1099
 
1100
         var newSdp = new SDP(self.peerconnection.localDescription.sdp);
1100
         var newSdp = new SDP(self.peerconnection.localDescription.sdp);
1101
         console.log("SDPs", oldSdp, newSdp);
1101
         console.log("SDPs", oldSdp, newSdp);

Loading…
Annulla
Salva