Browse Source

Fixes the size of the desktop streaming video for remote peer.

j8
hristoterezov 10 years ago
parent
commit
0da2547360

+ 1
- 1
index.html View File

@@ -19,7 +19,7 @@
19 19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20 20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21 21
     <script src="interface_config.js?v=5"></script>
22
-    <script src="libs/app.bundle.js?v=38"></script>
22
+    <script src="libs/app.bundle.js?v=39"></script>
23 23
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
24 24
     <link rel="stylesheet" href="css/font.css?v=6"/>
25 25
     <link rel="stylesheet" href="css/toastr.css?v=1">

+ 25989
- 25962
libs/app.bundle.js
File diff suppressed because it is too large
View File


+ 1
- 1
modules/RTC/DataChannels.js View File

@@ -1,4 +1,4 @@
1
-/* global Strophe, updateLargeVideo, focusedVideoSrc*/
1
+/* global Strophe, focusedVideoSrc*/
2 2
 
3 3
 // cache datachannels to avoid garbage collection
4 4
 // https://code.google.com/p/chromium/issues/detail?id=405545

+ 13
- 4
modules/RTC/MediaStream.js View File

@@ -1,6 +1,6 @@
1 1
 ////These lines should be uncommented when require works in app.js
2
-var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
3 2
 var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
3
+var StreamEventType = require("../../service/RTC/StreamEventTypes");
4 4
 
5 5
 /**
6 6
  * Creates a MediaStream object for the given data, session id and ssrc.
@@ -13,7 +13,7 @@ var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
13 13
  *
14 14
  * @constructor
15 15
  */
16
-function MediaStream(data, sid, ssrc, browser) {
16
+function MediaStream(data, sid, ssrc, browser, eventEmitter) {
17 17
 
18 18
     // XXX(gp) to minimize headaches in the future, we should build our
19 19
     // abstractions around tracks and not streams. ORTC is track based API.
@@ -33,19 +33,28 @@ function MediaStream(data, sid, ssrc, browser) {
33 33
         MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
34 34
     this.videoType = null;
35 35
     this.muted = false;
36
+    this.eventEmitter = eventEmitter;
36 37
 }
37 38
 
38 39
 
39 40
 MediaStream.prototype.getOriginalStream = function()
40 41
 {
41 42
     return this.stream;
42
-}
43
+};
43 44
 
44 45
 MediaStream.prototype.setMute = function (value)
45 46
 {
46 47
     this.stream.muted = value;
47 48
     this.muted = value;
48
-}
49
+};
50
+
51
+MediaStream.prototype.setVideoType = function (value) {
52
+    if(this.videoType === value)
53
+        return;
54
+    this.videoType = value;
55
+    this.eventEmitter.emit(StreamEventType.EVENT_TYPE_REMOTE_CHANGED,
56
+        this.peerjid);
57
+};
49 58
 
50 59
 
51 60
 module.exports = MediaStream;

+ 3
- 5
modules/RTC/RTC.js View File

@@ -63,14 +63,13 @@ var RTC = {
63 63
     },
64 64
     createRemoteStream: function (data, sid, thessrc) {
65 65
         var remoteStream = new MediaStream(data, sid, thessrc,
66
-            this.getBrowserType());
66
+            this.getBrowserType(), eventEmitter);
67 67
         var jid = data.peerjid || APP.xmpp.myJid();
68 68
         if(!this.remoteStreams[jid]) {
69 69
             this.remoteStreams[jid] = {};
70 70
         }
71 71
         this.remoteStreams[jid][remoteStream.type]= remoteStream;
72 72
         eventEmitter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_CREATED, remoteStream);
73
-        console.debug("ADD remote stream ", remoteStream.type, " ", jid, " ", thessrc);
74 73
         return remoteStream;
75 74
     },
76 75
     getBrowserType: function () {
@@ -122,7 +121,7 @@ var RTC = {
122 121
                     var videoStream = peerStreams[MediaStreamType.VIDEO_TYPE];
123 122
                     if(!videoStream)
124 123
                         continue;
125
-                    videoStream.videoType = changedStreams[i].type;
124
+                    videoStream.setVideoType(changedStreams[i].type);
126 125
                 }
127 126
             }
128 127
         });
