Removes browser checks. Optimizes the browser specific code.

This commit is contained in:
hristoterezov 2014-11-21 16:50:16 +02:00
parent c2f6c9f7bc
commit 99da618811
5 changed files with 21 additions and 15 deletions

7
app.js
View File

@ -13,7 +13,9 @@ var roomName = null;
var ssrc2jid = {};
var mediaStreams = [];
var bridgeIsDown = false;
//TODO: this array must be removed when firefox implement multistream support
var notReceivedSSRCs = [];
var jid2Ssrc = {};
/**
@ -91,11 +93,9 @@ function init() {
}
else
{
VideoLayout.changeLocalAudio(stream);
VideoLayout.changeLocalStream(stream);
startLocalRtpStatsCollector(stream);
VideoLayout.changeLocalVideo(stream, true);
}
@ -332,6 +332,7 @@ function waitForPresence(data, sid) {
}
}
//TODO: this code should be removed when firefox implement multistream support
if(RTC.browser == "firefox")
{
if((notReceivedSSRCs.length == 0) ||

View File

@ -5,7 +5,6 @@ function TraceablePeerConnection(ice_config, constraints) {
this.updateLog = [];
this.stats = {};
this.statsinterval = null;
this.originalRemoteDescription = null;
this.maxstats = 0; // limit to 300 values, i.e. 5 minutes; set to 0 to disable
/**
@ -188,7 +187,6 @@ TraceablePeerConnection.prototype.setRemoteDescription = function (description,
var self = this;
description = simulcast.transformRemoteDescription(description);
this.trace('setRemoteDescription', dumpSDP(description));
this.originalRemoteDescription = description;
this.peerconnection.setRemoteDescription(description,
function () {
self.trace('setRemoteDescriptionOnSuccess');

View File

@ -84,7 +84,9 @@ Strophe.addConnectionPlugin('jingle', {
case 'session-initiate':
sess = new JingleSession($(iq).attr('to'), $(iq).find('jingle').attr('sid'), this.connection);
// configure session
if (this.localAudio && RTC.browser == "chrome") {
//in firefox we have only one stream object
if (this.localAudio != this.localVideo) {
sess.localStreams.push(this.localAudio);
}
if (this.localVideo) {
@ -169,7 +171,9 @@ Strophe.addConnectionPlugin('jingle', {
Math.random().toString(36).substr(2, 12), // random string
this.connection);
// configure session
if (this.localAudio && RTC.browser == "chrome") {
//in firefox we have only one stream
if (this.localAudio != this.localVideo) {
sess.localStreams.push(this.localAudio);
}
if (this.localVideo) {

View File

@ -89,7 +89,9 @@ SessionBase.prototype.switchStreams = function (new_stream, oldStream, success_c
self.connection.jingle.localVideo = new_stream;
self.connection.jingle.localStreams = [];
if(RTC.browser == "chrome")
//in firefox we have only one stream object
if(self.connection.jingle.localAudio != self.connection.jingle.localVideo)
self.connection.jingle.localStreams.push(self.connection.jingle.localAudio);
self.connection.jingle.localStreams.push(self.connection.jingle.localVideo);

View File

@ -11,15 +11,16 @@ var VideoLayout = (function (my) {
my.connectionIndicators = {};
my.changeLocalStream = function (stream) {
connection.jingle.localAudio = stream;
VideoLayout.changeLocalVideo(stream, true);
}
my.changeLocalAudio = function(stream) {
connection.jingle.localAudio = stream;
if(RTC.browser == "chrome")
{
RTC.attachMediaStream($('#localAudio'), stream);
document.getElementById('localAudio').autoplay = true;
document.getElementById('localAudio').volume = 0;
}
RTC.attachMediaStream($('#localAudio'), stream);
document.getElementById('localAudio').autoplay = true;
document.getElementById('localAudio').volume = 0;
};
my.changeLocalVideo = function(stream, flipX) {