本文整理汇总了Java中org.webrtc.IceCandidate类的典型用法代码示例。如果您正苦于以下问题:Java IceCandidate类的具体用法?Java IceCandidate怎么用?Java IceCandidate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IceCandidate类属于org.webrtc包,在下文中一共展示了IceCandidate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onIceCandidate
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void onIceCandidate(final IceCandidate iceCandidate) {
mExecutorService.execute(new Runnable() {
@Override
public void run() {
JSONObject candidate = new JSONObject();
jsonPut(candidate, "monitor_id", curMonitorId);
jsonPut(candidate, "type", "candidate");
jsonPut(candidate, "label", iceCandidate.sdpMLineIndex);
jsonPut(candidate, "id", iceCandidate.sdpMid);
jsonPut(candidate, "candidate", iceCandidate.sdp);
// Sending IceCandidate to monitor.
Log.d(TAG, "Sending IceCandidate to monitor:" + candidate.toString());
sendMessage(candidate);
}
});
}
示例2: sendLocalIceCandidate
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void sendLocalIceCandidate(final IceCandidate candidate) {
executor.execute(new Runnable() {
@Override
public void run() {
JSONObject json = new JSONObject();
jsonPut(json, "type", "candidate");
jsonPut(json, "label", candidate.sdpMLineIndex);
jsonPut(json, "id", candidate.sdpMid);
jsonPut(json, "candidate", candidate.sdp);
if (roomState != ConnectionState.CONNECTED) {
reportError("Sending ICE candidate in non connected state.");
return;
}
sendMessage(json.toString());
}
});
}
示例3: sendLocalIceCandidateRemovals
import org.webrtc.IceCandidate; //导入依赖的package包/类
/** Send removed Ice candidates to the other participant. */
@Override
public void sendLocalIceCandidateRemovals(final IceCandidate[] candidates) {
executor.execute(new Runnable() {
@Override
public void run() {
JSONObject json = new JSONObject();
jsonPut(json, "type", "remove-candidates");
JSONArray jsonArray = new JSONArray();
for (final IceCandidate candidate : candidates) {
jsonArray.put(toJsonCandidate(candidate));
}
jsonPut(json, "candidates", jsonArray);
if (roomState != ConnectionState.CONNECTED) {
reportError("Sending ICE candidate removals in non connected state.");
return;
}
sendMessage(json.toString());
}
});
}
示例4: sendLocalIceCandidate
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void sendLocalIceCandidate(final IceCandidate candidate) {
executor.execute(new Runnable() {
@Override
public void run() {
JSONObject json = new JSONObject();
jsonPut(json, "type", "candidate");
jsonPut(json, "label", candidate.sdpMLineIndex);
jsonPut(json, "id", candidate.sdpMid);
jsonPut(json, "candidate", candidate.sdp);
if (roomState != ConnectionState.CONNECTED) {
reportError("Sending ICE candidate in non connected state.");
return;
}
sendMessage(json.toString());
}
});
}
示例5: sendLocalIceCandidateRemovals
import org.webrtc.IceCandidate; //导入依赖的package包/类
/**
* Send removed Ice candidates to the other participant.
*/
@Override
public void sendLocalIceCandidateRemovals(final IceCandidate[] candidates) {
executor.execute(new Runnable() {
@Override
public void run() {
JSONObject json = new JSONObject();
jsonPut(json, "type", "remove-candidates");
JSONArray jsonArray = new JSONArray();
for (final IceCandidate candidate : candidates) {
jsonArray.put(toJsonCandidate(candidate));
}
jsonPut(json, "candidates", jsonArray);
if (roomState != ConnectionState.CONNECTED) {
reportError("Sending ICE candidate removals in non connected state.");
return;
}
sendMessage(json.toString());
}
});
}
示例6: onIceCandidate
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void onIceCandidate(final IceCandidate candidate) {
synchronized (iceCandidateEvent) {
Log.d(TAG, "IceCandidate #" + iceCandidates.size() + " : " + candidate.toString());
if (loopback) {
// Loopback local ICE candidate in a separate thread to avoid adding
// remote ICE candidate in a local ICE candidate callback.
signalingExecutor.execute(new Runnable() {
@Override
public void run() {
pcClient.addRemoteIceCandidate(candidate);
}
});
}
iceCandidates.add(candidate);
iceCandidateEvent.notifyAll();
}
}
示例7: onIceCandidate
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void onIceCandidate(final IceCandidate candidate) {
try {
JSONObject payload = new JSONObject();
payload.put("label", candidate.sdpMLineIndex);
payload.put("id", candidate.sdpMid);
payload.put("candidate", candidate.sdp);
JSONObject message = new JSONObject();
message.put("to", friendName);
message.put("type", "candidate");
message.put("payload", payload);
MqttClientHelper.getInstance(getApplicationContext()).publishMessage(friendName, message.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
示例8: onRoomNotification
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void onRoomNotification(RoomNotification notification) {
Log.i(TAG, "OnRoomNotification (state=" + callState.toString() + "):" + notification);
Map<String, Object> map = notification.getParams();
if(notification.getMethod().equals(RoomListener.METHOD_ICE_CANDIDATE)) {
String sdpMid = map.get("sdpMid").toString();
int sdpMLineIndex = Integer.valueOf(map.get("sdpMLineIndex").toString());
String sdp = map.get("candidate").toString();
IceCandidate ic = new IceCandidate(sdpMid, sdpMLineIndex, sdp);
if (callState == CallState.PUBLISHING || callState == CallState.PUBLISHED) {
nbmWebRTCPeer.addRemoteIceCandidate(ic, "local");
} else {
nbmWebRTCPeer.addRemoteIceCandidate(ic, notification.getParam("endpointName").toString());
}
}
// Somebody in the room published their video
else if(notification.getMethod().equals(RoomListener.METHOD_PARTICIPANT_PUBLISHED)) {
mHandler.postDelayed(offerWhenReady, 2000);
}
}
示例9: consumeIceCandidate
import org.webrtc.IceCandidate; //导入依赖的package包/类
private void consumeIceCandidate(@Nonnull final Element iceCandidateElement,
@Nonnull final String id,
final boolean creating) {
final Node sdpElement = Observable.fromIterable(
DomUtils.convertToList(iceCandidateElement.getChildNodes())
).filter(it -> "sdp".equals(it.getLocalName())).firstElement().blockingGet();
final String sdp = sdpElement == null ? "" : convertSdpElementsToString(sdpElement);
this.eventStream.onNext(new IceCandidateReceivedEvent(
new IceCandidate(
iceCandidateElement.getAttribute("sdpMid"),
Integer.getInteger(iceCandidateElement.getAttribute("sdpMLineIndex")),
sdp
),
id,
creating
));
}
示例10: onTreeNotification
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void onTreeNotification(TreeNotification notification) {
Log.i(TAG, "OnTreeNotification (state=" + treeState.toString() + "):" + notification);
if(notification.getMethod().equals("iceCandidate"))
{
Map<String, Object> map = notification.getParams();
String sdpMid = map.get("sdpMid").toString();
int sdpMLineIndex = Integer.valueOf(map.get("sdpMLineIndex").toString());
String sdp = map.get("candidate").toString();
IceCandidate ic = new IceCandidate(sdpMid, sdpMLineIndex, sdp);
nbmWebRTCPeer.addRemoteIceCandidate(ic, "derp");
}
}
示例11: onIceCandidate
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void onIceCandidate(IceCandidate iceCandidate, NBMPeerConnection nbmPeerConnection) {
if (sinkId != null) {
sendIceCandidateRequestId = ++Constants.id;
MainActivity.getKurentoTreeAPIInstance().sendAddIceCandidate(treeId, sinkId, iceCandidate.sdpMid,
iceCandidate.sdpMLineIndex, iceCandidate.sdp, sendIceCandidateRequestId);
} else {
queuedIceCandidates.add(iceCandidate);
}
// if (callState == CallState.PUBLISHING || callState == CallState.PUBLISHED){
// MainActivity.getKurentoRoomAPIInstance().sendOnIceCandidate(this.username, iceCandidate.sdp,
// iceCandidate.sdpMid, Integer.toString(iceCandidate.sdpMLineIndex), sendIceCandidateRequestId);
// } else {
// MainActivity.getKurentoRoomAPIInstance().sendOnIceCandidate(this.calluser, iceCandidate.sdp,
// iceCandidate.sdpMid, Integer.toString(iceCandidate.sdpMLineIndex), sendIceCandidateRequestId);
// }
}
示例12: onTreeResponse
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void onTreeResponse(TreeResponse response) {
Log.d(TAG, "OnTreeResponse:" + response);
if (Integer.valueOf(response.getId()) == addSinkRequestId){
sinkId = response.getValue("sinkId");
while (!queuedIceCandidates.isEmpty()) {
IceCandidate ic = queuedIceCandidates.remove(0);
onIceCandidate(ic, null);
}
SessionDescription sd = new SessionDescription(SessionDescription.Type.ANSWER,
response.getValue("answerSdp"));
treeState = TreeState.JOINED;
nbmWebRTCPeer.processAnswer(sd, "remote");
} else {
//NOP
}
}
示例13: onTreeNotification
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void onTreeNotification(TreeNotification notification) {
Log.i(TAG, "OnTreeNotification (state=" + treeState.toString() + "):" + notification);
if(notification.getMethod().equals("iceCandidate"))
{
Map<String, Object> map = notification.getParams();
String sdpMid = map.get("sdpMid").toString();
int sdpMLineIndex = Integer.valueOf(map.get("sdpMLineIndex").toString());
String sdp = map.get("candidate").toString();
IceCandidate ic = new IceCandidate(sdpMid, sdpMLineIndex, sdp);
nbmWebRTCPeer.addRemoteIceCandidate(ic, "remote");
}
}
示例14: onIceCandidate
import org.webrtc.IceCandidate; //导入依赖的package包/类
@Override
public void onIceCandidate(final MediaConnection conn, final IceCandidate candidate) {
try {
JSONObject candidateMsg = new JSONObject();
candidateMsg.put("candidate", candidate.sdp);
candidateMsg.put("sdpMLineIndex", candidate.sdpMLineIndex);
candidateMsg.put("sdpMid", candidate.sdpMid);
JSONObject payload = new JSONObject();
payload.put("candidate", candidateMsg);
payload.put("type", "media");
payload.put("connectionId", conn.getConnectionId());
JSONObject message = new JSONObject();
message.put("type", "CANDIDATE");
message.put("payload", payload);
message.put("dst", conn.getPeerId());
mSignaling.queueMessage(message.toString());
} catch (Exception e) {
if (BuildConfig.DEBUG) {
Log.e(TAG, "Failed to create a message that send to a signaling server.", e);
}
}
}
示例15: commonConstructor
import org.webrtc.IceCandidate; //导入依赖的package包/类
/**
* Common constructor logic
*
* @param channel The signaling channel to use for the call
*/
private void commonConstructor(RespokeSignalingChannel channel) {
signalingChannel = channel;
iceServers = new ArrayList<PeerConnection.IceServer>();
queuedLocalCandidates = new ArrayList<IceCandidate>();
queuedRemoteCandidates = new ArrayList<IceCandidate>();
collectedLocalCandidates = new ArrayList<IceCandidate>();
sessionID = Respoke.makeGUID();
timestamp = new Date();
queuedRemoteCandidatesSemaphore = new Semaphore(1); // remote candidates queue mutex
localCandidatesSemaphore = new Semaphore(1); // local candidates queue mutex
if (null != signalingChannel) {
RespokeSignalingChannel.Listener signalingChannelListener = signalingChannel.GetListener();
if (null != signalingChannelListener) {
signalingChannelListener.callCreated(this);
}
}
//TODO resign active handler?
}