@@ -183,8 +182,7 @@ var RTC = {
183 182
             return false;
184 183
         var isDesktop = false;
185 184
         var stream = null;
186
-        if (APP.xmpp.myJid() &&
187
-            APP.xmpp.myResource() === jid) {
185
+        if (APP.xmpp.myJid() === jid) {
188 186
             // local video
189 187
             stream = this.localVideo;
190 188
         } else {

+ 3
- 0
modules/UI/UI.js View File

@@ -85,6 +85,9 @@ function registerListeners() {
85 85
     APP.RTC.addStreamListener(function (stream) {
86 86
         VideoLayout.onRemoteStreamAdded(stream);
87 87
     }, StreamEventTypes.EVENT_TYPE_REMOTE_CREATED);
88
+    APP.RTC.addStreamListener(function (jid) {
89
+        VideoLayout.onVideoTypeChanged(jid);
90
+    }, StreamEventTypes.EVENT_TYPE_REMOTE_CHANGED);
88 91
     APP.RTC.addListener(RTCEvents.LASTN_CHANGED, onLastNChanged);
89 92
     APP.RTC.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (resourceJid) {
90 93
         VideoLayout.onDominantSpeakerChanged(resourceJid);

+ 18
- 1
modules/UI/videolayout/VideoLayout.js View File

@@ -748,7 +748,9 @@ var VideoLayout = (function (my) {
748 748
 
749 749
             largeVideoState.newSrc = newSrc;
750 750
             largeVideoState.isVisible = $('#largeVideo').is(':visible');
751
-            largeVideoState.isDesktop = APP.RTC.isVideoSrcDesktop(resourceJid);
751
+            largeVideoState.isDesktop = APP.RTC.isVideoSrcDesktop(
752
+                APP.xmpp.findJidFromResource(resourceJid));
753
+
752 754
             if(largeVideoState.userResourceJid) {
753 755
                 largeVideoState.oldResourceJid = largeVideoState.userResourceJid;
754 756
             } else {
@@ -2231,6 +2233,21 @@ var VideoLayout = (function (my) {
2231 2233
             focusedVideoInfo = null;
2232 2234
         }
2233 2235
     }
2236
+    
2237
+    my.onVideoTypeChanged = function (jid) {
2238
+        if(jid &&
2239
+            Strophe.getResourceFromJid(jid) === largeVideoState.userResourceJid)
2240
+        {
2241
+            largeVideoState.isDesktop = APP.RTC.isVideoSrcDesktop(jid);
2242
+            VideoLayout.getVideoSize = largeVideoState.isDesktop
2243
+                ? getDesktopVideoSize
2244
+                : getCameraVideoSize;
2245
+            VideoLayout.getVideoPosition = largeVideoState.isDesktop
2246
+                ? getDesktopVideoPosition
2247
+                : getCameraVideoPosition;
2248
+            VideoLayout.positionLarge(null, null);
2249
+        }
2250
+    }
2234 2251
 
2235 2252
     return my;
2236 2253
 }(VideoLayout || {}));

+ 0
- 2
modules/statistics/RTPStatsCollector.js View File

@@ -234,7 +234,6 @@ StatsCollector.prototype.start = function ()
234 234
 {
235 235
     var self = this;
236 236
     if(!config.disableAudioLevels) {
237
-        console.debug("set audio levels interval");
238 237
         this.audioLevelsIntervalId = setInterval(
239 238
             function () {
240 239
                 // Interval updates
@@ -262,7 +261,6 @@ StatsCollector.prototype.start = function ()
262 261
     }
263 262
 
264 263
     if(!config.disableStats) {
265
-        console.debug("set stats interval");
266 264
         this.statsIntervalId = setInterval(
267 265
             function () {
268 266
                 // Interval updates

+ 3
- 1
service/RTC/StreamEventTypes.js View File

@@ -7,7 +7,9 @@ var StreamEventTypes = {
7 7
 
8 8
     EVENT_TYPE_REMOTE_CREATED: "stream.remote_created",
9 9
 
10
-    EVENT_TYPE_REMOTE_ENDED: "stream.remote_ended"
10
+    EVENT_TYPE_REMOTE_ENDED: "stream.remote_ended",
11
+
12
+    EVENT_TYPE_REMOTE_CHANGED: "stream.changed"
11 13
 };
12 14
 
13 15
 module.exports = StreamEventTypes;

Loading…
Cancel
Save