SdpSerializer.js — An easiest way to modify SDP. It is an object-oriented way of sdp declaration, manipulation and serialization.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
SdpSerializer.js
demo.html

README.md

SdpSerializer.js / Demo

An easiest way to modify SDP. It is an object-oriented way of sdp declaration, manipulation and serialization.

How to use? / Demo
<script src="https://www.webrtc-experiment.com/SdpSerializer.js"></script>
var serializer = new SdpSerializer(sdp);

// remove entire audio m-line
serializer.audio.remove();

// change order of a payload type in video m-line
serializer.video.payload(117).order(0);

// inject new-line after a specific payload type; under video m-line
serializer.video.payload(117).newLine('a=ptime:10');

// remove a specific payload type; under video m-line
serializer.video.payload(100).remove();

// want to add/replace a crypto line?
serializer.video.crypto().newLine('a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:AAAAAAAAAAAAAAAAAAAAAAAAA');

// want to remove a crypto line?
serializer.video.crypto(80).remove();

// want to set direction?
serializer.video.direction.set('sendonly');

// want to get direction?
serializer.video.direction.get();

// want to remove entire audio or video track?
// usually, in video m-line:
// 0-track is always "video" stream
// 1-track will be screen sharing stream (if attached)
serializer.video.track(0).remove()

// get serialized sdp
sdp = serializer.deserialize();

Browser Support

SdpSerializer.js works fine on following web-browsers:

Browser Support
Google Chrome Stable / Canary / Beta / Dev

License

SdpSerializer.js is released under MIT licence . Copyright (c) 2013 Muaz Khan.