Removes the chrome check. Fixes some minor firefox compatibility issues.

This commit is contained in:
hristoterezov 2014-11-06 15:54:47 +02:00
parent 1057c6dd0d
commit aa5c2c11ad
2 changed files with 42 additions and 18 deletions

49
app.js
View File

@ -65,26 +65,41 @@ function init() {
if (RTC === null) { if (RTC === null) {
window.location.href = 'webrtcrequired.html'; window.location.href = 'webrtcrequired.html';
return; return;
} else if (RTC.browser !== 'chrome') {
window.location.href = 'chromeonly.html';
return;
} }
obtainAudioAndVideoPermissions(function (stream) { obtainAudioAndVideoPermissions(function (stream) {
var audioStream = new webkitMediaStream(); var audioStream, videoStream;
var videoStream = new webkitMediaStream(); if(document.webkitMediaStream)
var audioTracks = stream.getAudioTracks(); {
var videoTracks = stream.getVideoTracks(); var audioStream = new webkitMediaStream();
for (var i = 0; i < audioTracks.length; i++) { var videoStream = new webkitMediaStream();
audioStream.addTrack(audioTracks[i]); var audioTracks = stream.getAudioTracks();
} var videoTracks = stream.getVideoTracks();
VideoLayout.changeLocalAudio(audioStream); for (var i = 0; i < audioTracks.length; i++) {
startLocalRtpStatsCollector(audioStream); audioStream.addTrack(audioTracks[i]);
}
for (i = 0; i < videoTracks.length; i++) { for (i = 0; i < videoTracks.length; i++) {
videoStream.addTrack(videoTracks[i]); videoStream.addTrack(videoTracks[i]);
}
VideoLayout.changeLocalAudio(audioStream);
startLocalRtpStatsCollector(audioStream);
VideoLayout.changeLocalVideo(videoStream, true);
} }
VideoLayout.changeLocalVideo(videoStream, true); else
{
// VideoLayout.changeLocalAudio(stream);
startLocalRtpStatsCollector(stream);
VideoLayout.changeLocalVideo(stream, true);
}
maybeDoJoin(); maybeDoJoin();
}); });
@ -275,7 +290,7 @@ function waitForPresence(data, sid) {
var thessrc; var thessrc;
// look up an associated JID for a stream id // look up an associated JID for a stream id
if (data.stream.id.indexOf('mixedmslabel') === -1) { if (!data.stream.id || data.stream.id.indexOf('mixedmslabel') === -1) {
// look only at a=ssrc: and _not_ at a=ssrc-group: lines // look only at a=ssrc: and _not_ at a=ssrc-group: lines
var ssrclines var ssrclines
= SDPUtil.find_lines(sess.peerconnection.remoteDescription.sdp, 'a=ssrc:'); = SDPUtil.find_lines(sess.peerconnection.remoteDescription.sdp, 'a=ssrc:');
@ -283,7 +298,7 @@ function waitForPresence(data, sid) {
// NOTE(gp) previously we filtered on the mslabel, but that property // NOTE(gp) previously we filtered on the mslabel, but that property
// is not always present. // is not always present.
// return line.indexOf('mslabel:' + data.stream.label) !== -1; // return line.indexOf('mslabel:' + data.stream.label) !== -1;
return line.indexOf('msid:' + data.stream.id) !== -1; return (!data.stream.id? false : (line.indexOf('msid:' + data.stream.id) !== -1));
}); });
if (ssrclines.length) { if (ssrclines.length) {
thessrc = ssrclines[0].substring(7).split(' ')[0]; thessrc = ssrclines[0].substring(7).split(' ')[0];

View File

@ -140,7 +140,16 @@ if (TraceablePeerConnection.prototype.__defineGetter__ !== undefined) {
TraceablePeerConnection.prototype.addStream = function (stream) { TraceablePeerConnection.prototype.addStream = function (stream) {
this.trace('addStream', stream.id); this.trace('addStream', stream.id);
this.peerconnection.addStream(stream); try
{
this.peerconnection.addStream(stream);
}
catch (e)
{
console.error(e);
return;
}
}; };
TraceablePeerConnection.prototype.removeStream = function (stream) { TraceablePeerConnection.prototype.removeStream = function (stream) {