connectycube
Advanced tools
Comparing version 1.8.1 to 1.8.2
{ | ||
"name": "connectycube", | ||
"description": "ConnectyCube JavaScript SDK", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"homepage": "https://developers.connectycube.com/js/", | ||
@@ -6,0 +6,0 @@ "main": "src/cubeMain.js", |
let config = { | ||
version: '1.8.1', | ||
version: '1.8.2', | ||
creds: { | ||
@@ -4,0 +4,0 @@ appId: '', |
@@ -26,3 +26,3 @@ 'use strict'; | ||
RTCPeerConnection.prototype._init = function(delegate, userID, sessionID, type) { | ||
RTCPeerConnection.prototype._init = function (delegate, userID, sessionID, type) { | ||
Helpers.trace('RTCPeerConnection init. userID: ' + userID + ', sessionID: ' + sessionID + ', type: ' + type); | ||
@@ -62,3 +62,3 @@ | ||
RTCPeerConnection.prototype.release = function(){ | ||
RTCPeerConnection.prototype.release = function () { | ||
this._clearDialingTimer(); | ||
@@ -77,3 +77,3 @@ this._clearStatsReportTimer(); | ||
RTCPeerConnection.prototype.updateRemoteSDP = function(newSDP){ | ||
RTCPeerConnection.prototype.updateRemoteSDP = function (newSDP) { | ||
if (!newSDP) { | ||
@@ -86,9 +86,9 @@ throw new Error("sdp string can't be empty."); | ||
RTCPeerConnection.prototype.getRemoteSDP = function(){ | ||
RTCPeerConnection.prototype.getRemoteSDP = function () { | ||
return this.remoteSDP; | ||
}; | ||
RTCPeerConnection.prototype.setRemoteSessionDescription = function(type, remoteSessionDescription, callback) { | ||
RTCPeerConnection.prototype.setRemoteSessionDescription = function (type, remoteSessionDescription, callback) { | ||
var self = this, | ||
desc = new RTCSessionDescription({sdp: remoteSessionDescription, type: type}), | ||
desc = new RTCSessionDescription({ sdp: remoteSessionDescription, type: type }), | ||
ffVersion = Helpers.getVersionFirefox(); | ||
@@ -99,3 +99,7 @@ | ||
} else { | ||
desc.sdp = setMediaBitrate(desc.sdp, 'video', self.delegate.bandwidth); | ||
var newSdp = setMediaBitrate(desc.sdp, 'video', self.delegate.bandwidth); | ||
desc = new RTCSessionDescription({ | ||
sdp: newSdp, | ||
type: desc.type | ||
}) | ||
} | ||
@@ -114,3 +118,3 @@ | ||
RTCPeerConnection.prototype.addLocalStream = function(localStream){ | ||
RTCPeerConnection.prototype.addLocalStream = function (localStream) { | ||
if (localStream) { | ||
@@ -123,3 +127,3 @@ this.addStream(localStream); | ||
RTCPeerConnection.prototype.getAndSetLocalSessionDescription = function(callType, callback) { | ||
RTCPeerConnection.prototype.getAndSetLocalSessionDescription = function (callType, callback) { | ||
var self = this; | ||
@@ -133,6 +137,6 @@ | ||
self.createOffer().then(function(offer) { | ||
self.createOffer().then(function (offer) { | ||
offer.sdp = setMediaBitrate(offer.sdp, 'video', self.delegate.bandwidth); | ||
successCallback(offer); | ||
}).catch(function(reason) { | ||
}).catch(function (reason) { | ||
errorCallback(reason); | ||
@@ -142,6 +146,6 @@ }); | ||
} else { | ||
self.createAnswer().then(function(answer) { | ||
self.createAnswer().then(function (answer) { | ||
answer.sdp = setMediaBitrate(answer.sdp, 'video', self.delegate.bandwidth); | ||
successCallback(answer); | ||
}).catch(function(reason) { | ||
}).catch(function (reason) { | ||
errorCallback(reason); | ||
@@ -163,5 +167,5 @@ }); | ||
self.setLocalDescription(desc).then(function() { | ||
self.setLocalDescription(desc).then(function () { | ||
callback(null); | ||
}).catch(function(error) { | ||
}).catch(function (error) { | ||
errorCallback(error); | ||
@@ -176,3 +180,3 @@ }); | ||
RTCPeerConnection.prototype.addCandidates = function(iceCandidates) { | ||
RTCPeerConnection.prototype.addCandidates = function (iceCandidates) { | ||
var candidate; | ||
@@ -188,4 +192,4 @@ | ||
new RTCIceCandidate(candidate), | ||
function() {}, | ||
function(error){ | ||
function () { }, | ||
function (error) { | ||
Helpers.traceError("Error on 'addIceCandidate': " + error); | ||
@@ -205,6 +209,6 @@ } | ||
// https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/signalingState | ||
RTCPeerConnection.prototype.onSignalingStateCallback = function() { | ||
RTCPeerConnection.prototype.onSignalingStateCallback = function () { | ||
Helpers.trace("onSignalingStateCallback: " + this.signalingState); | ||
if (this.signalingState === 'stable' && this.iceCandidates.length > 0){ | ||
if (this.signalingState === 'stable' && this.iceCandidates.length > 0) { | ||
this.delegate.processIceCandidates(this, this.iceCandidates); | ||
@@ -215,3 +219,3 @@ this.iceCandidates.length = 0; | ||
RTCPeerConnection.prototype.onIceCandidateCallback = function(event) { | ||
RTCPeerConnection.prototype.onIceCandidateCallback = function (event) { | ||
var candidate = event.candidate; | ||
@@ -239,3 +243,3 @@ | ||
/** handler of remote media stream */ | ||
RTCPeerConnection.prototype.onAddRemoteMediaCallback = function(event) { | ||
RTCPeerConnection.prototype.onAddRemoteMediaCallback = function (event) { | ||
var self = this; | ||
@@ -259,3 +263,3 @@ | ||
RTCPeerConnection.prototype.onIceConnectionStateCallback = function() { | ||
RTCPeerConnection.prototype.onIceConnectionStateCallback = function () { | ||
Helpers.trace("onIceConnectionStateCallback: " + this.iceConnectionState); | ||
@@ -269,3 +273,3 @@ var self = this; | ||
*/ | ||
if (typeof this.delegate._onSessionConnectionStateChangedListener === 'function'){ | ||
if (typeof this.delegate._onSessionConnectionStateChangedListener === 'function') { | ||
var conState = null; | ||
@@ -307,3 +311,3 @@ | ||
if (Helpers.getVersionSafari() >= 11) { | ||
this.onStatusClosedChecker = setTimeout(function() { | ||
this.onStatusClosedChecker = setTimeout(function () { | ||
self.onIceConnectionStateCallback(); | ||
@@ -334,4 +338,4 @@ }, 500); | ||
*/ | ||
RTCPeerConnection.prototype._clearStatsReportTimer = function(){ | ||
if (this.statsReportTimer){ | ||
RTCPeerConnection.prototype._clearStatsReportTimer = function () { | ||
if (this.statsReportTimer) { | ||
clearInterval(this.statsReportTimer); | ||
@@ -342,3 +346,3 @@ this.statsReportTimer = null; | ||
RTCPeerConnection.prototype._getStatsWrap = function() { | ||
RTCPeerConnection.prototype._getStatsWrap = function () { | ||
var self = this, | ||
@@ -355,4 +359,4 @@ statsReportInterval, | ||
var _statsReportCallback = function() { | ||
_getStats(self, lastResult, function(results, lastResults) { | ||
var _statsReportCallback = function () { | ||
_getStats(self, lastResult, function (results, lastResults) { | ||
lastResult = lastResults; | ||
@@ -371,4 +375,4 @@ self.delegate._onCallStatsReport(self.userID, results, null); | ||
RTCPeerConnection.prototype._clearWaitingReconnectTimer = function() { | ||
if(this.waitingReconnectTimeoutCallback){ | ||
RTCPeerConnection.prototype._clearWaitingReconnectTimer = function () { | ||
if (this.waitingReconnectTimeoutCallback) { | ||
Helpers.trace('_clearWaitingReconnectTimer'); | ||
@@ -380,6 +384,6 @@ clearTimeout(this.waitingReconnectTimeoutCallback); | ||
RTCPeerConnection.prototype._startWaitingReconnectTimer = function() { | ||
RTCPeerConnection.prototype._startWaitingReconnectTimer = function () { | ||
var self = this, | ||
timeout = config.videochat.disconnectTimeInterval * 1000, | ||
waitingReconnectTimeoutCallback = function() { | ||
waitingReconnectTimeoutCallback = function () { | ||
Helpers.trace('waitingReconnectTimeoutCallback'); | ||
@@ -399,4 +403,4 @@ | ||
RTCPeerConnection.prototype._clearDialingTimer = function(){ | ||
if(this.dialingTimer){ | ||
RTCPeerConnection.prototype._clearDialingTimer = function () { | ||
if (this.dialingTimer) { | ||
Helpers.trace('_clearDialingTimer'); | ||
@@ -410,11 +414,11 @@ | ||
RTCPeerConnection.prototype._startDialingTimer = function(extension, withOnNotAnswerCallback){ | ||
RTCPeerConnection.prototype._startDialingTimer = function (extension, withOnNotAnswerCallback) { | ||
var self = this; | ||
var dialingTimeInterval = config.videochat.dialingTimeInterval*1000; | ||
var dialingTimeInterval = config.videochat.dialingTimeInterval * 1000; | ||
Helpers.trace('_startDialingTimer, dialingTimeInterval: ' + dialingTimeInterval); | ||
var _dialingCallback = function(extension, withOnNotAnswerCallback, skipIncrement){ | ||
if(!skipIncrement){ | ||
self.answerTimeInterval += config.videochat.dialingTimeInterval*1000; | ||
var _dialingCallback = function (extension, withOnNotAnswerCallback, skipIncrement) { | ||
if (!skipIncrement) { | ||
self.answerTimeInterval += config.videochat.dialingTimeInterval * 1000; | ||
} | ||
@@ -424,9 +428,9 @@ | ||
if(self.answerTimeInterval >= config.videochat.answerTimeInterval*1000){ | ||
if (self.answerTimeInterval >= config.videochat.answerTimeInterval * 1000) { | ||
self._clearDialingTimer(); | ||
if(withOnNotAnswerCallback){ | ||
if (withOnNotAnswerCallback) { | ||
self.delegate.processOnNotAnswer(self); | ||
} | ||
}else{ | ||
} else { | ||
self.delegate.processCall(self, extension); | ||
@@ -467,4 +471,4 @@ } | ||
peer.getStats(null).then(function(results) { | ||
results.forEach(function(result) { | ||
peer.getStats(null).then(function (results) { | ||
results.forEach(function (result) { | ||
var item; | ||
@@ -590,6 +594,6 @@ | ||
modifier = Helpers.getVersionFirefox() ? 'TIAS' : 'AS', | ||
amount = Helpers.getVersionFirefox() ? bitrate*1024 : bitrate; | ||
amount = Helpers.getVersionFirefox() ? bitrate * 1024 : bitrate; | ||
for (var i = 0; i < lines.length; i++) { | ||
if (lines[i].indexOf("m="+media) === 0) { | ||
if (lines[i].indexOf("m=" + media) === 0) { | ||
line = i; | ||
@@ -606,3 +610,3 @@ break; | ||
while(lines[line].indexOf('i=') === 0 || lines[line].indexOf('c=') === 0) { | ||
while (lines[line].indexOf('i=') === 0 || lines[line].indexOf('c=') === 0) { | ||
line++; | ||
@@ -612,3 +616,3 @@ } | ||
if (lines[line].indexOf('b') === 0) { | ||
lines[line] = 'b='+modifier+':'+amount; | ||
lines[line] = 'b=' + modifier + ':' + amount; | ||
return lines.join('\n'); | ||
@@ -618,3 +622,3 @@ } | ||
var newLines = lines.slice(0, line); | ||
newLines.push('b='+modifier+':'+amount); | ||
newLines.push('b=' + modifier + ':' + amount); | ||
newLines = newLines.concat(lines.slice(line, lines.length)); | ||
@@ -621,0 +625,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2177355
11726