Socket
Socket
Sign inDemoInstall

connectycube

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connectycube - npm Package Compare versions

Comparing version 1.5.0 to 1.7.2

2

package.json
{
"name": "connectycube",
"description": "ConnectyCube JavaScript SDK",
"version": "1.5.0",
"version": "1.7.2",
"homepage": "https://developers.connectycube.com/js/",

@@ -6,0 +6,0 @@ "main": "src/cubeMain.js",

let config = {
version: '1.5.0',
version: '1.7.2',
creds: {

@@ -47,5 +47,10 @@ appId: '',

{
urls: 'turn:turn.connectycube.com:5349',
urls: 'turn:turn.connectycube.com:5349?transport=udp',
username: 'connectycube',
credential: '4c29501ca9207b7fb9c4b4b6b04faeb1'
},
{
urls: 'turn:turn.connectycube.com:5349?transport=tcp',
username: 'connectycube',
credential: '4c29501ca9207b7fb9c4b4b6b04faeb1'
}

@@ -52,0 +57,0 @@ ]

@@ -6,3 +6,9 @@ const Utils = require('./cubeInternalUtils');

XMPPClient,
XMPPWebSocketTransport,
XMPPWebSocketTransport;
let RTCPeerConnection,
RTCSessionDescription,
RTCIceCandidate,
MediaStream,
mediaDevices,
SDPTransform;

@@ -16,2 +22,8 @@

XMPPClient = require('./cubeStrophe');
RTCPeerConnection = window.RTCPeerConnection;
RTCSessionDescription = window.RTCSessionDescription;
RTCIceCandidate = window.RTCIceCandidate;
MediaStream = window.MediaStream;
mediaDevices = navigator.mediaDevices;
SDPTransform = require('sdp-transform');

@@ -32,4 +44,9 @@ } else if (Utils.getEnv().nativescript) {

XMPPClient: XMPPClient,
SDPTransform: SDPTransform,
XMPPWebSocketTransport: XMPPWebSocketTransport
XMPPWebSocketTransport: XMPPWebSocketTransport,
RTCPeerConnection: RTCPeerConnection,
RTCSessionDescription: RTCSessionDescription,
RTCIceCandidate: RTCIceCandidate,
MediaStream: MediaStream,
mediaDevices: mediaDevices,
SDPTransform: SDPTransform
};

@@ -47,16 +47,11 @@ const config = require('./cubeConfig');

if (Utils.getEnv().browser) {
// add WebRTC API if API is avaible
if (Utils.isWebRTCAvailble()) {
// p2p calls client
const WebRTCClient = require('./videocalling/cubeWebRTCClient');
// add WebRTC API if API is avaible
if (Utils.isWebRTCAvailble()) {
// p2p calls client
const WebRTCClient = require('./videocalling/cubeWebRTCClient');
this.videochat = new WebRTCClient(this.service, this.chat.xmppClient);
this.chat.webrtcSignalingProcessor = this.videochat.signalingProcessor;
// conf calls client
this.videochatconference = require('./videocalling_conference/cubeVideoCallingConference');
} else {
this.videochat = false;
this.videochatconference = false;
}
this.videochat = new WebRTCClient(this.service, this.chat.xmppClient);
this.chat.webrtcSignalingProcessor = this.videochat.signalingProcessor;
// conf calls client
this.videochatconference = require('./videocalling_conference/cubeVideoCallingConference');
} else {

@@ -63,0 +58,0 @@ this.videochat = false;

@@ -21,11 +21,11 @@ const Utils = {

isWebRTCAvailble: function () {
/** Shims */
const RTCPeerConnection = window.RTCPeerConnection,
IceCandidate = window.RTCIceCandidate,
SessionDescription = window.RTCSessionDescription;
let isAvaible = true;
let isAvaible = false;
if (!RTCPeerConnection || !IceCandidate || !SessionDescription) {
isAvaible = false;
if (this.isBrowser) {
if (window.RTCPeerConnection && window.RTCIceCandidate && window.RTCSessionDescription) {
isAvaible = true;
}
} else if (this.isReactNative){
isAvaible = true;
}

@@ -32,0 +32,0 @@

@@ -10,5 +10,6 @@ 'use strict';

var RTCPeerConnection = window.RTCPeerConnection;
var RTCSessionDescription = window.RTCSessionDescription;
var RTCIceCandidate = window.RTCIceCandidate;
var RTCPeerConnection = require('../cubeDependencies').RTCPeerConnection;
var RTCSessionDescription = require('../cubeDependencies').RTCSessionDescription;
var RTCIceCandidate = require('../cubeDependencies').RTCIceCandidate;
var MediaStream = require('../cubeDependencies').MediaStream;

@@ -15,0 +16,0 @@ RTCPeerConnection.State = {

@@ -21,2 +21,3 @@ 'use strict';

var Utils = require('../cubeInternalUtils');
var mediaDevices = require('../cubeDependencies').mediaDevices;

@@ -43,4 +44,4 @@ function WebRTCClient(service, connection) {

if(navigator.mediaDevices){
navigator.mediaDevices.ondevicechange = this._onDevicesChangeListener.bind(this);
if(mediaDevices){
mediaDevices.ondevicechange = this._onDevicesChangeListener.bind(this);
}

@@ -60,7 +61,7 @@ }

return new Promise(function(resolve, reject) {
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
if (!mediaDevices || !mediaDevices.enumerateDevices) {
reject(errMsg);
Helpers.traceWarning(errMsg);
} else {
navigator.mediaDevices.enumerateDevices().then(function(devices) {
mediaDevices.enumerateDevices().then(function(devices) {
if(spec) {

@@ -91,13 +92,11 @@ devices.forEach(function(device, i) {

* @param {array} opponentsIDs - Opponents IDs
* @param {number} ct - Call type
* @param {number} [cID=yourUserId] - Initiator ID
* @param {number} callType - Call type
* @param {object} [opts]
* @param {number} [opts.bandwidth=0] - Bandwidth limit (kbps)
*/
WebRTCClient.prototype.createNewSession = function(opponentsIDs, ct, cID, opts) {
WebRTCClient.prototype.createNewSession = function(opponentsIDs, callType, opts) {
var opponentsIdNASessions = getOpponentsIdNASessions(this.sessions),
callerID = cID || Helpers.getIdFromNode(this.connection.jid),
callerID = Helpers.getIdFromNode(Helpers.userCurrentJid(this.connection)),
bandwidth = opts && opts.bandwidth && (!isNaN(opts.bandwidth)) ? +opts.bandwidth : 0,
isIdentifyOpponents = false,
callType = ct || 2;
isIdentifyOpponents = false;

@@ -124,3 +123,3 @@ if (!opponentsIDs) {

signalingProvider: this.signalingProvider,
currentUserID: Helpers.getIdFromNode(this.connection.jid),
currentUserID: Helpers.getIdFromNode(Helpers.userCurrentJid(this.connection)),
bandwidth: bandwidth

@@ -146,3 +145,3 @@ });

WebRTCClient.prototype.clearSession = function(sessionId) {
delete WebRTCClient.sessions[sessionId];
delete this.sessions[sessionId];
};

@@ -195,14 +194,16 @@

} else {
var session = this.sessions[sessionID],
bandwidth = +userInfo.bandwidth || 0;
var session = this.sessions[sessionID];
var bandwidth = +userInfo.bandwidth || 0;
if (!session) {
session = this._createAndStoreSession(sessionID, extension.callerID, extension.opponentsIDs, extension.callType, bandwidth);
if (!session) {
session = this._createAndStoreSession(sessionID, extension.callerID, extension.opponentsIDs, extension.callType, bandwidth);
session.processOnCall(userID, extension);
if (typeof this.onCallListener === 'function') {
Utils.safeCallbackCall(this.onCallListener, session, userInfo);
}
} else {
session.processOnCall(userID, extension);
}
session.processOnCall(userID, extension);
}

@@ -209,0 +210,0 @@ };

'use strict';
var config = require('../cubeConfig');
const Utils = require('../cubeInternalUtils');

@@ -17,2 +18,13 @@ var WebRTCHelpers = {};

userCurrentJid: function(client) {
if (Utils.getEnv().browser) {
return client.jid;
} else if (Utils.getEnv().reactnative) {
return client.jid._local + '@' + client.jid._domain + '/' + client.jid._resource;
} else {
// Node.js & Native Script
return client.jid.user + '@' + client.jid._domain + '/' + client.jid._resource;
}
},
trace: function(text) {

@@ -19,0 +31,0 @@ if (config.debug) {

@@ -17,2 +17,3 @@ 'use strict';

var SignalingConstants = require('./cubeWebRTCSignalingConstants');
var MediaDevicesImpl = require('../cubeDependencies').mediaDevices;

@@ -74,6 +75,2 @@ /**

WebRTCSession.prototype.getUserMedia = function(params, callback) {
if(!navigator.mediaDevices.getUserMedia) {
throw new Error('getUserMedia() is not supported in your browser');
}
var self = this;

@@ -97,3 +94,3 @@

navigator.mediaDevices.getUserMedia({
MediaDevicesImpl.getUserMedia({
audio: params.audio || false,

@@ -196,6 +193,2 @@ video: params.video || false

if(!navigator.mediaDevices.getUserMedia) {
throw new Error('getUserMedia() is not supported in your browser');
}
var self = this,

@@ -222,3 +215,3 @@ localStream = this.localStream;

navigator.mediaDevices.getUserMedia({
MediaDevicesImpl.getUserMedia({
audio: self.mediaParams.audio || false,

@@ -241,3 +234,5 @@ video: self.mediaParams.video || false

this.detachMediaStream(elementId);
if (!Utils.getEnv().reactnative) {
this.detachMediaStream(elementId);
}

@@ -248,14 +243,18 @@ newStreamTracks.forEach(function(track) {

this.attachMediaStream(elementId, stream, ops);
for (var userId in peers) {
_replaceTracksForPeer(peers[userId]);
if (!Utils.getEnv().reactnative) {
this.attachMediaStream(elementId, stream, ops);
}
function _replaceTracksForPeer(peer) {
peer.getSenders().map(function(sender) {
sender.replaceTrack(newStreamTracks.find(function(track) {
return track.kind === sender.track.kind;
}));
});
if (!Utils.getEnv().reactnative) {
for (var userId in peers) {
_replaceTracksForPeer(peers[userId]);
}
function _replaceTracksForPeer(peer) {
peer.getSenders().map(function(sender) {
sender.replaceTrack(newStreamTracks.find(function(track) {
return track.kind === sender.track.kind;
}));
});
}
}

@@ -262,0 +261,0 @@ };

@@ -69,16 +69,21 @@ 'use strict';

var extension = {}, iceCandidates = [], opponents = [],
candidate, opponent, items, childrenNodes;
candidate, opponent, childrenNodes;
for (var i = 0, len = extraParams.childNodes.length; i < len; i++) {
if (extraParams.childNodes[i].tagName === 'iceCandidates') {
var extraParamsChildNodes = extraParams.childNodes || extraParams.children;
for (var i = 0, len = extraParamsChildNodes.length; i < len; i++) {
const items = extraParamsChildNodes[i].childNodes || extraParamsChildNodes[i].children;
const itemTagName = extraParamsChildNodes[i].tagName || extraParamsChildNodes[i].name;
if (itemTagName === 'iceCandidates') {
/** iceCandidates */
items = extraParams.childNodes[i].childNodes;
for (var j = 0, len2 = items.length; j < len2; j++) {
candidate = {};
childrenNodes = items[j].childNodes;
childrenNodes = items[j].childNodes || items[j].children;
for (var k = 0, len3 = childrenNodes.length; k < len3; k++) {
candidate[childrenNodes[k].tagName] = childrenNodes[k].textContent;
var childName = childrenNodes[k].tagName || childrenNodes[k].name;
var childValue = childrenNodes[k].textContent || childrenNodes[k].children[0];
candidate[childName] = childName === 'sdpMLineIndex' ? parseInt(childValue) : childValue;
}

@@ -89,13 +94,11 @@

} else if (extraParams.childNodes[i].tagName === 'opponentsIDs') {
} else if (itemTagName === 'opponentsIDs') {
/** opponentsIDs */
items = extraParams.childNodes[i].childNodes;
for (var v = 0, len2v = items.length; v < len2v; v++) {
opponent = items[v].textContent;
opponent = items[v].textContent || items[v].children[0];
opponents.push(parseInt(opponent));
}
} else {
if (extraParams.childNodes[i].childNodes.length > 1) {
var nodeTextContentSize = extraParams.childNodes[i].textContent.length;
if (items.length > 1) {
var nodeTextContentSize = (extraParamsChildNodes[i].textContent || extraParamsChildNodes[i].children[0]).length;

@@ -105,14 +108,14 @@ if (nodeTextContentSize > 4096) {

for (var t=0; t<extraParams.childNodes[i].childNodes.length; ++t) {
wholeNodeContent += extraParams.childNodes[i].childNodes[t].textContent;
for (var t=0; t<items.length; ++t) {
wholeNodeContent += (items.textContent || items.children[0]);
}
extension[extraParams.childNodes[i].tagName] = wholeNodeContent;
extension[itemTagName] = wholeNodeContent;
} else {
extension = ChatHelpers._XMLtoJS(extension, extraParams.childNodes[i].tagName, extraParams.childNodes[i]);
extension = ChatHelpers._XMLtoJS(extension, itemTagName, extraParamsChildNodes[i]);
}
} else {
if (extraParams.childNodes[i].tagName === 'userInfo') {
extension = ChatHelpers._XMLtoJS(extension, extraParams.childNodes[i].tagName, extraParams.childNodes[i]);
if (extraParamsChildNodes[i].tagName === 'userInfo') {
extension = ChatHelpers._XMLtoJS(extension, itemTagName, extraParamsChildNodes[i]);
} else {
extension[extraParams.childNodes[i].tagName] = extraParams.childNodes[i].textContent;
extension[itemTagName] = extraParamsChildNodes[i].textContent || extraParamsChildNodes[i].children[0];
}

@@ -119,0 +122,0 @@ }

@@ -46,4 +46,4 @@ 'use strict';

msg = $msg(params).c('extraParams', {
xmlns: Strophe.NS.CLIENT
msg = ChatHelpers.createMessageStanza(params).c('extraParams', {
xmlns: ChatHelpers.MARKERS.CLIENT
});

@@ -58,7 +58,7 @@

Object.keys(candidate).forEach(function(key) {
msg.c(key).t(candidate[key]).up();
msg = msg.c(key).t(candidate[key]).up();
});
msg.up();
msg = msg.up();
});
msg.up();
msg = msg.up();
} else if (field === 'opponentsIDs') {

@@ -70,9 +70,10 @@ /** opponentsIDs */

});
msg.up();
msg = msg.up();
} else if (typeof extension[field] === 'object') {
ChatHelpers._JStoXML(field, extension[field], msg);
} else {
msg.c(field).t(extension[field]).up();
msg = msg.c(field).t(extension[field]).up();
}
});
msg = msg.up();

@@ -79,0 +80,0 @@ this.connection.send(msg);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc