public void execute(String peerId, JSONObject payload) throws JSONException { Log.d(TAG, "SetRemoteSDPCommand"); Peer peer = peers.get(peerId); SessionDescription sdp = new SessionDescription( SessionDescription.Type.fromCanonicalForm(payload.getString("type")), payload.getString("sdp") ); peer.pc.setRemoteDescription(peer, sdp); } }
public void execute(String peerId, JSONObject payload) throws JSONException { Log.d(TAG, "CreateAnswerCommand"); Peer peer = peers.get(peerId); SessionDescription sdp = new SessionDescription( SessionDescription.Type.fromCanonicalForm(payload.getString("type")), payload.getString("sdp") ); peer.pc.setRemoteDescription(peer, sdp); peer.pc.createAnswer(peer, pcConstraints); } }
if (messageType.equals("offer")) { offerSdp = new SessionDescription( SessionDescription.Type.fromCanonicalForm(messageType), message.getString("sdp")); } else if (messageType.equals("candidate")) { IceCandidate candidate = new IceCandidate(
if (messageType.equals("offer")) { offerSdp = new SessionDescription( SessionDescription.Type.fromCanonicalForm(messageType), message.getString("sdp")); } else if (messageType.equals("candidate")) { IceCandidate candidate = new IceCandidate(
if (initiator) { SessionDescription sdp = new SessionDescription( SessionDescription.Type.fromCanonicalForm(type), json.getString("sdp")); events.onRemoteDescription(sdp); } else { if (!initiator) { SessionDescription sdp = new SessionDescription( SessionDescription.Type.fromCanonicalForm(type), json.getString("sdp")); events.onRemoteDescription(sdp); } else {
if (initiator) { SessionDescription sdp = new SessionDescription( SessionDescription.Type.fromCanonicalForm(type), json.getString("sdp")); events.onRemoteDescription(sdp); } else { if (!initiator) { SessionDescription sdp = new SessionDescription( SessionDescription.Type.fromCanonicalForm(type), json.getString("sdp")); events.onRemoteDescription(sdp); } else {
} else if (type.equals("answer")) { SessionDescription sdp = new SessionDescription( SessionDescription.Type.fromCanonicalForm(type), json.getString("sdp")); events.onRemoteDescription(sdp); } else if (type.equals("offer")) { SessionDescription sdp = new SessionDescription( SessionDescription.Type.fromCanonicalForm(type), json.getString("sdp"));
@Override public void run() { if (roomState != ConnectionState.CONNECTED) { reportError("Sending offer SDP in non connected state."); return; } JSONObject json = new JSONObject(); jsonPut(json, "sdp", sdp.description); jsonPut(json, "type", "offer"); sendPostMessage(MessageType.MESSAGE, messageUrl, json.toString()); if (connectionParameters.loopback) { // In loopback mode rename this offer to answer and route it back. SessionDescription sdpAnswer = new SessionDescription( SessionDescription.Type.fromCanonicalForm("answer"), sdp.description); events.onRemoteDescription(sdpAnswer); } } });
@Override public void sendOfferSdp(final SessionDescription sdp) { handler.post(() -> { if (roomState != ConnectionState.CONNECTED) { reportError("Sending offer SDP in non connected state."); return; } JSONObject json = new JSONObject(); jsonPut(json, "sdp", sdp.description); jsonPut(json, "type", "offer"); sendPostMessage(MessageType.MESSAGE, messageUrl, json.toString()); if (connectionParameters.loopback) { // In loopback mode rename this offer to answer and route it back. SessionDescription sdpAnswer = new SessionDescription( SessionDescription.Type.fromCanonicalForm("answer"), sdp.description); events.onRemoteDescription(sdpAnswer); } }); }