Session Description Parser in C#
Project Repo: https://github.com/icywind/SDPParser
- Visual Studios
- Newtonsoft JSON (added NuGet dependency in Unit Test project “sdptest”)
- Import the package namespace:
using io.agora.sdp;
- Instantiate the Parser class; then use the Parse() method to create a SessionDescription object.
Parser parser = new Parser();
SessionDescription sessionDescription = parser.Parse(sdptext);
- Use Newtonsoft.JsonConvert.Serialize() to convert the sessionDescription into JSON string
Note the SDPParser library itself doesn’t have external dependency. The JSON dependency is required just for the Unit Tests target.
Copy the SDPParser folder to the Unity project's Assets folder.
-
The SDPParser folder has been copied into the Assets folder for the Unity project.
-
NewtonSoft is included in the package
Run the project by hitting Play button
-
Select AgoraObject from the scene Hierarchy
-
Paste your SDP text into the “Sdptext” box
-
Tap the “Parse” button
-
See the console output for the converted JSON