forked from otalk/sdp-jingle-json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.html
37 lines (36 loc) · 1.24 KB
/
convert.html
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
<!DOCTYPE html>
<html>
<head>
<title>SDP JSON converter</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/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);
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);
}
</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>