Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sdp-jingle-json

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sdp-jingle-json - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

125

index.js

@@ -1,11 +0,120 @@

var tosdp = require('./lib/tosdp');
var tojson = require('./lib/tojson');
var toSDP = require('./lib/tosdp');
var toJSON = require('./lib/tojson');
exports.toSessionSDP = tosdp.toSessionSDP;
exports.toMediaSDP = tosdp.toMediaSDP;
exports.toCandidateSDP = tosdp.toCandidateSDP;
// Converstion from JSON to SDP
exports.toSessionJSON = tojson.toSessionJSON;
exports.toMediaJSON = tojson.toMediaJSON;
exports.toCandidateJSON = tojson.toCandidateJSON;
exports.toIncomingSDPOffer = function (session) {
return toSDP.toSessionSDP(session, {
role: 'responder',
direction: 'incoming'
});
};
exports.toOutgoingSDPOffer = function (session) {
return toSDP.toSessionSDP(session, {
role: 'initiator',
direction: 'outgoing'
});
};
exports.toIncomingSDPAnswer = function (session) {
return toSDP.toSessionSDP(session, {
role: 'initiator',
direction: 'incoming'
});
};
exports.toOutgoingSDPAnswer = function (session) {
return toSDP.toSessionSDP(session, {
role: 'responder',
direction: 'outgoing'
});
};
exports.toIncomingMediaSDPOffer = function (media) {
return toSDP.toMediaSDP(media, {
role: 'responder',
direction: 'incoming'
});
};
exports.toOutgoingMediaSDPOffer = function (media) {
return toSDP.toMediaSDP(media, {
role: 'initiator',
direction: 'outgoing'
});
};
exports.toIncomingMediaSDPAnswer = function (media) {
return toSDP.toMediaSDP(media, {
role: 'initiator',
direction: 'incoming'
});
};
exports.toOutgoingMediaSDPAnswer = function (media) {
return toSDP.toMediaSDP(media, {
role: 'responder',
direction: 'outgoing'
});
};
exports.toCandidateSDP = toSDP.toCandidateSDP;
exports.toMediaSDP = toSDP.toMediaSDP;
exports.toSessionSDP = toSDP.toSessionSDP;
// Conversion from SDP to JSON
exports.toIncomingJSONOffer = function (sdp, creators) {
return toJSON.toSessionJSON(sdp, {
role: 'responder',
direction: 'incoming',
creators: creators
});
};
exports.toOutgoingJSONOffer = function (sdp, creators) {
return toJSON.toSessionJSON(sdp, {
role: 'initiator',
direction: 'outgoing',
creators: creators
});
};
exports.toIncomingJSONAnswer = function (sdp, creators) {
return toJSON.toSessionJSON(sdp, {
role: 'initiator',
direction: 'incoming',
creators: creators
});
};
exports.toOutgoingJSONAnswer = function (sdp, creators) {
return toJSON.toSessionJSON(sdp, {
role: 'responder',
direction: 'outgoing',
creators: creators
});
};
exports.toIncomingMediaJSONOffer = function (sdp, creator) {
return toJSON.toMediaJSON(sdp, {
role: 'initiator',
direction: 'incoming',
creator: creator
});
};
exports.toOutgoingMediaJSONOffer = function (sdp, creator) {
return toJSON.toMediaJSON(sdp, {
role: 'responder',
direction: 'outgoing',
creator: creator
});
};
exports.toIncomingMediaJSONAnswer = function (sdp, creator) {
return toJSON.toMediaJSON(sdp, {
role: 'initiator',
direction: 'incoming',
creator: creator
});
};
exports.toOutgoingMediaJSONAnswer = function (sdp, creator) {
return toJSON.toMediaJSON(sdp, {
role: 'responder',
direction: 'outgoing',
creator: creator
});
};
exports.toCandidateJSON = toJSON.toCandidateJSON;
exports.toMediaJSON = toJSON.toMediaJSON;
exports.toSessionJSON = toJSON.toSessionJSON;

15

lib/tojson.js

@@ -11,3 +11,4 @@ var SENDERS = require('./senders');

exports.toSessionJSON = function (sdp, opts) {
var creator = opts.creator || 'initiator';
var i;
var creators = opts.creators || [];
var role = opts.role || 'initiator';

@@ -19,3 +20,3 @@ var direction = opts.direction || 'outgoing';

var media = sdp.split('\r\nm=');
for (var i = 1; i < media.length; i++) {
for (i = 1; i < media.length; i++) {
media[i] = 'm=' + media[i];

@@ -31,5 +32,9 @@ if (i !== media.length - 1) {

var contents = [];
media.forEach(function (m) {
contents.push(exports.toMediaJSON(m, session, opts));
});
for (i = 0; i < media.length; i++) {
contents.push(exports.toMediaJSON(media[i], session, {
role: role,
direction: direction,
creator: creators[i] || 'initiator'
}));
}
parsed.contents = contents;

@@ -36,0 +41,0 @@

{
"name": "sdp-jingle-json",
"version": "2.0.0",
"version": "2.1.0",
"description": "A parser/serializer for SDP to JSON. Useful for converting SDP to other formats like Jingle for WebRTC signalling",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -48,3 +48,3 @@ # SDP-Jingle-JSON

var json = sjj.toSessionJSON(sdpBlob, {
creator: 'initiator', // Who created the media contents
creators: ['initiator', 'initiator'], // Who created the media contents
role: 'inititator', // Which side of the offer/answer are we acting as

@@ -51,0 +51,0 @@ direction: 'outgoing' // Are we parsing SDP that we are sending or receiving?

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