Intel® Collaboration Suite for WebRTC  version 4.3
Open WebRTC Toolkit (OWT) Client SDK for Android*
P2PClient Class Reference

P2PClient handles PeerConnection interactions between clients. More...

Inheritance diagram for P2PClient:
Collaboration diagram for P2PClient:

Classes

interface  P2PClientObserver
 Interface for observing client events. More...
 

Public Member Functions

 P2PClient (P2PClientConfiguration configuration, SignalingChannelInterface signalingChannel)
 Constructor for P2PClient. More...
 
void addObserver (P2PClientObserver observer)
 Add a P2PClientObserver. More...
 
void removeObserver (P2PClientObserver observer)
 Remove a P2PClientObserver. More...
 
String id ()
 Get the id of the P2PClient. More...
 
void addAllowedRemotePeer (String peerId)
 Add an id of remote P2PClient that allowed to interact with. More...
 
void removeAllowedRemotePeer (String peerId)
 Remove an id of remote P2PClient from allowing to interact with. More...
 
synchronized void connect (final String token, final ActionCallback< String > callback)
 Connect to signaling server. More...
 
void disconnect ()
 Disconnect from the signaling server. More...
 
synchronized void publish (final String peerId, final LocalStream localStream, final ActionCallback< Publication > callback)
 Publish a LocalStream to remote P2PClient. More...
 
synchronized void stop (String peerId)
 Clean all resources associated with given remote endpoint. More...
 
synchronized void getStats (String peerId, final ActionCallback< RTCStatsReport > callback)
 Get the PeerConnection stats. More...
 
synchronized void send (String peerId, String message, ActionCallback< Void > callback)
 Send a text message to a remote P2PClient. More...
 
- Public Member Functions inherited from SignalingChannelInterface.SignalingChannelObserver
void onMessage (String peerId, String message)
 Called upon receiving a message. More...
 
void onServerDisconnected ()
 Called upon server disconnected.
 

Detailed Description

P2PClient handles PeerConnection interactions between clients.

Constructor & Destructor Documentation

P2PClient ( P2PClientConfiguration  configuration,
SignalingChannelInterface  signalingChannel 
)
inline

Constructor for P2PClient.

Parameters
configurationP2PClientConfiguration for P2PClient.
signalingChannelSignalingChannelInterface that P2PClient replied on for sending and receiving data.

Here is the call graph for this function:

Member Function Documentation

void addAllowedRemotePeer ( String  peerId)
inline

Add an id of remote P2PClient that allowed to interact with.

Only a remote P2PClient whose id has been added by this method will be able to interact with this P2PClient.

Parameters
peerIdid of P2PClient to be allowed.
void addObserver ( P2PClientObserver  observer)
inline

Add a P2PClientObserver.

Parameters
observerP2PClientObserver to be added.
synchronized void connect ( final String  token,
final ActionCallback< String >  callback 
)
inline

Connect to signaling server.

Since signaling channel can be customized, this method does not define how a token should look like. Token will be passed into SignalingChannelInterface implemented by the app without any changes.

Parameters
tokentoken information for connecting to the signaling server.
callbackActionCallback.onSuccess will be invoked with the id when succeeds to connect the signaling server. Otherwise when fails to do so, ActionCallback.onFailure will be invoked with the corresponding OwtError.

Here is the call graph for this function:

void disconnect ( )
inline

Disconnect from the signaling server.

This will stop all current active sessions with other P2PClients.

synchronized void getStats ( String  peerId,
final ActionCallback< RTCStatsReport >  callback 
)
inline

Get the PeerConnection stats.

Parameters
peerIdid of remote P2PClient.
callbackActionCallback.onSuccess will be invoked with RTCStatsReport when succeeds to get the stats. Otherwise when fails to do so, ActionCallback.onFailure will be invoked with the corresponding OwtError.
String id ( )
inline

Get the id of the P2PClient.

Returns
id of P2PClient.
synchronized void publish ( final String  peerId,
final LocalStream  localStream,
final ActionCallback< Publication callback 
)
inline

Publish a LocalStream to remote P2PClient.

Parameters
peerIdid of remote P2PClient.
localStreamLocalStream to be published.
callbackActionCallback.onSuccess will be invoked with the Publication when succeeds to publish the LocalStream. Otherwise when fails to do so, ActionCallback .onFailure will be invoked with the corresponding OwtError.
void removeAllowedRemotePeer ( String  peerId)
inline

Remove an id of remote P2PClient from allowing to interact with.

Parameters
peerIdid of P2PClient to be removed.
void removeObserver ( P2PClientObserver  observer)
inline

Remove a P2PClientObserver.

Parameters
observerP2PClientObserver to be removed.
synchronized void send ( String  peerId,
String  message,
ActionCallback< Void >  callback 
)
inline

Send a text message to a remote P2PClient.

Parameters
peerIdid of remote P2PClient.
messagemessage to be sent.
callbackActionCallback.onSuccess will be invoked succeeds to send the message. Otherwise when fails to do so, ActionCallback.onFailure will be invoked with the corresponding OwtError.

Here is the call graph for this function:

synchronized void stop ( String  peerId)
inline

Clean all resources associated with given remote endpoint.

It may include RTCPeerConnection, RTCRtpTransceiver and RTCDataChannel. It still possible to publish a stream, or send a message to given remote P2PClient after stop.

Parameters
peerIdid of remote P2PClient.