Giter VIP home page Giter VIP logo

sdp-to-jingle-java's Introduction

sdp-to-jingle-java

The project started as a java port of the sdpToJingle project. At the moment it is a lot more RFC compliant than its JS counterpart. The intention is to create a library that is able to convert SDP into Jingle messages.

This will come in handy if you want to use Jingle as a signaling layer when using WebRTC with PeerConnection

#Usage Using the library is pretty easy, just have a look at the tests.

WebRTC example

Sending the SDP offer created by the PeerConnection class.

// The SDP offer as created by the PeerConnection class.
SessionDescription.description sdp;

// Generate the Jingle IQ based on the offer.
JingleIQ jingleIq = SdpToJingle.jingleFromSdp(sdp);
// Update to, from and action fields.
jingleIq.setTo(to);
jingleIq.setFrom(from);
jingleIq.setAction(action);

// Send the IQ.

Sending the ICE candidates created by the PeerConnection class.

List<String> iceCandidateList;
String sid = "[YourJingleSessionId]";
String mediaName = "[NameToUseInContentTag]";

JingleIQ jingleIq = SdpToJingle.transportInfoFromSdpStub(iceCandidateList, sid, mediaName);
// Update to and from.
jingleIq.setTo(to);
jingleIq.setFrom(from);

// Send the IQ.

Parsing an SDP offer received from Jingle. (This is assuming you've already created your PeerConnection instance that is ready to be used as well as a ready to use answer SdpObserver object.)

// Convert Jingle to SDP.
String sdpString = SdpToJingle.sdpFromJingle(jingleIq).toString();

// Wrap in a SessionDescription object.
SessionDescription.Type sdpType = SessionDescription.Type.OFFER;
SessionDescription sdp = new SessionDescription(sdpType, sdpString);

// Set as remote description.
peerConnection.setRemoteDescription(answerSdpObserver, sdp);

Parsing an ICE candidate received from Jingle. (This is assuming you've already created your PeerConnection instance and it is ready to be used.)

// Convert Jingle to SDP.
CandidatePacketExtension iceCandidate;
String sdpLine = SdpToJingle.iceCandidateLineFromJingle(iceCandidate);

// Wrap in an IceCandidate object.
IceCandidate webrtcIceCandidate = new IceCandidate("audio", 0, sdpLine);

// Add to PeerConnection.
peerConnection.addIceCandidate(webrtcIceCandidate);

#Credits & Contact

sdp-to-jingle-java was created by Tuenti Technologies S.L.. You can follow Tuenti engineering team on Twitter @tuentieng.

#License

sdp-to-jingle-java is available under the Apache License, Version 2.0. See LICENSE file for more info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.