Welcome to Janus Client in Python’s documentation!

Indices and tables


class janus_client.JanusClient(uri: str, api_secret: Optional[str] = None, token: Optional[str] = None)

Janus client instance, connected through websocket

__init__(uri: str, api_secret: Optional[str] = None, token: Optional[str] = None)

Initialize client instance

  • uri – Janus server address

  • api_secret – (optional) API key for shared static secret authentication

  • token – (optional) Token for shared token based authentication

async connect(**kwargs: Any)None

Connect to server

All extra keyword arguments will be passed to websockets.connect

async create_session(session_type: Type[janus_client.session.JanusSession] = <class 'janus_client.session.JanusSession'>)janus_client.session.JanusSession

Create Janus session instance


session_type – Class type of session. Should be JanusSession, no other options yet.

async disconnect()None

Disconnect from server


class janus_client.JanusSession(client: JanusClient, session_id: int)

Janus session instance, created by JanusClient

async create_plugin_handle(plugin_type: Type[PluginBaseType])PluginBaseType

Create plugin handle for the given plugin type

PluginBaseType = TypeVar(‘PluginBaseType’, bound=JanusPlugin)


plugin_type – Plugin type with janus_client.JanusPlugin as base class

async destroy()

Release resources

Should be called when you don’t need the session anymore.
Plugins from this session should be destroyed before this.

Plugin Handle

Base Class

class janus_client.JanusPlugin(session: JanusSession, handle_id: int)

Base class to inherit when implementing a plugin

async destroy()

Destroy plugin handle

handle_async_response(response: dict)

Handle asynchronous events from Janus

Must be overridden


NotImplementedError – If not overridden and received event from server

name = 'janus.plugin.base.dummy'

Plugin name

Must override to match plugin name in Janus server.

async send(message: dict)dict

Send raw message to plugin

Will auto attach plugin ID to the message.


message – JSON serializable dictionary to send


Synchronous reply from server

async trickle(sdpMLineIndex, candidate)

Send WebRTC candidates to Janus

  • sdpMLineIndex – (I don’t know what is this)

  • candidate – Candidate payload. (I got it from WebRTC instance callback)

VideoRoom Plugin

class janus_client.plugin_video_room.JanusVideoRoomPlugin(*args, **kwargs)

Janus VideoRoom plugin instance

Implements API to interact with VideoRoom plugin.

handle_async_response(response: dict)

Handle asynchronous events from Janus

Must be overridden


NotImplementedError – If not overridden and received event from server

async join(room_id: int, publisher_id: int, display_name: str)None

Join a room

A handle can join a room and then do nothing, but this should be called before publishing.
There is an API to configure and publish at the same time, but it’s not implemented yet.
  • room_id – Room ID to join. This must be available at the server.

  • publisher_id – Your publisher ID to set.

  • display_name – Your display name when you join the room.

async list_participants(room_id: int)list

Get participant list

Get a list of publishers in the room, that are currently publishing.


room_id – List participants in this room


A list containing the participants. Can be empty.

name = 'janus.plugin.videoroom'

Plugin name

async pause()None

Pause media streaming

async publish()None

Publish some hardcoded video stream to the handle

Should already have joined a room before this. Then this will publish the hardcoded video stream to the handle.

async start(answer=None)None

Signal WebRTC start. I guess

async subscribe(room_id: int, feed_id: int)None

Subscribe to a feed

  • room_id – Room ID containing the feed. The same ID that you would use to join the room.

  • feed_id – ID of the feed that you want to stream. Should be their publisher ID.

async unpublish()None

Stop publishing

async unsubscribe()None

Unsubscribe from the feed