Package io.openvidu.java.client
Class OpenVidu
- java.lang.Object
-
- io.openvidu.java.client.OpenVidu
-
public class OpenVidu extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SessioncreateSession()Creates an OpenVidu session with the default settingsSessioncreateSession(SessionProperties properties)Creates an OpenVidu sessionvoiddeleteRecording(String recordingId)Deletes a recording.booleanfetch()Updates every property of every active Session with the current status they have in OpenVidu Server.List<Session>getActiveSessions()Returns the list of active sessions.RecordinggetRecording(String recordingId)Gets an existing recordingList<Recording>listRecordings()Lists all existing recordingsRecordingstartRecording(String sessionId)Starts the recording of aSessionRecordingstartRecording(String sessionId, RecordingProperties properties)Starts the recording of aSessionRecordingstartRecording(String sessionId, String name)Starts the recording of aSessionRecordingstopRecording(String recordingId)Stops the recording of aSession
-
-
-
Method Detail
-
createSession
public Session createSession() throws OpenViduJavaClientException, OpenViduHttpException
Creates an OpenVidu session with the default settings- Returns:
- The created session
- Throws:
OpenViduJavaClientExceptionOpenViduHttpException
-
createSession
public Session createSession(SessionProperties properties) throws OpenViduJavaClientException, OpenViduHttpException
Creates an OpenVidu session- Parameters:
properties- The specific configuration for this session- Returns:
- The created session
- Throws:
OpenViduJavaClientExceptionOpenViduHttpException- Value returned fromOpenViduHttpException.getStatus()409: you are trying to assign an already-in-use custom sessionId to the session. SeeSessionProperties.customSessionId()
-
startRecording
public Recording startRecording(String sessionId, RecordingProperties properties) throws OpenViduJavaClientException, OpenViduHttpException
Starts the recording of aSession- Parameters:
sessionId- The sessionId of the session you want to start recordingproperties- The configuration for this recording- Returns:
- The new created session
- Throws:
OpenViduJavaClientExceptionOpenViduHttpException- Value returned fromOpenViduHttpException.getStatus()404: no session exists for the passed sessionId406: the session has no connected participants422: "resolution" parameter exceeds acceptable values (for both width and height, min 100px and max 1999px) or trying to start a recording with both "hasAudio" and "hasVideo" to false409: the session is not configured for usingMediaMode.ROUTEDor it is already being recorded501: OpenVidu Server recording module is disabled (OPENVIDU_RECORDING property set to false)
-
startRecording
public Recording startRecording(String sessionId, String name) throws OpenViduJavaClientException, OpenViduHttpException
Starts the recording of aSession- Parameters:
sessionId- The sessionId of the session you want to start recordingname- The name you want to give to the video file. WARNING: this parameter follows an overwriting policy. If you name two recordings the same, the newest MP4 file will overwrite the oldest one- Returns:
- The started recording. If this method successfully returns the Recording object it means that the recording can be stopped with guarantees
- Throws:
OpenViduJavaClientExceptionOpenViduHttpException- Value returned fromOpenViduHttpException.getStatus()404: no session exists for the passed sessionId406: the session has no connected participants422: "resolution" parameter exceeds acceptable values (for both width and height, min 100px and max 1999px) or trying to start a recording with both "hasAudio" and "hasVideo" to false409: the session is not configured for usingMediaMode.ROUTEDor it is already being recorded501: OpenVidu Server recording module is disabled (OPENVIDU_RECORDING property set to false)
-
startRecording
public Recording startRecording(String sessionId) throws OpenViduJavaClientException, OpenViduHttpException
Starts the recording of aSession- Parameters:
sessionId- The sessionId of the session you want to start recording- Returns:
- The started recording. If this method successfully returns the Recording object it means that the recording can be stopped with guarantees
- Throws:
OpenViduJavaClientExceptionOpenViduHttpException- Value returned fromOpenViduHttpException.getStatus()404: no session exists for the passed sessionId406: the session has no connected participants422: "resolution" parameter exceeds acceptable values (for both width and height, min 100px and max 1999px) or trying to start a recording with both "hasAudio" and "hasVideo" to false409: the session is not configured for usingMediaMode.ROUTEDor it is already being recorded501: OpenVidu Server recording module is disabled (OPENVIDU_RECORDING property set to false)
-
stopRecording
public Recording stopRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException
Stops the recording of aSession- Parameters:
recordingId- The id property of the recording you want to stop- Returns:
- The stopped recording
- Throws:
OpenViduJavaClientExceptionOpenViduHttpException- Value returned fromOpenViduHttpException.getStatus()404: no recording exists for the passed recordingId406: recording has starting status. Wait until started status before stopping the recording
-
getRecording
public Recording getRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException
Gets an existing recording- Parameters:
recordingId- The id property of the recording you want to retrieve- Throws:
OpenViduJavaClientExceptionOpenViduHttpException- Value returned fromOpenViduHttpException.getStatus()404: no recording exists for the passed recordingId
-
listRecordings
public List<Recording> listRecordings() throws OpenViduJavaClientException, OpenViduHttpException
Lists all existing recordings- Returns:
- A
Listwith all existing recordings - Throws:
OpenViduJavaClientExceptionOpenViduHttpException
-
deleteRecording
public void deleteRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException
Deletes a recording. The recording must have statusRecording.Status.stopped,Recording.Status.readyorRecording.Status.failed- Parameters:
recordingId- The id property of the recording you want to delete- Throws:
OpenViduJavaClientExceptionOpenViduHttpException- Value returned fromOpenViduHttpException.getStatus()404: no recording exists for the passed recordingId409: the recording has started status. Stop it before deletion
-
getActiveSessions
public List<Session> getActiveSessions()
Returns the list of active sessions. This value will remain unchanged since the last time methodfetch()was called. Exceptions to this rule are:- Calling
OpenVidu.createSessionautomatically adds the new Session object to the local collection. - Calling
Session.fetch()updates that specific Session status - Calling
Session.close()automatically removes the Session from the list of active Sessions - Calling
Session.forceDisconnect(Connection)automatically updates the inner affected connections for that specific Session - Calling
Session.forceUnpublish(Publisher)also automatically updates the inner affected connections for that specific Session - Calling
startRecording(String)andstopRecording(String)automatically updates the recording status of the Session (Session.isBeingRecorded())
To get the list of active sessions with their current actual value, you must call firstfetch()and thengetActiveSessions() - Calling
-
fetch
public boolean fetch() throws OpenViduJavaClientException, OpenViduHttpExceptionUpdates every property of every active Session with the current status they have in OpenVidu Server. After calling this method you can access the updated list of active sessions by callinggetActiveSessions()- Returns:
- true if any Session status has changed with respect to the server, false if not. This applies to any property or sub-property of any of the sessions locally stored in OpenVidu Java Client
- Throws:
OpenViduHttpExceptionOpenViduJavaClientException
-
-