rtcpeerconnection
Advanced tools
Comparing version 3.0.3 to 3.0.4
{ | ||
"name": "rtcpeerconnection", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "A tiny browser module that normalizes and simplifies the API for WebRTC peer connections.", | ||
@@ -5,0 +5,0 @@ "main": "rtcpeerconnection.js", |
@@ -38,2 +38,11 @@ var _ = require('underscore'); | ||
} | ||
// EXPERIMENTAL FLAG, might get removed without notice | ||
this.restrictBandwidth = 0; | ||
if (constraints && constraints.optional) { | ||
constraints.optional.forEach(function (constraint, idx) { | ||
if (constraint.andyetRestrictBandwidth) { | ||
self.restrictBandwidth = constraint.andyetRestrictBandwidth; | ||
} | ||
}); | ||
} | ||
@@ -477,2 +486,20 @@ this.pc = new peerconn(config, constraints); | ||
} | ||
if (self.restrictBandwidth > 0) { | ||
answer.jingle = SJJ.toSessionJSON(answer.sdp, { | ||
role: self._role(), | ||
direction: 'outgoing' | ||
}); | ||
if (answer.jingle.contents.length >= 2 && answer.jingle.contents[1].name === 'video') { | ||
var content = answer.jingle.contents[1]; | ||
var hasBw = content.description && content.description.bandwidth; | ||
if (!hasBw) { | ||
answer.jingle.contents[1].description.bandwidth = { type:'AS', bandwidth: self.restrictBandwidth.toString() }; | ||
answer.sdp = SJJ.toSessionSDP(answer.jingle, { | ||
sid: self.config.sdpSessionID, | ||
role: self._role(), | ||
direction: 'outgoing' | ||
}); | ||
} | ||
} | ||
} | ||
self.pc.setLocalDescription(answer, | ||
@@ -479,0 +506,0 @@ function () { |
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
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
172099
12
4554