Skip to content

Small fix before release 26012016 #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 31, 2016
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
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- "4.1"

before_script: "npm run-script build"
script: "npm run-script test"

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# QuickBlox JavaScript SDK

[![npm](https://img.shields.io/npm/v/quickblox.svg)]()
[![npm](https://img.shields.io/npm/dm/quickblox.svg)]()

The QuickBlox JavaScript SDK provides a JavaScript library making it even
easier to access the QuickBlox cloud communication backend platform.

Expand Down
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
],
"authors": [
"Igor Khomenko <[email protected]>",
"Vlad Lukhanin <[email protected]>"
"Vlad Lukhanin <[email protected]>",
"Dima Lobanov <[email protected]>"
],
"repository": {
"type": "git",
Expand Down
22 changes: 12 additions & 10 deletions js/modules/webrtc/qbWebRTCClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var WebRTCSignalingProvider = require('./qbWebRTCSignalingProvider');
var Helpers = require('./qbWebRTCHelpers');
var RTCPeerConnection = require('./qbRTCPeerConnection');
var SignalingConstants = require('./qbWebRTCSignalingConstants');
var Utils = require('../../qbUtils');

function WebRTCClient(service, connection) {
if (WebRTCClient.__instance) {
Expand Down Expand Up @@ -127,7 +128,7 @@ WebRTCClient.prototype._onCallListener = function(userID, sessionID, extension)

delete extension.sdp;
delete extension.platform;
extension["sessionID"] = sessionID;
extension.sessionID = sessionID;

this.signalingProvider.sendMessage(userID, extension, SignalingConstants.SignalingType.REJECT);
} else {
Expand All @@ -140,7 +141,7 @@ WebRTCClient.prototype._onCallListener = function(userID, sessionID, extension)
this._cleanupExtension(extensionClone);

if (typeof this.onCallListener === 'function'){
this.onCallListener(session, extensionClone);
Utils.safeCallbackCall(this.onCallListener, session, extensionClone);
}
}

Expand All @@ -159,7 +160,7 @@ WebRTCClient.prototype._onAcceptListener = function(userID, sessionID, extension
this._cleanupExtension(extensionClone);

if (typeof this.onAcceptCallListener === 'function'){
this.onAcceptCallListener(session, userID, extensionClone);
Utils.safeCallbackCall(this.onAcceptCallListener,session, userID, extensionClone);
}

session.processOnAccept(userID, extension);
Expand All @@ -172,16 +173,17 @@ WebRTCClient.prototype._onAcceptListener = function(userID, sessionID, extension
};

WebRTCClient.prototype._onRejectListener = function(userID, sessionID, extension) {
var session = this.sessions[sessionID];
var that = this,
session = that.sessions[sessionID];

Helpers.trace("onReject. UserID:" + userID + ". SessionID: " + sessionID);

if(session){
var extensionClone = JSON.parse(JSON.stringify(extension));
this._cleanupExtension(extensionClone);
that._cleanupExtension(extensionClone);

if (typeof this.onRejectCallListener === 'function'){
this.onRejectCallListener(session, userID, extensionClone);
Utils.safeCallbackCall(that.onRejectCallListener, session, userID, extensionClone);
}

session.processOnReject(userID, extension);
Expand All @@ -195,12 +197,12 @@ WebRTCClient.prototype._onStopListener = function(userID, sessionID, extension)

var session = this.sessions[sessionID],
extensionClone = JSON.parse(JSON.stringify(extension));

if( session && (session.state === WebRTCSession.State.ACTIVE || session.state === WebRTCSession.State.NEW)){
this._cleanupExtension(extensionClone);

if (typeof this.onStopCallListener === 'function'){
this.onStopCallListener(session, userID, extensionClone);
Utils.safeCallbackCall(this.onStopCallListener, session, userID, extensionClone);
}

session.processOnStop(userID, extension);
Expand Down Expand Up @@ -231,7 +233,7 @@ WebRTCClient.prototype._onUpdateListener = function(userID, sessionID, extension
Helpers.trace("onUpdate. UserID:" + userID + ". SessionID: " + sessionID + ". Extension: " + JSON.stringify(extension));

if (typeof this.onUpdateCallListener === 'function'){
this.onUpdateCallListener(session, userID, extension);
Utils.safeCallbackCall(this.onUpdateCallListener, session, userID, extension);
}
};

Expand Down Expand Up @@ -278,4 +280,4 @@ function getOpponentsIdNASessions(sessions) {
}

return opponents;
}
}
32 changes: 16 additions & 16 deletions js/modules/webrtc/qbWebRTCSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ WebRTCSession.prototype.getUserMedia = function(params, callback) {
/**
* Additional parameters for Media Constraints
* http://tools.ietf.org/html/draft-alvestrand-constraints-resolution-00
*
*
* googEchoCancellation: true
* googAutoGainControl: true
* googNoiseSuppression: true
Expand Down Expand Up @@ -125,14 +125,14 @@ WebRTCSession.prototype.attachMediaStream = function(id, stream, options) {
if (elem) {
var URL = window.URL || window.webkitURL;
elem.src = URL.createObjectURL(stream);

if (options && options.muted) elem.muted = true;

if (options && options.mirror) {
elem.style.webkitTransform = 'scaleX(-1)';
elem.style.transform = 'scaleX(-1)';
}

elem.play();
} else {
throw new Error('Unable to attach media stream, element ' + id + ' is undefined');
Expand Down Expand Up @@ -169,7 +169,7 @@ WebRTCSession.prototype.detachMediaStream = function(id){
/**
* [Initiate a call]
* @param {object} extension [custom parametrs]
* @param {Function} callback
* @param {Function} callback
*/
WebRTCSession.prototype.call = function(extension, callback) {
var self = this,
Expand Down Expand Up @@ -251,7 +251,7 @@ WebRTCSession.prototype.accept = function(extension) {
var offerTime = (self.acceptCallTime - self.startCallTime) / 1000;
self._startWaitingOfferOrAnswerTimer(offerTime);

/**
/**
* here we have to decide to which users the user should call.
* We have a rule: If a userID1 > userID2 then a userID1 should call to userID2.
*/
Expand Down Expand Up @@ -452,7 +452,7 @@ WebRTCSession.prototype.processOnCall = function(callerID, extension) {

oppIDs.forEach(function(opID, i, arr) {
var pConn = self.peerConnections[opID];

if(pConn){
if(opID == callerID){
pConn.updateRemoteSDP(extension.sdp);
Expand Down Expand Up @@ -509,7 +509,7 @@ WebRTCSession.prototype.processOnReject = function(userID, extension) {
}else{
Helpers.traceError("Ignore 'OnReject', there is no information about peer connection by some reason.");
}

this._closeSessionIfAllConnectionsClosed();
};

Expand Down Expand Up @@ -579,7 +579,7 @@ WebRTCSession.prototype.processOnNotAnswer = function(peerConnection) {
peerConnection.release();

if(typeof this.onUserNotAnswerListener === 'function'){
this.onUserNotAnswerListener(this, peerConnection.userID);
Utils.safeCallbackCall(this.onUserNotAnswerListener, this, peerConnection.userID);
}

this._closeSessionIfAllConnectionsClosed();
Expand All @@ -590,15 +590,15 @@ WebRTCSession.prototype.processOnNotAnswer = function(peerConnection) {
*/
WebRTCSession.prototype._onRemoteStreamListener = function(userID, stream) {
if (typeof this.onRemoteStreamListener === 'function'){
this.onRemoteStreamListener(this, userID, stream);
Utils.safeCallbackCall(this.onRemoteStreamListener, this, userID, stream);
}
};

WebRTCSession.prototype._onSessionConnectionStateChangedListener = function(userID, connectionState) {
var self = this;

if (typeof self.onSessionConnectionStateChangedListener === 'function'){
self.onSessionConnectionStateChangedListener(self, userID, connectionState);
Utils.safeCallbackCall(self.onSessionConnectionStateChangedListener, self, userID, connectionState);
}
};

Expand All @@ -613,7 +613,7 @@ WebRTCSession.prototype._createPeer = function(userID, peerConnectionType) {
/**
* Additional parameters for RTCPeerConnection options
* new RTCPeerConnection(pcConfig, options)
*
*
* DtlsSrtpKeyAgreement: true
* RtpDataChannels: true
*/
Expand Down Expand Up @@ -643,7 +643,7 @@ WebRTCSession.prototype._close = function() {
this.state = WebRTCSession.State.CLOSED;

if(typeof this.onSessionCloseListener === 'function'){
this.onSessionCloseListener(this);
Utils.safeCallbackCall(this.onSessionCloseListener, this);
}
};

Expand Down Expand Up @@ -775,7 +775,7 @@ WebRTCSession.prototype._uniqueOpponentsIDs = function(){
opponents.push(parseInt(userID));
}
});

return opponents;
};

Expand All @@ -788,7 +788,7 @@ WebRTCSession.prototype._uniqueOpponentsIDsWithoutInitiator = function(){
opponents.push(parseInt(userID));
}
});

return opponents;
};

Expand Down Expand Up @@ -832,4 +832,4 @@ function _prepareIceServers(iceServers) {
return iceServersCopy;
}

module.exports = WebRTCSession;
module.exports = WebRTCSession;
20 changes: 20 additions & 0 deletions js/qbConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ var config = {
'url': 'turn:turn.quickblox.com:3478?transport=tcp',
'username': 'quickblox',
'credential': 'baccb97ba2d92d71e26eb9886da5f1e0'
},
{
'url': 'turn:turnsingapor.quickblox.com:3478?transport=udp',
'username': 'quickblox',
'credential': 'baccb97ba2d92d71e26eb9886da5f1e0'
},
{
'url': 'turn:turnsingapore.quickblox.com:3478?transport=tcp',
'username': 'quickblox',
'credential': 'baccb97ba2d92d71e26eb9886da5f1e0'
},
{
'url': 'turn:turnireland.quickblox.com:3478?transport=udp',
'username': 'quickblox',
'credential': 'baccb97ba2d92d71e26eb9886da5f1e0'
},
{
'url': 'turn:turnireland.quickblox.com:3478?transport=tcp',
'username': 'quickblox',
'credential': 'baccb97ba2d92d71e26eb9886da5f1e0'
}
]
},
Expand Down
5 changes: 3 additions & 2 deletions js/qbMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ QuickBlox.prototype = {
Content = require('./modules/qbContent'),
Location = require('./modules/qbLocation'),
PushNotifications = require('./modules/qbPushNotifications'),
Data = require('./modules/qbData');
Data = require('./modules/qbData'),
conn;

if (isBrowser) {
/** create Strophe Connection object */
var Connection = require('./qbStrophe');
var conn = new Connection();
conn = new Connection();

/** add WebRTC API if API is avaible */
if( Utils.isWebRTCAvailble() ) {
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@
},
"config": {
"ghooks": {
"pre-commit": "jasmine"
"pre-push": "jasmine"
}
},
"scripts": {
"build": "npm install -g jasmine && npm install -g grunt && grunt",
"test": "jasmine"
}
}
18 changes: 9 additions & 9 deletions quickblox.min.js

Large diffs are not rendered by default.

Loading