OpenVidu¶
OpenVidu class.
-
class
pyopenvidu.openvidu.
OpenVidu
(url: str, secret: str, initial_fetch: bool = True, timeout: Union[int, tuple, None] = None, verify: Union[str, bool, None] = None, cert: Union[tuple, str, None] = None)[source]¶ Bases:
object
This object represents a OpenVidu server instance.
Parameters: - url – The url to reach your OpenVidu Server instance. Typically, something like https://localhost:4443/
- secret – Secret for your OpenVidu Server
- initial_fetch – Enable the initial fetching on object creation. Defaults to True. If set to False a fetch() must be called before doing anything with the object. In most scenarios you won’t need to change this.
- timeout – Set the timeout property of the underlying requests call. Default: None = No timeout. See https://2.python-requests.org/en/latest/user/advanced/#timeouts for possible values.
- verify – Set the verify property of the underlying requests call. Default: None = Use certifi. See https://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification.
- cert – Set the cert property of the underlying requests call. Default: None = No client cert. See https://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification
-
create_session
(custom_session_id: str = None, media_mode: str = None) → pyopenvidu.openvidusession.OpenViduSession[source]¶ Creates a new OpenVidu session.
https://docs.openvidu.io/en/2.16.0/reference-docs/REST-API/#post-openviduapisessions
Parameters: - custom_session_id – You can fix the sessionId that will be assigned to the session with this parameter.
- media_mode – ROUTED (default) or RELAYED
Returns: The created OpenViduSession instance.
-
fetch
() → bool[source]¶ Updates 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 through the sessions property.
Returns: true if the Session status has changed with respect to the server, false if not. This applies to any property or sub-property of the object.
-
get_config
() → dict[source]¶ Get OpenVidu active configuration.
Unlike session related calls. This call does not require prior calling of the fetch() method. Using this function will always result an API call to the backend.
https://docs.openvidu.io/en/2.16.0/reference-docs/REST-API/#get-openviduapiconfig
Returns: The exact response from the server as a dict.
-
get_session
(session_id: str) → pyopenvidu.openvidusession.OpenViduSession[source]¶ Get a currently active session to the server.
Parameters: session_id – The ID of the session to acquire. Returns: An OpenViduSession object.
-
session_count
¶ Get the number of active sessions on the server.
Returns: The number of active sessions.
-
sessions
¶ Get a list of currently active sessions to the server.
Returns: A list of OpenViduSession objects.