🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

sdp-transform

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sdp-transform

A simple parser/writer for the Session Description Protocol

2.15.0
latest
Source
npm
Version published
Weekly downloads
263K
-6.3%
Maintainers
1
Weekly downloads
 
Created

What is sdp-transform?

The sdp-transform npm package is a library for parsing and writing SDP (Session Description Protocol) data. It is commonly used in WebRTC and other multimedia applications to handle SDP messages, which describe multimedia communication sessions.

What are sdp-transform's main functionalities?

Parsing SDP

This feature allows you to parse an SDP string into a JavaScript object. The code sample demonstrates how to use the `parse` method to convert an SDP string into a more manageable object format.

const sdpTransform = require('sdp-transform');
const sdp = 'v=0\r\no=- 46117327 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\nm=audio 49170 RTP/AVP 0\r\nc=IN IP4 203.0.113.1\r\na=rtpmap:0 PCMU/8000\r\n';
const parsed = sdpTransform.parse(sdp);
console.log(parsed);

Writing SDP

This feature allows you to write a JavaScript object into an SDP string. The code sample demonstrates how to use the `write` method to convert a JavaScript object representing an SDP session into an SDP string.

const sdpTransform = require('sdp-transform');
const session = {
  version: 0,
  origin: {
    username: '-',
    sessionId: 46117327,
    sessionVersion: 2,
    netType: 'IN',
    ipVer: 4,
    address: '127.0.0.1'
  },
  name: '-',
  timing: { start: 0, stop: 0 },
  media: [
    {
      type: 'audio',
      port: 49170,
      protocol: 'RTP/AVP',
      payloads: '0',
      connection: { version: 4, ip: '203.0.113.1' },
      rtp: [{ payload: 0, codec: 'PCMU', rate: 8000 }]
    }
  ]
};
const sdp = sdpTransform.write(session);
console.log(sdp);

Other packages similar to sdp-transform

Keywords

sdp

FAQs

Package last updated on 26 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts