public class PnRTCClient
extends java.lang.Object
PeerConnectionAuthor: Kevin Gleason - Boston College '16 File: PnRTCClient.java Date: 7/20/15 Use: PubNub WebRTC Signaling © 2009 - 2015 PubNub, Inc.
| Constructor and Description |
|---|
PnRTCClient(java.lang.String pubKey,
java.lang.String subKey)
Minimal constructor.
|
PnRTCClient(java.lang.String pubKey,
java.lang.String subKey,
java.lang.String UUID)
Slightly more verbose constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attachLocalMediaStream(org.webrtc.MediaStream mediaStream)
Need to attach mediaStream before you can connect.
|
void |
attachRTCListener(PnRTCListener listener)
Attach custom listener for callbacks!
|
org.webrtc.MediaConstraints |
audioConstraints()
Return the
PnRTCClient audio constraints. |
void |
closeAllConnections()
Close all peer connections.
|
void |
closeConnection(java.lang.String userId)
Close a single peer connection.
|
void |
connect(java.lang.String userId)
Connect with another user by their ID.
|
com.pubnub.api.Pubnub |
getPubNub()
Return the
PnRTCClient Pubnub instance. |
java.lang.String |
getUUID()
Return the UUID (username) of the
PnRTCClient. |
void |
listenOn(java.lang.String channel)
Subscribe to a channel using PubNub to listen for calls.
|
void |
onDestroy()
Call this method in Activity.onDestroy() to clost all open connections and clean up
instance for garbage collection.
|
org.webrtc.MediaConstraints |
pcConstraints()
Return the
PnRTCClient peer connection constraints. |
void |
setMaxConnections(int max)
Set the maximum simultaneous connections allowed
|
void |
setSignalParams(PnSignalingParams signalParams)
Set the signaling parameters.
|
void |
transmit(java.lang.String userId,
JSONObject message)
Send a custom JSONObject user message to a single peer.
|
void |
transmitAll(JSONObject message)
Send a custom JSONObject user message to all peers.
|
org.webrtc.MediaConstraints |
videoConstraints()
Return the
PnRTCClient video constraints. |
public PnRTCClient(java.lang.String pubKey,
java.lang.String subKey)
pubKey - PubNub Pub KeysubKey - PubNub Sub Keypublic PnRTCClient(java.lang.String pubKey,
java.lang.String subKey,
java.lang.String UUID)
pubKey - PubNub Pub KeysubKey - PubNub Sub KeyUUID - Any UUID to be used as a usernamepublic org.webrtc.MediaConstraints pcConstraints()
PnRTCClient peer connection constraints.public org.webrtc.MediaConstraints videoConstraints()
PnRTCClient video constraints.public org.webrtc.MediaConstraints audioConstraints()
PnRTCClient audio constraints.public com.pubnub.api.Pubnub getPubNub()
PnRTCClient Pubnub instance.Pubnub instancepublic java.lang.String getUUID()
PnRTCClient. If not
provided by the constructor, a random phone number is generated and can be retrieived
with this methodpublic void setSignalParams(PnSignalingParams signalParams)
MediaConstraints for
PeerConnection, Video, and Audio, as well as a list of possible
PeerConnection.IceServer candidates.signalParams - Parameters for WebRTC Signalingpublic void attachLocalMediaStream(org.webrtc.MediaStream mediaStream)
mediaStream - Not null local media streampublic void attachRTCListener(PnRTCListener listener)
listener - The listener which extends PnRTCListener to implement callbackspublic void setMaxConnections(int max)
max - Max simultaneous connectionspublic void listenOn(java.lang.String channel)
channel - The channel to listen on, your "phone number"public void connect(java.lang.String userId)
userId - The user to establish a WebRTC connection withpublic void closeConnection(java.lang.String userId)
userId - User to close a connection withpublic void closeAllConnections()
public void transmit(java.lang.String userId,
JSONObject message)
userId - user to send a message tomessage - the JSON message to pass to a peer.public void transmitAll(JSONObject message)
message - the JSON message to pass to all peers.public void onDestroy()