Android Java client sample
An Android client written in Java.
Building the client
- Requires Android Studio 2.3.3
- Edit the file Config.java to enter your proper server configuration.
- Build the project
Controls
- To pan: Use one finger
- To move forward/backward: Keep one finger down and slide second finger up/down to move.
- (TODO): Accelerometer control.
Configuration
The current configuration values are as follows:
public static String signalingServer = "http://localhost:3001";
public static String turnServer = "turn:turn:turnserveruri:5349";
public static String username = "user";
public static String credential = "password";
public static PeerConnection.TlsCertPolicy tlsCertPolicy = PeerConnection.TlsCertPolicy.TLS_CERT_POLICY_SECURE;
With the exception of tlsCertPolicy
these map directly to webrtcConfig options, as follows:
signalingServer
=> webrtcConfig#serverturnServer
=> webrtcConfig#turnServer#uriusername
=> webrtcConfig#turnServer#usernamecredential
=> webrtcConfig#turnServer#password
uniquely for tlsCertPolicy
, we allow the caller to configure how the underlying tls library will verify certificates. This supports
the following values:
PeerConnection.TlsCertPolicy.TLS_CERT_POLICY_INSECURE_NO_CHECK
- disables certificate and chain of trust checksPeerConnection.TlsCertPolicy.TLS_CERT_POLICY_SECURE
- (default) ensures certificate integrity and chain of trust are valid
How it works
Once the config settings are changed, the client will require a server to connect to. In this toolkit, we have a few Sample Servers.
When both the client and server are connected to the same signaling server, they will appear in the peer list.
You can initiate the connection using the client or server, simply select the peer from the list and press join. That will start the video streaming and you can use the above controls to move the camera around the scene.