File: convert.html

package info (click to toggle)
node-sdp-jingle-json 3.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 196 kB
  • sloc: javascript: 1,383; makefile: 3
file content (44 lines) | stat: -rw-r--r-- 1,387 bytes parent folder | download | duplicates (3)
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
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html>
  <head>
    <title>SDP JSON converter</title>
    <script src="/usr/share/javascript/jquery/jquery.min.js"></script>
    <script src='build/sdp-jingle-json.bundle.js'></script>
    <style type='text/css'>
html,body {margin:0px;}
textarea {position:absolute;top:10px;bottom:40px;width:48%;}
#sdptext {left:10px;}
#jsontext {right:10px;}
button {position:absolute;bottom:5px;line-height:18px;}
#tojson {left:10px;}
#tosdp {left:51%;}
    </style>
    <script type="text/javascript" charset="utf-8">
function toJSON() {
  var sdp = document.getElementById('sdptext').value;
  sdp = sdp.replace(/\r\n/g, '\n');
  sdp = sdp.replace(/\n/g, '\r\n');
  var json = SJJ.toSessionJSON(sdp, {
    creator: 'initiator',
    role: 'initiator',
    direction: 'outgoing'
  });
  document.getElementById('jsontext').value = JSON.stringify(json, null, "  ");
}

function toSDP() {
  var json = JSON.parse(document.getElementById('jsontext').value);
  document.getElementById('sdptext').value = SJJ.toSessionSDP(json, {
    role: 'responder',
    direction: 'incoming'
  });
}
    </script>
  </head>
  <body>
    <textarea id='sdptext' placeholder='Your SDP here'></textarea>
    <button id='tojson' onclick='toJSON()'>To JSON</button>
    <textarea id='jsontext' placeholder='Your JSON here'></textarea>
    <button id='tosdp' onClick='toSDP()'>To SDP</button>
  </body>
</html>