openvidu-java-client API

This is a Java library wrapping OpenVidu Server REST API

Check JavaDoc documentation

Code samples

Create a session

OpenVidu openvidu = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);
SessionProperties properties = new SessionProperties.Builder().build();
Session session = openVidu.createSession(properties);

Generate a token

TokenOptions tokenOptions = new TokenOptions.Builder()
String token = session.generateToken(tokenOptions);

Fetch session status

// Fetch all session info from OpenVidu Server
List<Session> activeSessions = openvidu.getActiveSessions();

// Fetch one session info from OpenVidu Server
List<Connection> activeConnections = session.getActiveConnections();

Close a session


Disconnect a user

// Find the desired Connection object in the list returned by Session.getActiveConnections()

Unpublish a user's stream

// Find the desired Publisher object in the list returned by Connection.getPublishers()

Manage recordings

// Start recording
String sessionId = session.getSessionId();
RecordingProperties properties = new RecordingProperties.Builder().build();
Recording recordingStarted = openVidu.startRecording(sessionId, properties);

// Stop recording
String recordingId = recordingStarted.getId();
Recording recordingStopped = openvidu.stopRecording(recordingId);

// Get recording
Recording recordingRetrieved = openvidu.getRecording(recordingId);

// List recordings
List<Recording> recordingList = openVidu.listRecordings();

// Delete recording