|
|
@@ -1000,6 +1000,10 @@ function JitsiRemoteTrack(RTC, data, sid, ssrc, eventEmitter) {
|
|
1000
|
1000
|
this.videoType = data.videoType;
|
|
1001
|
1001
|
this.ssrc = ssrc;
|
|
1002
|
1002
|
this.muted = false;
|
|
|
1003
|
+ if((this.type === JitsiTrack.AUDIO && data.audiomuted)
|
|
|
1004
|
+ || (this.type === JitsiTrack.VIDEO && data.videomuted)) {
|
|
|
1005
|
+ this.muted = true
|
|
|
1006
|
+ }
|
|
1003
|
1007
|
this.eventEmitter = eventEmitter;
|
|
1004
|
1008
|
var self = this;
|
|
1005
|
1009
|
if(this.stream)
|
|
|
@@ -1389,7 +1393,7 @@ RTC.prototype.removeLocalStream = function (stream) {
|
|
1389
|
1393
|
|
|
1390
|
1394
|
RTC.prototype.createRemoteStream = function (data, sid, thessrc) {
|
|
1391
|
1395
|
var remoteStream = new JitsiRemoteTrack(this, data, sid, thessrc,
|
|
1392
|
|
- RTCBrowserType.getBrowserType(), this.eventEmitter);
|
|
|
1396
|
+ this.eventEmitter);
|
|
1393
|
1397
|
if(!data.peerjid)
|
|
1394
|
1398
|
return;
|
|
1395
|
1399
|
var jid = data.peerjid;
|
|
|
@@ -4158,8 +4162,21 @@ var parser = {
|
|
4158
|
4162
|
}
|
|
4159
|
4163
|
};
|
|
4160
|
4164
|
|
|
4161
|
|
-function ChatRoom(connection, jid, password, XMPP, options)
|
|
4162
|
|
-{
|
|
|
4165
|
+/**
|
|
|
4166
|
+ * Returns array of JS objects from the presence JSON associated with the passed nodeName
|
|
|
4167
|
+ * @param pres the presence JSON
|
|
|
4168
|
+ * @param nodeName the name of the node (videomuted, audiomuted, etc)
|
|
|
4169
|
+ */
|
|
|
4170
|
+function filterNodeFromPresenceJSON(pres, nodeName){
|
|
|
4171
|
+ var res = [];
|
|
|
4172
|
+ for(var i = 0; i < pres.length; i++)
|
|
|
4173
|
+ if(pres[i].tagName === nodeName)
|
|
|
4174
|
+ res.push(pres[i]);
|
|
|
4175
|
+
|
|
|
4176
|
+ return res;
|
|
|
4177
|
+}
|
|
|
4178
|
+
|
|
|
4179
|
+function ChatRoom(connection, jid, password, XMPP, options) {
|
|
4163
|
4180
|
this.eventEmitter = new EventEmitter();
|
|
4164
|
4181
|
this.xmpp = XMPP;
|
|
4165
|
4182
|
this.connection = connection;
|
|
|
@@ -4179,6 +4196,7 @@ function ChatRoom(connection, jid, password, XMPP, options)
|
|
4179
|
4196
|
this.initPresenceMap();
|
|
4180
|
4197
|
this.session = null;
|
|
4181
|
4198
|
var self = this;
|
|
|
4199
|
+ this.lastPresences = {};
|
|
4182
|
4200
|
}
|
|
4183
|
4201
|
|
|
4184
|
4202
|
ChatRoom.prototype.initPresenceMap = function () {
|
|
|
@@ -4293,6 +4311,7 @@ ChatRoom.prototype.onPresence = function (pres) {
|
|
4293
|
4311
|
$(pres).find(">x").remove();
|
|
4294
|
4312
|
var nodes = [];
|
|
4295
|
4313
|
parser.packet2JSON(pres, nodes);
|
|
|
4314
|
+ this.lastPresences[from] = nodes;
|
|
4296
|
4315
|
for(var i = 0; i < nodes.length; i++)
|
|
4297
|
4316
|
{
|
|
4298
|
4317
|
var node = nodes[i];
|
|
|
@@ -4399,6 +4418,7 @@ ChatRoom.prototype.setSubject = function (subject) {
|
|
4399
|
4418
|
|
|
4400
|
4419
|
ChatRoom.prototype.onParticipantLeft = function (jid) {
|
|
4401
|
4420
|
|
|
|
4421
|
+ delete this.lastPresences[jid];
|
|
4402
|
4422
|
this.eventEmitter.emit(XMPPEvents.MUC_MEMBER_LEFT, jid);
|
|
4403
|
4423
|
|
|
4404
|
4424
|
this.moderator.onMucMemberLeft(jid);
|
|
|
@@ -4690,6 +4710,19 @@ ChatRoom.prototype.removeListener = function (type, listener) {
|
|
4690
|
4710
|
};
|
|
4691
|
4711
|
|
|
4692
|
4712
|
ChatRoom.prototype.remoteStreamAdded = function(data, sid, thessrc) {
|
|
|
4713
|
+ if(this.lastPresences[data.peerjid])
|
|
|
4714
|
+ {
|
|
|
4715
|
+ var pres = this.lastPresences[data.peerjid];
|
|
|
4716
|
+ var audiomuted = filterNodeFromPresenceJSON(pres, "audiomuted");
|
|
|
4717
|
+ var videomuted = filterNodeFromPresenceJSON(pres, "videomuted");
|
|
|
4718
|
+ data.videomuted = ((videomuted.length > 0
|
|
|
4719
|
+ && videomuted[0]
|
|
|
4720
|
+ && videomuted[0]["value"] === "true")? true : false);
|
|
|
4721
|
+ data.audiomuted = ((audiomuted.length > 0
|
|
|
4722
|
+ && audiomuted[0]
|
|
|
4723
|
+ && audiomuted[0]["value"] === "true")? true : false);
|
|
|
4724
|
+ }
|
|
|
4725
|
+
|
|
4693
|
4726
|
this.eventEmitter.emit(XMPPEvents.REMOTE_STREAM_RECEIVED, data, sid, thessrc);
|
|
4694
|
4727
|
}
|
|
4695
|
4728
|
|