浏览代码

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

j8
hristoterezov 10 年前
父节点
当前提交
0da2547360

+ 1
- 1
index.html 查看文件

19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21
     <script src="interface_config.js?v=5"></script>
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
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
23
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
24
     <link rel="stylesheet" href="css/font.css?v=6"/>
24
     <link rel="stylesheet" href="css/font.css?v=6"/>
25
     <link rel="stylesheet" href="css/toastr.css?v=1">
25
     <link rel="stylesheet" href="css/toastr.css?v=1">

+ 25989
- 25962
libs/app.bundle.js
文件差异内容过多而无法显示
查看文件


+ 1
- 1
modules/RTC/DataChannels.js 查看文件

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

+ 13
- 4
modules/RTC/MediaStream.js 查看文件

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

+ 3
- 5
modules/RTC/RTC.js 查看文件

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

+ 3
- 0
modules/UI/UI.js 查看文件

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

+ 18
- 1
modules/UI/videolayout/VideoLayout.js 查看文件

748
 
748
 
749
             largeVideoState.newSrc = newSrc;
749
             largeVideoState.newSrc = newSrc;
750
             largeVideoState.isVisible = $('#largeVideo').is(':visible');
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
             if(largeVideoState.userResourceJid) {
754
             if(largeVideoState.userResourceJid) {
753
                 largeVideoState.oldResourceJid = largeVideoState.userResourceJid;
755
                 largeVideoState.oldResourceJid = largeVideoState.userResourceJid;
754
             } else {
756
             } else {
2231
             focusedVideoInfo = null;
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
     return my;
2252
     return my;
2236
 }(VideoLayout || {}));
2253
 }(VideoLayout || {}));

+ 0
- 2
modules/statistics/RTPStatsCollector.js 查看文件

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

+ 3
- 1
service/RTC/StreamEventTypes.js 查看文件

7
 
7
 
8
     EVENT_TYPE_REMOTE_CREATED: "stream.remote_created",
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
 module.exports = StreamEventTypes;
15
 module.exports = StreamEventTypes;

正在加载...
取消
保存