Java Code Examples for org.webrtc.DataChannel#Init
The following examples show how to use
org.webrtc.DataChannel#Init .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebRTCNativeMgr.java From appinventor-extensions with Apache License 2.0 | 5 votes |
public void onCreateSuccess(SessionDescription sessionDescription) { try { if (DEBUG) { Log.d(LOG_TAG, "sdp.type = " + sessionDescription.type.canonicalForm()); Log.d(LOG_TAG, "sdp.description = " + sessionDescription.description); } DataChannel.Init init = new DataChannel.Init(); if (sessionDescription.type == SessionDescription.Type.OFFER) { if (DEBUG) { Log.d(LOG_TAG, "Got offer, about to set remote description (again?)"); } peerConnection.setRemoteDescription(sdpObserver, sessionDescription); } else if (sessionDescription.type == SessionDescription.Type.ANSWER) { if (DEBUG) { Log.d(LOG_TAG, "onCreateSuccess: type = ANSWER"); } peerConnection.setLocalDescription(sdpObserver, sessionDescription); haveLocalDescription = true; /* Send to peer */ JSONObject offer = new JSONObject(); offer.put("type", "answer"); offer.put("sdp", sessionDescription.description); JSONObject response = new JSONObject(); response.put("offer", offer); sendRendezvous(response); } } catch (Exception e) { Log.e(LOG_TAG, "Exception during onCreateSuccess", e); } }
Example 2
Source File: NBMWebRTCPeer.java From webrtcpeer-android with Apache License 2.0 | 5 votes |
public void run() { if (mediaResourceManager.getLocalMediaStream() == null) { mediaResourceManager.createMediaConstraints(); startLocalMediaSync(); } NBMPeerConnection connection = peerConnectionResourceManager.getConnection(connectionId); if (connection == null) { if (signalingParameters != null) { connection = peerConnectionResourceManager.createPeerConnection( signalingParameters, mediaResourceManager.getPcConstraints(), connectionId); connection.addObserver(observer); connection.addObserver(mediaResourceManager); if (includeLocalMedia) { connection.getPc().addStream(mediaResourceManager.getLocalMediaStream()); } DataChannel.Init init = new DataChannel.Init(); createDataChannel(this.connectionId, "default", init); // Create offer. Offer SDP will be sent to answering client in // PeerConnectionEvents.onLocalDescription event. connection.createOffer(mediaResourceManager.getSdpMediaConstraints()); } } }
Example 3
Source File: NBMWebRTCPeer.java From webrtcpeer-android with Apache License 2.0 | 5 votes |
public DataChannel createDataChannel(String connectionId, String dataChannelId, DataChannel.Init init) { NBMPeerConnection connection = peerConnectionResourceManager.getConnection(connectionId); if (connection!=null) { return connection.createDataChannel(dataChannelId, init); } else { Log.e(TAG, "Cannot find connection by id: " + connectionId); } return null; }
Example 4
Source File: NBMPeerConnection.java From webrtcpeer-android with Apache License 2.0 | 5 votes |
public ObservedDataChannel(String label, DataChannel.Init init) { channel = pc.createDataChannel(label, init); if (channel != null) { channel.registerObserver(this); Log.i(TAG, "Created data channel with Id: " + label); } else { Log.e(TAG, "Failed to create data channel with Id: " + label); } }
Example 5
Source File: PeerConnectionWrapper.java From bcm-android with GNU General Public License v3.0 | 4 votes |
public DataChannel createDataChannel(String name) { DataChannel.Init dataChannelConfiguration = new DataChannel.Init(); dataChannelConfiguration.ordered = true; return this.peerConnection.createDataChannel(name, dataChannelConfiguration); }
Example 6
Source File: NBMPeerConnection.java From webrtcpeer-android with Apache License 2.0 | 4 votes |
public DataChannel createDataChannel(String label, DataChannel.Init init) { ObservedDataChannel dataChannel = new ObservedDataChannel(label, init); observedDataChannels.put(label, dataChannel); return dataChannel.getChannel(); }