summary refs log tree commit diff
path: root/scripts/webrtc/sdp.js
blob: 8949ddd543aacb70d4f39e15267cb10b9c287701 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const { writeFileSync } = require("fs");
const SemanticSDP = require("semantic-sdp");
var data = `m=audio
a=extmap-allow-mixed
a=ice-ufrag:Ets9
a=ice-pwd:CKGC4jufinWBOiKgn9iUji0l
a=ice-options:trickle
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=rtpmap:111 opus/48000/2
a=fingerprint:sha-256 2C:E3:F2:AE:F3:5B:69:32:A9:14:33:40:B3:A8:25:BE:67:A2:58:94:65:0C:9D:55:87:28:94:B6:DC:81:8F:63
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=extmap:13 urn:3gpp:video-orientation
a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space
a=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=rtpmap:96 VP8/90000
a=rtpmap:97 rtx/90000
`;
const sdp = SemanticSDP.SDPInfo.parse(data);

writeFileSync("sdp.json", JSON.stringify(sdp.plain(), null, 2));

const x = require("./sdp.json");

const y = SemanticSDP.SDPInfo.expand(x);

console.log(y);