Socket
Socket
Sign inDemoInstall

ice-breaker

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

30

lib/ice-breaker.js

@@ -110,3 +110,3 @@ 'use strict';

/**
* Returns an array of the ICE candidates present in the provided sdp.
* Returns an array of the ICE candidates (as objects) present in the provided sdp.
* - The SDP must be a string, with every field in a new line. (See RFC-4566 -

@@ -137,2 +137,30 @@ * https://tools.ietf.org/html/rfc4566 for SDP details).

}
/**
* Returns an array of the ICE candidates (as strings) present in the provided sdp.
* - The SDP must be a string, with every field in a new line. (See RFC-4566 -
* https://tools.ietf.org/html/rfc4566 for SDP details).
*
* @param {string} SDP, with every field in a new line
* @returns {Array} ICE candidates present in the provided sdp (returned as strings)
*/
}, {
key: 'getUnparsedCandidatesFromSDP',
value: function getUnparsedCandidatesFromSDP(sdp) {
var iceCandidates = [];
if (typeof sdp === 'string') {
var sdpLines = sdp.split('\n');
var iceCandidatesLines = sdpLines.filter(function (l) {
return l.indexOf('a=candidate') > -1;
});
iceCandidates = iceCandidatesLines.map(function (l) {
// remove 'a='
var candidate = l.substr(2).replace('\r', '');
return candidate;
});
}
return iceCandidates;
}
}]);

@@ -139,0 +167,0 @@

2

package.json
{
"name": "ice-breaker",
"version": "1.0.0",
"version": "1.1.0",
"description": "Set of helper methods to ease the WebRTC Media connection process.",

@@ -5,0 +5,0 @@ "main": "lib/ice-breaker.js",

@@ -1,2 +0,2 @@

Ice-Breaker
Ice-Breaker [![npm version](https://badge.fury.io/js/ice-breaker.svg)](https://badge.fury.io/js/ice-breaker)
=========

@@ -60,3 +60,3 @@

#### `getCandidatesFromSDP`: get an array of the ICE candidates present in an SDP file
#### `getCandidatesFromSDP`: get an array of the ICE candidates (as objects) present in an SDP file

@@ -92,2 +92,22 @@ ```javascript

#### `getUnparsedCandidatesFromSDP`: get an array of the ICE candidates (as strings) present in an SDP file
```javascript
var IceBreaker = require('ice-breaker');
// Please notice this is just a section of an SDP file
var sdp = 'a=sendonly\r\n' +
'a=candidate:1 1 UDP 2013266431 1111::222:3aff:1111:4983 50791 typ host\r\n' +
'a=candidate:2 1 TCP 1019217151 1111::222:3aff:1111:4983 9 typ host tcptype active\r\n';
var iceCandidates = IceBreaker.getUnparsedCandidatesFromSDP(sdp);
console.log('>>> Unparsed ICE Candidates in my SDP file: ', iceCandidates);
/* Should print:
>>> ICE Candidates in my SDP file: [ 'candidate:1 1 UDP 2013266431 1111::222:3aff:1111:4983 50791 typ host',
'candidate:2 1 TCP 1019217151 1111::222:3aff:1111:4983 9 typ host tcptype active' ]
*/
```
---

@@ -94,0 +114,0 @@ Thank you for using this module! Feel free to contribute :)

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc