Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
josephlim94 committed Sep 24, 2023
1 parent 351390c commit 1f9aa9b
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ docs/_build/*

# pyenv
.python-version

# MAC OS X
.DS_Store
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# -- Project information -----------------------------------------------------

project = "Janus Client"
project = "Python Janus Client"
copyright = "2021, Lim Meng Kiat"
author = "Lim Meng Kiat"

Expand Down Expand Up @@ -59,7 +59,7 @@
}

html_theme_options = {
"description": "Janus WebRTC gateway Python asyncio client",
"description": "Easily send and share WebRTC media through Janus WebRTC server.",
"canonical_url": "https://janus-client-in-python.readthedocs.io/",
"github_user": "josephlim94",
"github_repo": "janus_gst_client_py",
Expand Down
8 changes: 6 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Janus Client
Python Janus Client
==================================================

`Janus`_ WebRTC gateway Python asyncio client.
Easily send and share WebRTC media through `Janus`_ WebRTC server.

.. _JANUS: https://github.com/meetecho/janus-gateway

Expand All @@ -18,6 +18,10 @@ Key Features
============

- Supports HTTP/s and WebSockets communication with Janus.
- Support Admin/Monitor API:
- Generic requests
- Configuration related requests
- Token related requests
- Supports Janus plugin:
- EchoTest Plugin
- VideoCall Plugin
Expand Down
26 changes: 19 additions & 7 deletions docs/plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@
Plugin
=============

Base Class
----------

.. autoclass:: janus_client.JanusPlugin
:members: attach, destroy, send, trickle

VideoRoom Plugin
----------------

.. autoclass:: janus_client.JanusVideoRoomPlugin
:members:
:members:

VideoCall Plugin
----------------

.. autoclass:: janus_client.JanusVideoCallPlugin
:members:

EchoTest Plugin
----------------

.. autoclass:: janus_client.JanusEchoTestPlugin
:members:

Base Class
----------

.. autoclass:: janus_client.JanusPlugin
:members: attach, destroy, send, trickle
5 changes: 5 additions & 0 deletions docs/session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
Session
=======

Create a session object that can be shared between plugin handles

Session Class
-------------

.. autoclass:: janus_client.JanusSession
:members: create, destroy, send, attach_plugin, detach_plugin
22 changes: 20 additions & 2 deletions docs/transport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
Transport
===============

Transport method is detected using regex on base_url parameter passed to Session object.


Base Class
---------------

.. autoclass:: janus_client.JanusTransport
:members: _connect, _disconnect, _send, info, ping
:special-members: __init__
:members: _connect, _disconnect, _send, info, ping, dispatch_session_created, dispatch_session_destroyed, register_transport, create_transport
:special-members: __init__

HTTP
---------------

.. autoclass:: janus_client.JanusTransportHTTP
:members:

Websockets
---------------

.. autoclass:: janus_client.JanusTransportWebsocket
:members:
23 changes: 23 additions & 0 deletions janus_client/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ async def destroy_session(self, session_id: int) -> None:

@staticmethod
def register_transport(protocol_matcher, transport_cls: "JanusTransport") -> None:
"""
Register transport class
Pass in a regex matcher and it will be used to match base_url to the transport class.
"""
JanusTransport.__transport_implementation.append(
(protocol_matcher, transport_cls)
)
Expand All @@ -234,6 +239,24 @@ def register_transport(protocol_matcher, transport_cls: "JanusTransport") -> Non
def create_transport(
base_url: str, api_secret: str = None, token: str = None, config: Dict = {}
) -> "JanusTransport":
"""Create transport class
JanusSession will call this to create the transport class automatically
using base_url parameter.
Args:
base_url (str): _description_
api_secret (str, optional): _description_. Defaults to None.
token (str, optional): _description_. Defaults to None.
config (Dict, optional): _description_. Defaults to {}.
Raises:
Exception: No transport class found
Exception: More than 1 transport class found
Returns:
JanusTransport: Use this object to communicate with Janus server.
"""
# Get matching results
matching_results = []
for transport_implementation in JanusTransport.__transport_implementation:
Expand Down

0 comments on commit 1f9aa9b

Please sign in to comment.