public class OpenVidu extends Object
Constructor and Description |
---|
OpenVidu(String hostname,
String secret) |
Modifier and Type | Method and Description |
---|---|
Session |
createSession()
Creates an OpenVidu session with the default settings
|
Session |
createSession(SessionProperties properties)
Creates an OpenVidu session
|
void |
deleteRecording(String recordingId)
Deletes a recording.
|
boolean |
fetch()
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.
|
Recording |
getRecording(String recordingId)
Gets an existing recording
|
List<Recording> |
listRecordings()
Lists all existing recordings
|
Recording |
startRecording(String sessionId)
Starts the recording of a
Session |
Recording |
startRecording(String sessionId,
RecordingProperties properties)
Starts the recording of a
Session |
Recording |
startRecording(String sessionId,
String name)
Starts the recording of a
Session |
Recording |
stopRecording(String recordingId)
Stops the recording of a
Session |
public Session createSession() throws OpenViduJavaClientException, OpenViduHttpException
OpenViduJavaClientException
OpenViduHttpException
public Session createSession(SessionProperties properties) throws OpenViduJavaClientException, OpenViduHttpException
properties
- The specific configuration for this sessionOpenViduJavaClientException
OpenViduHttpException
- Value returned from
OpenViduHttpException.getStatus()
409
: you are trying to
assign an already-in-use custom sessionId
to the session. See
SessionProperties.customSessionId()
public Recording startRecording(String sessionId, RecordingProperties properties) throws OpenViduJavaClientException, OpenViduHttpException
Session
sessionId
- The sessionId of the session you want to start recordingproperties
- The configuration for this recordingOpenViduJavaClientException
OpenViduHttpException
- Value returned from
OpenViduHttpException.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 using
MediaMode.ROUTED
or it is already being recorded501
: OpenVidu Server
recording module is disabled
(OPENVIDU_RECORDING property set
to false)public Recording startRecording(String sessionId, String name) throws OpenViduJavaClientException, OpenViduHttpException
Session
sessionId
- The sessionId of the session you want to start recordingname
- The name you want to give to the video file. You can access
this same value in your clients on recording events
(recordingStarted, recordingStopped). WARNING: this
parameter follows an overwriting policy. If you
name two recordings the same, the newest MP4 file will
overwrite the oldest oneOpenViduJavaClientException
OpenViduHttpException
- Value returned from
OpenViduHttpException.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 using
MediaMode.ROUTED
or it is already being recorded501
: OpenVidu Server
recording module is disabled
(OPENVIDU_RECORDING property set
to false)public Recording startRecording(String sessionId) throws OpenViduJavaClientException, OpenViduHttpException
Session
sessionId
- The sessionId of the session you want to start recordingOpenViduJavaClientException
OpenViduHttpException
- Value returned from
OpenViduHttpException.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 using
MediaMode.ROUTED
or it is already being recorded501
: OpenVidu Server
recording module is disabled
(OPENVIDU_RECORDING property set
to false)public Recording stopRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException
Session
recordingId
- The id property of the recording you want to stopOpenViduJavaClientException
OpenViduHttpException
- Value returned from
OpenViduHttpException.getStatus()
404
: no recording exists
for the passed recordingId406
: recording has
starting status. Wait until
started status before stopping the
recordingpublic Recording getRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException
recordingId
- The id property of the recording you want to retrieveOpenViduJavaClientException
OpenViduHttpException
- Value returned from
OpenViduHttpException.getStatus()
404
: no recording exists
for the passed recordingIdpublic List<Recording> listRecordings() throws OpenViduJavaClientException, OpenViduHttpException
List
with all existing recordingsOpenViduJavaClientException
OpenViduHttpException
public void deleteRecording(String recordingId) throws OpenViduJavaClientException, OpenViduHttpException
Recording.Status.stopped
,
Recording.Status.ready
or
Recording.Status.failed
recordingId
- The id property of the recording you want to deleteOpenViduJavaClientException
OpenViduHttpException
- Value returned from
OpenViduHttpException.getStatus()
404
: no recording exists
for the passed recordingId409
: the recording has
started status. Stop it before
deletionpublic List<Session> getActiveSessions()
fetch()
was called. Exceptions to this rule are:
OpenVidu.createSession
automatically adds the new Session object to the
local collection.Session.fetch()
updates that
specific Session statusSession.close()
automatically
removes the Session from the list of active SessionsSession.forceDisconnect(Connection)
automatically updates the inner affected connections for that specific
SessionSession.forceUnpublish(Publisher)
also automatically updates the inner affected connections for that specific
SessionstartRecording(String)
and stopRecording(String)
automatically updates the recording status of the Session
(Session.isBeingRecorded()
)fetch()
and then
getActiveSessions()
public boolean fetch() throws OpenViduJavaClientException, OpenViduHttpException
getActiveSessions()
OpenViduHttpException
OpenViduJavaClientException
Copyright © 2020 OpenVidu. All rights reserved.