Fixes the issue with the chrome video that is not displayed in firefox.

pull/205/head
hristoterezov 10 years ago
parent dd608080b3
commit 2e26c212a2
  1. 24
      app.js
  2. 2
      libs/colibri/colibri.focus.js
  3. 11
      libs/strophe/strophe.jingle.adapter.js
  4. 4
      videolayout.js

@ -13,6 +13,7 @@ var roomName = null;
var ssrc2jid = {};
var mediaStreams = [];
var bridgeIsDown = false;
var notReceivedSSRCs = [];
/**
* The stats collector that process stats data and triggers updates to app.js.
@ -270,7 +271,7 @@ function waitForRemoteVideo(selector, ssrc, stream) {
videoSrcToSsrc[selector.attr('src')] = ssrc;
} else {
console.warn("No ssrc given for video", selector);
messageHandler.showError('Warning', 'No ssrc was given for the video.');
// messageHandler.showError('Warning', 'No ssrc was given for the video.');
}
$(document).trigger('videoactive.jingle', [selector]);
@ -331,6 +332,26 @@ function waitForPresence(data, sid) {
}
}
if(RTC.browser == "firefox")
{
if((notReceivedSSRCs.length == 0) ||
!ssrc2jid[notReceivedSSRCs[notReceivedSSRCs.length - 1]])
{
// TODO(gp) limit wait duration to 1 sec.
setTimeout(function(d, s) {
return function() {
waitForPresence(d, s);
}
}(data, sid), 250);
return;
}
thessrc = notReceivedSSRCs.pop();
if (ssrc2jid[thessrc]) {
data.peerjid = ssrc2jid[thessrc];
}
}
// NOTE(gp) now that we have simulcast, a media stream can have more than 1
// ssrc. We should probably take that into account in our MediaStream
// wrapper.
@ -853,6 +874,7 @@ $(document).bind('presence.muc', function (event, jid, info, pres) {
//console.log(jid, 'assoc ssrc', ssrc.getAttribute('type'), ssrc.getAttribute('ssrc'));
var ssrcV = ssrc.getAttribute('ssrc');
ssrc2jid[ssrcV] = jid;
notReceivedSSRCs.push(ssrcV);
var type = ssrc.getAttribute('type');
ssrc2videoType[ssrcV] = type;

@ -454,7 +454,7 @@ ColibriFocus.prototype.createdConference = function (result) {
'a=rtcp-fb:100 ccm fir\r\n' +
'a=rtcp-fb:100 nack\r\n' +
'a=rtcp-fb:100 nack pli\r\n' +
'a=rtcp-fb:100 goog-remb\r\n' +
// 'a=rtcp-fb:100 goog-remb\r\n' +
'a=rtpmap:116 red/90000\r\n' +
'a=rtpmap:117 ulpfec/90000\r\n' +
(config.useRtcpMux ? 'a=rtcp-mux\r\n' : '') +

@ -530,6 +530,14 @@ function setupRTC() {
callback(null);
});
};
RTC.getStreamID = function (stream) {
var tracks = stream.getVideoTracks();
if(!tracks || tracks.length == 0)
{
tracks = stream.getAudioTracks();
}
return tracks[0].id.replace(/[\{,\}]/g,"");
}
}
} else if (navigator.webkitGetUserMedia) {
console.log('This appears to be Chrome');
@ -559,6 +567,9 @@ function setupRTC() {
RTC.getLocalSSRC = function (session, callback) {
callback(null);
}
RTC.getStreamID = function (stream) {
return stream.id;
}
}
if (RTC === null) {
try { console.log('Browser does not appear to be WebRTC-capable'); } catch (e) { }

@ -23,7 +23,7 @@ var VideoLayout = (function (my) {
connection.jingle.localVideo = stream;
var localVideo = document.createElement('video');
localVideo.id = 'localVideo_' + stream.id;
localVideo.id = 'localVideo_' + RTC.getStreamID(stream);
localVideo.autoplay = true;
localVideo.volume = 0; // is it required if audio is separated ?
localVideo.oncontextmenu = function () { return false; };
@ -427,7 +427,7 @@ var VideoLayout = (function (my) {
? document.createElement('video')
: document.createElement('audio');
var id = (isVideo ? 'remoteVideo_' : 'remoteAudio_')
+ sid + '_' + stream.id;
+ sid + '_' + RTC.getStreamID(stream);
element.id = id;
element.autoplay = true;

Loading…
Cancel
Save