Skip to content

sdp-parser is a WebRTC SDP(Session Description Protocol) parsing/printing library written in TypeScript.

License

Notifications You must be signed in to change notification settings

webrtc-toolbox/sdp-parser

Repository files navigation

sdp-parser

sdp-parser is a SDP(Session Description Protocol) parsing/printing library written in TypeScript.

reference RFCs/protocols

sdp-parser was developed implementing part of these RFCs/protocols:

  • RFC 4566 - SDP: Session Description Protocol
  • JavaScript Session Establishment Protocol

Installation

npm install @webrtc-toolbox/sdp-parser

// or using yarn
yarn add @webrtc-toolbox/sdp-parser

Building

yarn build

should yield dist dictory, within which are:

  • minified JavaScript file index.js,
  • source-map file index.js.map
  • and TypeScript type definations sdp-parser.d.ts.

Usage

parsing

import { parse } from "@webrtc-toolbox/sdp-parser";

const sessionDescription = parse(sdp);

printing

import { print } from "@webrtc-toolbox/sdp-parser";

const sdp = print(sessionDescription);

munging

import { parse, print } from "@webrtc-toolbox/sdp-parser";

const sessionDescription = parse(sdp);

sessionDescription.mediaDescription[0].attributes.ssrcs.push({
  ssrcId: "1024",
  attributeName: "label",
  attributeValue: "oTwikEfJsdv0",
});

const mungedSdp = print(sessionDescription);

roadmap

  • Better error report while parsing
  • Performance improvements

About

sdp-parser is a WebRTC SDP(Session Description Protocol) parsing/printing library written in TypeScript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published