Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"crypto-js": "3.1.2-2",
"node-xmpp-client": "^3.0.0",
"request": "^2.48.0",
"sdp-transform": "^2.3.0",
"strophe.js": "1.2.12",
"webrtc-adapter": "^2.1.0",
"xml2js": "^0.4.13"
Expand Down
86 changes: 43 additions & 43 deletions quickblox.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion samples/webrtc/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1038,4 +1038,4 @@
}
};
});
}(window, window.QB, window.app, window.CONFIG, jQuery, Backbone));
}(window, window.QB, window.app, window.CONFIG, jQuery, Backbone));
43 changes: 42 additions & 1 deletion src/modules/webrtc/qbRTCPeerConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
var config = require('../../qbConfig');
var Helpers = require('./qbWebRTCHelpers');

var transform = require('sdp-transform');

var RTCPeerConnection = window.RTCPeerConnection;
var RTCSessionDescription = window.RTCSessionDescription;
var RTCIceCandidate = window.RTCIceCandidate;
Expand Down Expand Up @@ -100,7 +102,7 @@ RTCPeerConnection.prototype.addLocalStream = function(localStream){
}
};

RTCPeerConnection.prototype.getAndSetLocalSessionDescription = function(callback) {
RTCPeerConnection.prototype.getAndSetLocalSessionDescription = function(callType, callback) {
var self = this;

self.state = RTCPeerConnection.State.CONNECTING;
Expand All @@ -115,6 +117,17 @@ RTCPeerConnection.prototype.getAndSetLocalSessionDescription = function(callback
}

function successCallback(desc) {
/**
* It's to fixed issue
* https://bugzilla.mozilla.org/show_bug.cgi?id=1377434
* callType === 2 is audio only
*/
var ffVersion = getVersionFirefox();

if(ffVersion !== null && ffVersion < 55 && callType === 2 && self.type === 'offer') {
desc.sdp = _modifySDPforFixIssue(desc.sdp);
}

self.setLocalDescription(desc, function() {
callback(null);
}, errorCallback);
Expand Down Expand Up @@ -355,4 +368,32 @@ function _getStats(peer, selector, successCallback, errorCallback) {
}, errorCallback);
}

/**
* It's functions to fixed issue
* https://bugzilla.mozilla.org/show_bug.cgi?id=1377434
*/
function getVersionFirefox() {
var ua = navigator ? navigator.userAgent : false;
var version;

if(ua) {
var ffInfo = ua.match(/(?:firefox)[ \/](\d+)/i) || [];
version = ffInfo[1] ? +ffInfo[1] : null;
}

return version;
}

function _modifySDPforFixIssue(sdp) {
var parsedSDP = transform.parse(sdp);

parsedSDP.groups = parsedSDP.groups ? parsedSDP.groups : [];
parsedSDP.groups.push({
mids: 'sdparta_0',
type: 'BUNDLE'
});

return transform.write(parsedSDP);
}

module.exports = RTCPeerConnection;
4 changes: 2 additions & 2 deletions src/modules/webrtc/qbWebRTCSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ WebRTCSession.prototype._callInternal = function(userID, extension, withOnNotAns
peer.addLocalStream(this.localStream);
this.peerConnections[userID] = peer;

peer.getAndSetLocalSessionDescription(function(err) {
peer.getAndSetLocalSessionDescription(this.callType, function(err) {
if (err) {
Helpers.trace("getAndSessionDescription error: " + err);
} else {
Expand Down Expand Up @@ -277,7 +277,7 @@ WebRTCSession.prototype._acceptInternal = function(userID, extension) {
}else{
Helpers.trace("'setRemoteSessionDescription' success");

peerConnection.getAndSetLocalSessionDescription(function(err) {
peerConnection.getAndSetLocalSessionDescription(self.callType, function(err) {
if (err) {
Helpers.trace("getAndSetLocalSessionDescription error: " + err);
} else {
Expand Down