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

This commit is contained in:
hristoterezov 2015-03-17 18:46:08 +02:00
parent f3274ea42e
commit 0da2547360
9 changed files with 18281 additions and 18227 deletions

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,6 +1,6 @@
////These lines should be uncommented when require works in app.js ////These lines should be uncommented when require works in app.js
var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
var MediaStreamType = require("../../service/RTC/MediaStreamTypes"); var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
var StreamEventType = require("../../service/RTC/StreamEventTypes");
/** /**
* Creates a MediaStream object for the given data, session id and ssrc. * Creates a MediaStream object for the given data, session id and ssrc.
@ -13,7 +13,7 @@ var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
* *
* @constructor * @constructor
*/ */
function MediaStream(data, sid, ssrc, browser) { function MediaStream(data, sid, ssrc, browser, eventEmitter) {
// XXX(gp) to minimize headaches in the future, we should build our // XXX(gp) to minimize headaches in the future, we should build our
// abstractions around tracks and not streams. ORTC is track based API. // abstractions around tracks and not streams. ORTC is track based API.
@ -33,19 +33,28 @@ function MediaStream(data, sid, ssrc, browser) {
MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE; MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
this.videoType = null; this.videoType = null;
this.muted = false; this.muted = false;
this.eventEmitter = eventEmitter;
} }
MediaStream.prototype.getOriginalStream = function() MediaStream.prototype.getOriginalStream = function()
{ {
return this.stream; return this.stream;
} };
MediaStream.prototype.setMute = function (value) MediaStream.prototype.setMute = function (value)
{ {
this.stream.muted = value; this.stream.muted = value;
this.muted = value; this.muted = value;
} };
MediaStream.prototype.setVideoType = function (value) {
if(this.videoType === value)
return;
this.videoType = value;
this.eventEmitter.emit(StreamEventType.EVENT_TYPE_REMOTE_CHANGED,
this.peerjid);
};
module.exports = MediaStream; module.exports = MediaStream;

View File

@ -63,14 +63,13 @@ var RTC = {
}, },
createRemoteStream: function (data, sid, thessrc) { createRemoteStream: function (data, sid, thessrc) {
var remoteStream = new MediaStream(data, sid, thessrc, var remoteStream = new MediaStream(data, sid, thessrc,
this.getBrowserType()); this.getBrowserType(), eventEmitter);
var jid = data.peerjid || APP.xmpp.myJid(); var jid = data.peerjid || APP.xmpp.myJid();
if(!this.remoteStreams[jid]) { if(!this.remoteStreams[jid]) {
this.remoteStreams[jid] = {}; this.remoteStreams[jid] = {};
} }
this.remoteStreams[jid][remoteStream.type]= remoteStream; this.remoteStreams[jid][remoteStream.type]= remoteStream;
eventEmitter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_CREATED, remoteStream); eventEmitter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_CREATED, remoteStream);
console.debug("ADD remote stream ", remoteStream.type, " ", jid, " ", thessrc);
return remoteStream; return remoteStream;
}, },
getBrowserType: function () { getBrowserType: function () {
@ -122,7 +121,7 @@ var RTC = {
var videoStream = peerStreams[MediaStreamType.VIDEO_TYPE]; var videoStream = peerStreams[MediaStreamType.VIDEO_TYPE];
if(!videoStream) if(!videoStream)
continue; continue;
videoStream.videoType = changedStreams[i].type; videoStream.setVideoType(changedStreams[i].type);
} }
} }
}); });
@ -183,8 +182,7 @@ var RTC = {
return false; return false;
var isDesktop = false; var isDesktop = false;
var stream = null; var stream = null;
if (APP.xmpp.myJid() && if (APP.xmpp.myJid() === jid) {
APP.xmpp.myResource() === jid) {
// local video // local video
stream = this.localVideo; stream = this.localVideo;
} else { } else {

View File

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

View File

@ -748,7 +748,9 @@ var VideoLayout = (function (my) {
largeVideoState.newSrc = newSrc; largeVideoState.newSrc = newSrc;
largeVideoState.isVisible = $('#largeVideo').is(':visible'); largeVideoState.isVisible = $('#largeVideo').is(':visible');
largeVideoState.isDesktop = APP.RTC.isVideoSrcDesktop(resourceJid); largeVideoState.isDesktop = APP.RTC.isVideoSrcDesktop(
APP.xmpp.findJidFromResource(resourceJid));
if(largeVideoState.userResourceJid) { if(largeVideoState.userResourceJid) {
largeVideoState.oldResourceJid = largeVideoState.userResourceJid; largeVideoState.oldResourceJid = largeVideoState.userResourceJid;
} else { } else {
@ -2232,6 +2234,21 @@ var VideoLayout = (function (my) {
} }
} }
my.onVideoTypeChanged = function (jid) {
if(jid &&
Strophe.getResourceFromJid(jid) === largeVideoState.userResourceJid)
{
largeVideoState.isDesktop = APP.RTC.isVideoSrcDesktop(jid);
VideoLayout.getVideoSize = largeVideoState.isDesktop
? getDesktopVideoSize
: getCameraVideoSize;
VideoLayout.getVideoPosition = largeVideoState.isDesktop
? getDesktopVideoPosition
: getCameraVideoPosition;
VideoLayout.positionLarge(null, null);
}
}
return my; return my;
}(VideoLayout || {})); }(VideoLayout || {}));

View File

@ -234,7 +234,6 @@ StatsCollector.prototype.start = function ()
{ {
var self = this; var self = this;
if(!config.disableAudioLevels) { if(!config.disableAudioLevels) {
console.debug("set audio levels interval");
this.audioLevelsIntervalId = setInterval( this.audioLevelsIntervalId = setInterval(
function () { function () {
// Interval updates // Interval updates
@ -262,7 +261,6 @@ StatsCollector.prototype.start = function ()
} }
if(!config.disableStats) { if(!config.disableStats) {
console.debug("set stats interval");
this.statsIntervalId = setInterval( this.statsIntervalId = setInterval(
function () { function () {
// Interval updates // Interval updates

View File

@ -7,7 +7,9 @@ var StreamEventTypes = {
EVENT_TYPE_REMOTE_CREATED: "stream.remote_created", EVENT_TYPE_REMOTE_CREATED: "stream.remote_created",
EVENT_TYPE_REMOTE_ENDED: "stream.remote_ended" EVENT_TYPE_REMOTE_ENDED: "stream.remote_ended",
EVENT_TYPE_REMOTE_CHANGED: "stream.changed"
}; };
module.exports = StreamEventTypes; module.exports = StreamEventTypes;