Removes a tangle of spaghetti.
This commit is contained in:
parent
14fe5d09d1
commit
9111797913
|
@ -53,7 +53,6 @@ var RTC = {
|
|||
audio: true,
|
||||
video: true
|
||||
},
|
||||
localStreams: [],
|
||||
remoteStreams: {},
|
||||
localAudio: null,
|
||||
localVideo: null,
|
||||
|
@ -74,10 +73,6 @@ var RTC = {
|
|||
|
||||
var localStream =
|
||||
new LocalStream(stream, type, eventEmitter, videoType, isGUMStream);
|
||||
//in firefox we have only one stream object
|
||||
if(this.localStreams.length === 0 ||
|
||||
this.localStreams[0].getOriginalStream() != stream)
|
||||
this.localStreams.push(localStream);
|
||||
if(isMuted === true)
|
||||
localStream.setMute(true);
|
||||
|
||||
|
@ -93,14 +88,6 @@ var RTC = {
|
|||
eventEmitter.emit(eventType, localStream, isMuted);
|
||||
return localStream;
|
||||
},
|
||||
removeLocalStream: function (stream) {
|
||||
for(var i = 0; i < this.localStreams.length; i++) {
|
||||
if(this.localStreams[i].getOriginalStream() === stream) {
|
||||
delete this.localStreams[i];
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
createRemoteStream: function (data, ssrc) {
|
||||
var jid = data.peerjid || APP.xmpp.myJid();
|
||||
|
||||
|
@ -203,16 +190,6 @@ var RTC = {
|
|||
}
|
||||
return false;
|
||||
},
|
||||
switchVideoStreams: function (newStream) {
|
||||
this.localVideo.stream = newStream;
|
||||
|
||||
this.localStreams = [];
|
||||
|
||||
//in firefox we have only one stream object
|
||||
if (this.localAudio.getOriginalStream() != newStream)
|
||||
this.localStreams.push(this.localAudio);
|
||||
this.localStreams.push(this.localVideo);
|
||||
},
|
||||
changeLocalVideo: function (stream, isUsingScreenStream, callback) {
|
||||
var oldStream = this.localVideo.getOriginalStream();
|
||||
var type = (isUsingScreenStream ? "screen" : "camera");
|
||||
|
@ -236,8 +213,6 @@ var RTC = {
|
|||
// Stop the stream to trigger onended event for old stream
|
||||
oldStream.stop();
|
||||
|
||||
this.switchVideoStreams(videoStream);
|
||||
|
||||
APP.xmpp.switchStreams(videoStream, oldStream,localCallback);
|
||||
},
|
||||
changeLocalAudio: function (stream, callback) {
|
||||
|
|
|
@ -20,7 +20,6 @@ function JingleSessionPC(me, sid, connection, service, eventEmitter) {
|
|||
this.state = null;
|
||||
this.localSDP = null;
|
||||
this.remoteSDP = null;
|
||||
this.relayedStreams = [];
|
||||
this.pc_constraints = null;
|
||||
|
||||
this.usetrickle = true;
|
||||
|
@ -169,13 +168,12 @@ JingleSessionPC.prototype.doInitialize = function () {
|
|||
this.peerconnection.onnegotiationneeded = function (event) {
|
||||
self.eventEmitter.emit(XMPPEvents.PEERCONNECTION_READY, self);
|
||||
};
|
||||
// add any local and relayed stream
|
||||
APP.RTC.localStreams.forEach(function(stream) {
|
||||
self.peerconnection.addStream(stream.getOriginalStream());
|
||||
});
|
||||
this.relayedStreams.forEach(function(stream) {
|
||||
self.peerconnection.addStream(stream);
|
||||
});
|
||||
if (APP.RTC.localAudio) {
|
||||
self.peerconnection.addStream(APP.RTC.localAudio.getOriginalStream());
|
||||
}
|
||||
if (APP.RTC.localVideo) {
|
||||
self.peerconnection.addStream(APP.RTC.localVideo.getOriginalStream());
|
||||
}
|
||||
};
|
||||
|
||||
function onIceConnectionStateChange(sid, session) {
|
||||
|
|
Loading…
Reference in New Issue