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/toastr.js?v=1"></script><!-- notifications lib -->
<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 -->
<link rel="stylesheet" href="css/font.css?v=6"/>
<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
// 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
var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
var StreamEventType = require("../../service/RTC/StreamEventTypes");
/**
* Creates a MediaStream object for the given data, session id and ssrc.
@ -13,7 +13,7 @@ var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
*
* @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
// 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;
this.videoType = null;
this.muted = false;
this.eventEmitter = eventEmitter;
}
MediaStream.prototype.getOriginalStream = function()
{
return this.stream;
}
};
MediaStream.prototype.setMute = function (value)
{
this.stream.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;

View File

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

View File

@ -85,6 +85,9 @@ function registerListeners() {
APP.RTC.addStreamListener(function (stream) {
VideoLayout.onRemoteStreamAdded(stream);
}, 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.DOMINANTSPEAKER_CHANGED, function (resourceJid) {
VideoLayout.onDominantSpeakerChanged(resourceJid);

View File

@ -748,7 +748,9 @@ var VideoLayout = (function (my) {
largeVideoState.newSrc = newSrc;
largeVideoState.isVisible = $('#largeVideo').is(':visible');
largeVideoState.isDesktop = APP.RTC.isVideoSrcDesktop(resourceJid);
largeVideoState.isDesktop = APP.RTC.isVideoSrcDesktop(
APP.xmpp.findJidFromResource(resourceJid));
if(largeVideoState.userResourceJid) {
largeVideoState.oldResourceJid = largeVideoState.userResourceJid;
} else {
@ -2231,6 +2233,21 @@ var VideoLayout = (function (my) {
focusedVideoInfo = null;
}
}
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;
}(VideoLayout || {}));

View File

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

View File

@ -7,7 +7,9 @@ var StreamEventTypes = {
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;