rtcpeerconnection
Advanced tools
Comparing version 2.6.6 to 2.7.0
{ | ||
"name": "rtcpeerconnection", | ||
"version": "2.6.6", | ||
"version": "2.7.0", | ||
"description": "A tiny browser module that normalizes and simplifies the API for WebRTC peer connections.", | ||
@@ -22,3 +22,3 @@ "main": "rtcpeerconnection.js", | ||
"traceablepeerconnection": "^1.0.0", | ||
"sdp-jingle-json": "1.x", | ||
"sdp-jingle-json": "2.x", | ||
"underscore": "1.x" | ||
@@ -28,3 +28,3 @@ }, | ||
"browserify": "2.x", | ||
"precommit-hook": "0.3.x", | ||
"precommit-hook": "1.x", | ||
"tape": "2.x" | ||
@@ -31,0 +31,0 @@ }, |
@@ -59,4 +59,4 @@ # RTCPeerConnection | ||
// remote stream added | ||
pc.on('streamAdded', function (stream) { | ||
// do something with the remote stream | ||
pc.on('addStream', function (event) { | ||
// do something with event.stream | ||
// probably attach it to a <video> element | ||
@@ -67,3 +67,3 @@ // and play it. | ||
// remote stream removed | ||
pc.on('streamRemoved', function (stream) { | ||
pc.on('removeStream', function (event) { | ||
// remote stream removed | ||
@@ -75,4 +75,4 @@ // now you could hide/disable removed video | ||
// offers and answers instead, if you prefer | ||
pc.on('answer', function (answer) { ... }); | ||
pc.on('offer', function (offer) { ... }); | ||
pc.on('answer', function (err, answer) { ... }); | ||
pc.on('offer', function (err, offer) { ... }); | ||
@@ -99,4 +99,4 @@ // on peer connection close | ||
// create an offer | ||
pc.offer(function (offer) { | ||
connection.send('offer', offer) | ||
pc.offer(function (err, offer) { | ||
if (!err) connection.send('offer', offer) | ||
}); | ||
@@ -103,0 +103,0 @@ |
@@ -86,2 +86,4 @@ var _ = require('underscore'); | ||
this._role = this.isInitiator ? 'initiator' : 'responder'; | ||
if (this.config.debug) { | ||
@@ -174,18 +176,16 @@ this.on('*', function (eventName, event) { | ||
candidates.forEach(function (candidate) { | ||
candidates.forEach( | ||
function (candidate) { | ||
var iceCandidate = SJJ.toCandidateSDP(candidate) + '\r\n'; | ||
self.pc.addIceCandidate(new webrtc.IceCandidate({ | ||
candidate: iceCandidate, | ||
sdpMLineIndex: mline, | ||
sdpMid: mid | ||
}) | ||
/* not yet, breaks Chrome M32 */ | ||
/* | ||
, function () { | ||
// well, this success callback is pretty meaningless | ||
}, | ||
function (err) { | ||
self.emit('error', err); | ||
} | ||
*/ | ||
self.pc.addIceCandidate( | ||
new webrtc.IceCandidate({ | ||
candidate: iceCandidate, | ||
sdpMLineIndex: mline, | ||
sdpMid: mid | ||
}), function () { | ||
// well, this success callback is pretty meaningless | ||
}, | ||
function (err) { | ||
self.emit('error', err); | ||
} | ||
); | ||
@@ -201,3 +201,9 @@ self._checkRemoteCandidate(iceCandidate); | ||
self.pc.addIceCandidate(new webrtc.IceCandidate(update.candidate)); | ||
self.pc.addIceCandidate( | ||
new webrtc.IceCandidate(update.candidate), | ||
function () { }, | ||
function (err) { | ||
self.emit('error', err); | ||
} | ||
); | ||
self._checkRemoteCandidate(update.candidate.candidate); | ||
@@ -232,3 +238,6 @@ } | ||
if (self.config.useJingle) { | ||
jingle = SJJ.toSessionJSON(offer.sdp, self.config.isInitiator ? 'initiator' : 'responder'); | ||
jingle = SJJ.toSessionJSON(offer.sdp, { | ||
role: self._role, | ||
direction: 'outgoing' | ||
}); | ||
jingle.sid = self.config.sid; | ||
@@ -314,3 +323,7 @@ self.localDescription = jingle; | ||
*/ | ||
offer.sdp = SJJ.toSessionSDP(offer.jingle, self.config.sdpSessionID); | ||
offer.sdp = SJJ.toSessionSDP(offer.jingle, { | ||
sid: self.config.sdpSessionID, | ||
role: self._role, | ||
direction: 'incoming' | ||
}); | ||
self.remoteDescription = offer.jingle; | ||
@@ -373,3 +386,7 @@ } | ||
if (answer.jingle) { | ||
answer.sdp = SJJ.toSessionSDP(answer.jingle, self.config.sdpSessionID); | ||
answer.sdp = SJJ.toSessionSDP(answer.jingle, { | ||
sid: self.config.sdpSessionID, | ||
role: self._role, | ||
direction: 'incoming' | ||
}); | ||
self.remoteDescription = answer.jingle; | ||
@@ -415,3 +432,6 @@ } | ||
// native simulcast part 1: add another SSRC | ||
answer.jingle = SJJ.toSessionJSON(answer.sdp); | ||
answer.jingle = SJJ.toSessionJSON(answer.sdp, { | ||
role: self._role, | ||
direction: 'outoing' | ||
}); | ||
if (answer.jingle.contents.length >= 2 && answer.jingle.contents[1].name === 'video') { | ||
@@ -447,3 +467,7 @@ var hasSimgroup = false; | ||
answer.jingle.contents[1].description.sourceGroups = groups; | ||
answer.sdp = SJJ.toSessionSDP(answer.jingle, self.config.sdpSessionID); | ||
answer.sdp = SJJ.toSessionSDP(answer.jingle, { | ||
sid: self.config.sdpSessionID, | ||
role: self._role, | ||
direction: 'outgoing' | ||
}); | ||
} | ||
@@ -459,3 +483,6 @@ } | ||
if (self.config.useJingle) { | ||
var jingle = SJJ.toSessionJSON(answer.sdp); | ||
var jingle = SJJ.toSessionJSON(answer.sdp, { | ||
role: self._role, | ||
direction: 'outgoing' | ||
}); | ||
jingle.sid = self.config.sid; | ||
@@ -470,3 +497,6 @@ self.localDescription = jingle; | ||
if (!expandedAnswer.jingle) { | ||
expandedAnswer.jingle = SJJ.toSessionJSON(answer.sdp); | ||
expandedAnswer.jingle = SJJ.toSessionJSON(answer.sdp, { | ||
role: self._role, | ||
direction: 'outgoing' | ||
}); | ||
} | ||
@@ -484,3 +514,7 @@ var groups = expandedAnswer.jingle.contents[1].description.sourceGroups || []; | ||
}); | ||
expandedAnswer.sdp = SJJ.toSessionSDP(expandedAnswer.jingle); | ||
expandedAnswer.sdp = SJJ.toSessionSDP(expandedAnswer.jingle, { | ||
sid: self.sdpSessionID, | ||
role: self._role, | ||
direction: 'outgoing' | ||
}); | ||
} | ||
@@ -525,3 +559,6 @@ expandedAnswer.sdp.split('\r\n').forEach(function (line) { | ||
if (!self.config.ice[ice.sdpMid]) { | ||
var jingle = SJJ.toSessionJSON(self.pc.localDescription.sdp, self.config.isInitiator ? 'initiator' : 'responder'); | ||
var jingle = SJJ.toSessionJSON(self.pc.localDescription.sdp, { | ||
role: self._role, | ||
direction: 'incoming' | ||
}); | ||
_.each(jingle.contents, function (content) { | ||
@@ -540,3 +577,3 @@ var transport = content.transport || {}; | ||
name: ice.sdpMid, | ||
creator: self.config.isInitiator ? 'initiator' : 'responder', | ||
creator: self._role, | ||
transport: { | ||
@@ -543,0 +580,0 @@ transType: 'iceUdp', |
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
164396
4376
10
2
+ Addedsdp-jingle-json@2.2.1(transitive)
- Removedsdp-jingle-json@1.3.0(transitive)
Updatedsdp-jingle-json@2.x